// 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 "GTPC_Types.hh" namespace GTPC__Types { /* Member functions of C++ classes */ ListOfSetupPFCs__gtpc::ListOfSetupPFCs__gtpc() { } ListOfSetupPFCs__gtpc::ListOfSetupPFCs__gtpc(const OCTETSTRING& par_type__gtpc, const INTEGER& par_lengthf, const ListOfSetupPFCsValue__gtpc& par_listOfSetupPFCs) : field_type__gtpc(par_type__gtpc), field_lengthf(par_lengthf), field_listOfSetupPFCs(par_listOfSetupPFCs) { } ListOfSetupPFCs__gtpc::ListOfSetupPFCs__gtpc(const ListOfSetupPFCs__gtpc& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GTPC_Types.ListOfSetupPFCs_gtpc."); if (other_value.type__gtpc().is_bound()) field_type__gtpc = other_value.type__gtpc(); else field_type__gtpc.clean_up(); if (other_value.lengthf().is_bound()) field_lengthf = other_value.lengthf(); else field_lengthf.clean_up(); if (other_value.listOfSetupPFCs().is_bound()) field_listOfSetupPFCs = other_value.listOfSetupPFCs(); else field_listOfSetupPFCs.clean_up(); } void ListOfSetupPFCs__gtpc::clean_up() { field_type__gtpc.clean_up(); field_lengthf.clean_up(); field_listOfSetupPFCs.clean_up(); } const TTCN_Typedescriptor_t* ListOfSetupPFCs__gtpc::get_descriptor() const { return &ListOfSetupPFCs__gtpc_descr_; } ListOfSetupPFCs__gtpc& ListOfSetupPFCs__gtpc::operator=(const ListOfSetupPFCs__gtpc& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GTPC_Types.ListOfSetupPFCs_gtpc."); if (other_value.type__gtpc().is_bound()) field_type__gtpc = other_value.type__gtpc(); else field_type__gtpc.clean_up(); if (other_value.lengthf().is_bound()) field_lengthf = other_value.lengthf(); else field_lengthf.clean_up(); if (other_value.listOfSetupPFCs().is_bound()) field_listOfSetupPFCs = other_value.listOfSetupPFCs(); else field_listOfSetupPFCs.clean_up(); } return *this; } boolean ListOfSetupPFCs__gtpc::operator==(const ListOfSetupPFCs__gtpc& other_value) const { return field_type__gtpc==other_value.field_type__gtpc && field_lengthf==other_value.field_lengthf && field_listOfSetupPFCs==other_value.field_listOfSetupPFCs; } boolean ListOfSetupPFCs__gtpc::is_bound() const { return (field_type__gtpc.is_bound()) || (field_lengthf.is_bound()) || (field_listOfSetupPFCs.is_bound()); } boolean ListOfSetupPFCs__gtpc::is_value() const { return field_type__gtpc.is_value() && field_lengthf.is_value() && field_listOfSetupPFCs.is_value(); } void ListOfSetupPFCs__gtpc::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ type_gtpc := "); field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); field_lengthf.log(); TTCN_Logger::log_event_str(", listOfSetupPFCs := "); field_listOfSetupPFCs.log(); TTCN_Logger::log_event_str(" }"); } void ListOfSetupPFCs__gtpc::set_implicit_omit() { if (type__gtpc().is_bound()) type__gtpc().set_implicit_omit(); if (lengthf().is_bound()) lengthf().set_implicit_omit(); if (listOfSetupPFCs().is_bound()) listOfSetupPFCs().set_implicit_omit(); } void ListOfSetupPFCs__gtpc::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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) listOfSetupPFCs().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "listOfSetupPFCs")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { listOfSetupPFCs().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.ListOfSetupPFCs_gtpc: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.ListOfSetupPFCs_gtpc"); } } void ListOfSetupPFCs__gtpc::encode_text(Text_Buf& text_buf) const { field_type__gtpc.encode_text(text_buf); field_lengthf.encode_text(text_buf); field_listOfSetupPFCs.encode_text(text_buf); } void ListOfSetupPFCs__gtpc::decode_text(Text_Buf& text_buf) { field_type__gtpc.decode_text(text_buf); field_lengthf.decode_text(text_buf); field_listOfSetupPFCs.decode_text(text_buf); } void ListOfSetupPFCs__gtpc::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 ListOfSetupPFCs__gtpc::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 ListOfSetupPFCs__gtpc::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; int value_of_length_field1 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_type__gtpc.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, ListOfSetupPFCs__gtpc_lengthf_descr_.raw->forceomit); decoded_field_length = field_lengthf.RAW_decode(ListOfSetupPFCs__gtpc_lengthf_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()); INTEGER tmp1 = field_lengthf.convert_to_Integer(ListOfSetupPFCs__gtpc_lengthf_descr_); field_lengthf = tmp1; value_of_length_field1 += tmp1.get_long_long_val() * 8; RAW_Force_Omit field_2_force_omit(2, force_omit, ListOfSetupPFCsValue__gtpc_descr_.raw->forceomit); decoded_field_length = field_listOfSetupPFCs.RAW_decode(ListOfSetupPFCsValue__gtpc_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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()); value_of_length_field1 -= decoded_field_length; if (field_type__gtpc != os_102) return -1; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int ListOfSetupPFCs__gtpc::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, ListOfSetupPFCs__gtpc_lengthf_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, ListOfSetupPFCsValue__gtpc_descr_.raw); encoded_length += field_type__gtpc.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += 16; myleaf.body.node.nodes[1]->calc = CALC_LENGTH; myleaf.body.node.nodes[1]->coding_descr = &ListOfSetupPFCs__gtpc_lengthf_descr_; myleaf.body.node.nodes[1]->calcof.lengthto.num_of_fields = 1; myleaf.body.node.nodes[1]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[1]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields = init_lengthto_fields_list(1); myleaf.body.node.nodes[1]->length = 16; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[2]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[2]->curr_pos.pos; encoded_length += field_listOfSetupPFCs.RAW_encode(ListOfSetupPFCsValue__gtpc_descr_, *myleaf.body.node.nodes[2]); if (field_type__gtpc != os_102) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={0}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ os_102.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 ListOfSetupPFCs__gtpc_template::single_value_struct { OCTETSTRING_template field_type__gtpc; INTEGER_template field_lengthf; ListOfSetupPFCsValue__gtpc_template field_listOfSetupPFCs; }; void ListOfSetupPFCs__gtpc_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_type__gtpc = ANY_VALUE; single_value->field_lengthf = ANY_VALUE; single_value->field_listOfSetupPFCs = ANY_VALUE; } } } void ListOfSetupPFCs__gtpc_template::copy_value(const ListOfSetupPFCs__gtpc& other_value) { single_value = new single_value_struct; if (other_value.type__gtpc().is_bound()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (other_value.lengthf().is_bound()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (other_value.listOfSetupPFCs().is_bound()) { single_value->field_listOfSetupPFCs = other_value.listOfSetupPFCs(); } else { single_value->field_listOfSetupPFCs.clean_up(); } set_selection(SPECIFIC_VALUE); } void ListOfSetupPFCs__gtpc_template::copy_template(const ListOfSetupPFCs__gtpc_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.type__gtpc().get_selection()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lengthf().get_selection()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.listOfSetupPFCs().get_selection()) { single_value->field_listOfSetupPFCs = other_value.listOfSetupPFCs(); } else { single_value->field_listOfSetupPFCs.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 ListOfSetupPFCs__gtpc_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 ListOfSetupPFCs__gtpc_template(*other_value.implication_.precondition); implication_.implied_template = new ListOfSetupPFCs__gtpc_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 @GTPC_Types.ListOfSetupPFCs_gtpc."); break; } set_selection(other_value); } ListOfSetupPFCs__gtpc_template::ListOfSetupPFCs__gtpc_template() { } ListOfSetupPFCs__gtpc_template::ListOfSetupPFCs__gtpc_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } ListOfSetupPFCs__gtpc_template::ListOfSetupPFCs__gtpc_template(const ListOfSetupPFCs__gtpc& other_value) { copy_value(other_value); } ListOfSetupPFCs__gtpc_template::ListOfSetupPFCs__gtpc_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const ListOfSetupPFCs__gtpc&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.ListOfSetupPFCs_gtpc from an unbound optional field."); } } ListOfSetupPFCs__gtpc_template::ListOfSetupPFCs__gtpc_template(ListOfSetupPFCs__gtpc_template* p_precondition, ListOfSetupPFCs__gtpc_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } ListOfSetupPFCs__gtpc_template::ListOfSetupPFCs__gtpc_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; } ListOfSetupPFCs__gtpc_template::ListOfSetupPFCs__gtpc_template(const ListOfSetupPFCs__gtpc_template& other_value) : Base_Template() { copy_template(other_value); } ListOfSetupPFCs__gtpc_template::~ListOfSetupPFCs__gtpc_template() { clean_up(); } ListOfSetupPFCs__gtpc_template& ListOfSetupPFCs__gtpc_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } ListOfSetupPFCs__gtpc_template& ListOfSetupPFCs__gtpc_template::operator=(const ListOfSetupPFCs__gtpc& other_value) { clean_up(); copy_value(other_value); return *this; } ListOfSetupPFCs__gtpc_template& ListOfSetupPFCs__gtpc_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const ListOfSetupPFCs__gtpc&)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 @GTPC_Types.ListOfSetupPFCs_gtpc."); } return *this; } ListOfSetupPFCs__gtpc_template& ListOfSetupPFCs__gtpc_template::operator=(const ListOfSetupPFCs__gtpc_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean ListOfSetupPFCs__gtpc_template::match(const ListOfSetupPFCs__gtpc& 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.type__gtpc().is_bound()) return FALSE; if(!single_value->field_type__gtpc.match(other_value.type__gtpc(), legacy))return FALSE; if(!other_value.lengthf().is_bound()) return FALSE; if(!single_value->field_lengthf.match(other_value.lengthf(), legacy))return FALSE; if(!other_value.listOfSetupPFCs().is_bound()) return FALSE; if(!single_value->field_listOfSetupPFCs.match(other_value.listOfSetupPFCs(), 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 @GTPC_Types.ListOfSetupPFCs_gtpc."); } return FALSE; } boolean ListOfSetupPFCs__gtpc_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_type__gtpc.is_bound() || single_value->field_lengthf.is_bound() || single_value->field_listOfSetupPFCs.is_bound(); } boolean ListOfSetupPFCs__gtpc_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_type__gtpc.is_value() && single_value->field_lengthf.is_value() && single_value->field_listOfSetupPFCs.is_value(); } void ListOfSetupPFCs__gtpc_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; } ListOfSetupPFCs__gtpc ListOfSetupPFCs__gtpc_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 @GTPC_Types.ListOfSetupPFCs_gtpc."); ListOfSetupPFCs__gtpc ret_val; if (single_value->field_type__gtpc.is_bound()) { ret_val.type__gtpc() = single_value->field_type__gtpc.valueof(); } if (single_value->field_lengthf.is_bound()) { ret_val.lengthf() = single_value->field_lengthf.valueof(); } if (single_value->field_listOfSetupPFCs.is_bound()) { ret_val.listOfSetupPFCs() = single_value->field_listOfSetupPFCs.valueof(); } return ret_val; } void ListOfSetupPFCs__gtpc_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 @GTPC_Types.ListOfSetupPFCs_gtpc."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new ListOfSetupPFCs__gtpc_template[list_length]; } ListOfSetupPFCs__gtpc_template& ListOfSetupPFCs__gtpc_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 @GTPC_Types.ListOfSetupPFCs_gtpc."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.ListOfSetupPFCs_gtpc."); return value_list.list_value[list_index]; } OCTETSTRING_template& ListOfSetupPFCs__gtpc_template::type__gtpc() { set_specific(); return single_value->field_type__gtpc; } const OCTETSTRING_template& ListOfSetupPFCs__gtpc_template::type__gtpc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field type_gtpc of a non-specific template of type @GTPC_Types.ListOfSetupPFCs_gtpc."); return single_value->field_type__gtpc; } INTEGER_template& ListOfSetupPFCs__gtpc_template::lengthf() { set_specific(); return single_value->field_lengthf; } const INTEGER_template& ListOfSetupPFCs__gtpc_template::lengthf() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthf of a non-specific template of type @GTPC_Types.ListOfSetupPFCs_gtpc."); return single_value->field_lengthf; } ListOfSetupPFCsValue__gtpc_template& ListOfSetupPFCs__gtpc_template::listOfSetupPFCs() { set_specific(); return single_value->field_listOfSetupPFCs; } const ListOfSetupPFCsValue__gtpc_template& ListOfSetupPFCs__gtpc_template::listOfSetupPFCs() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field listOfSetupPFCs of a non-specific template of type @GTPC_Types.ListOfSetupPFCs_gtpc."); return single_value->field_listOfSetupPFCs; } int ListOfSetupPFCs__gtpc_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.ListOfSetupPFCs_gtpc 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 @GTPC_Types.ListOfSetupPFCs_gtpc 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 @GTPC_Types.ListOfSetupPFCs_gtpc containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.ListOfSetupPFCs_gtpc containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.ListOfSetupPFCs_gtpc containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.ListOfSetupPFCs_gtpc containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.ListOfSetupPFCs_gtpc containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.ListOfSetupPFCs_gtpc containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.ListOfSetupPFCs_gtpc containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.ListOfSetupPFCs_gtpc."); } return 0; } void ListOfSetupPFCs__gtpc_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ type_gtpc := "); single_value->field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log(); TTCN_Logger::log_event_str(", listOfSetupPFCs := "); single_value->field_listOfSetupPFCs.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 ListOfSetupPFCs__gtpc_template::log_match(const ListOfSetupPFCs__gtpc& 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_type__gtpc.match(match_value.type__gtpc(), legacy)){ TTCN_Logger::log_logmatch_info(".type_gtpc"); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lengthf.match(match_value.lengthf(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthf"); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_listOfSetupPFCs.match(match_value.listOfSetupPFCs(), legacy)){ TTCN_Logger::log_logmatch_info(".listOfSetupPFCs"); single_value->field_listOfSetupPFCs.log_match(match_value.listOfSetupPFCs(), 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("{ type_gtpc := "); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::log_event_str(", listOfSetupPFCs := "); single_value->field_listOfSetupPFCs.log_match(match_value.listOfSetupPFCs(), 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 ListOfSetupPFCs__gtpc_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_type__gtpc.encode_text(text_buf); single_value->field_lengthf.encode_text(text_buf); single_value->field_listOfSetupPFCs.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 @GTPC_Types.ListOfSetupPFCs_gtpc."); } } void ListOfSetupPFCs__gtpc_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_type__gtpc.decode_text(text_buf); single_value->field_lengthf.decode_text(text_buf); single_value->field_listOfSetupPFCs.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 ListOfSetupPFCs__gtpc_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 @GTPC_Types.ListOfSetupPFCs_gtpc."); } } void ListOfSetupPFCs__gtpc_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: { ListOfSetupPFCs__gtpc_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) listOfSetupPFCs().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "listOfSetupPFCs")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { listOfSetupPFCs().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.ListOfSetupPFCs_gtpc: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { ListOfSetupPFCs__gtpc_template* precondition = new ListOfSetupPFCs__gtpc_template; precondition->set_param(*param.get_elem(0)); ListOfSetupPFCs__gtpc_template* implied_template = new ListOfSetupPFCs__gtpc_template; implied_template->set_param(*param.get_elem(1)); *this = ListOfSetupPFCs__gtpc_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.ListOfSetupPFCs_gtpc"); } is_ifpresent = param.get_ifpresent(); } void ListOfSetupPFCs__gtpc_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_type__gtpc.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.ListOfSetupPFCs_gtpc"); single_value->field_lengthf.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.ListOfSetupPFCs_gtpc"); single_value->field_listOfSetupPFCs.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.ListOfSetupPFCs_gtpc"); 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 : "@GTPC_Types.ListOfSetupPFCs_gtpc"); } boolean ListOfSetupPFCs__gtpc_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean ListOfSetupPFCs__gtpc_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; } PS__HandoverXIDParameters__List::PS__HandoverXIDParameters__List(const PS__HandoverXIDParameters__List& other_value) { if (!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GTPC_Types.PS_HandoverXIDParameters_List."); val_ptr = other_value.val_ptr; val_ptr->ref_count++; } PS__HandoverXIDParameters__List::~PS__HandoverXIDParameters__List() { clean_up(); if (val_ptr != NULL) val_ptr = NULL; } void PS__HandoverXIDParameters__List::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."); } } PS__HandoverXIDParameters__List& PS__HandoverXIDParameters__List::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; } PS__HandoverXIDParameters__List& PS__HandoverXIDParameters__List::operator=(const PS__HandoverXIDParameters__List& other_value) { if (other_value.val_ptr == NULL) TTCN_error("Assigning an unbound value of type @GTPC_Types.PS_HandoverXIDParameters_List."); if (this != &other_value) { clean_up(); val_ptr = other_value.val_ptr; val_ptr->ref_count++; } return *this; } boolean PS__HandoverXIDParameters__List::operator==(null_type) const { if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @GTPC_Types.PS_HandoverXIDParameters_List."); return val_ptr->n_elements == 0 ; } boolean PS__HandoverXIDParameters__List::operator==(const PS__HandoverXIDParameters__List& other_value) const { if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @GTPC_Types.PS_HandoverXIDParameters_List."); if (other_value.val_ptr == NULL) TTCN_error("The right operand of comparison is an unbound value of type @GTPC_Types.PS_HandoverXIDParameters_List."); 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; } PS__HandoverXIDParameters& PS__HandoverXIDParameters__List::operator[](int index_value) { if (index_value < 0) TTCN_error("Accessing an element of type @GTPC_Types.PS_HandoverXIDParameters_List 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 = (PS__HandoverXIDParameters**)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 PS__HandoverXIDParameters(*(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 PS__HandoverXIDParameters; } return *val_ptr->value_elements[index_value]; } PS__HandoverXIDParameters& PS__HandoverXIDParameters__List::operator[](const INTEGER& index_value) { index_value.must_bound("Using an unbound integer value for indexing a value of type @GTPC_Types.PS_HandoverXIDParameters_List."); return (*this)[(int)index_value]; } const PS__HandoverXIDParameters& PS__HandoverXIDParameters__List::operator[](int index_value) const { if (val_ptr == NULL) TTCN_error("Accessing an element in an unbound value of type @GTPC_Types.PS_HandoverXIDParameters_List."); if (index_value < 0) TTCN_error("Accessing an element of type @GTPC_Types.PS_HandoverXIDParameters_List using a negative index: %d.", index_value); if (index_value >= val_ptr->n_elements) TTCN_error("Index overflow in a value of type @GTPC_Types.PS_HandoverXIDParameters_List: 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 PS__HandoverXIDParameters& PS__HandoverXIDParameters__List::operator[](const INTEGER& index_value) const { index_value.must_bound("Using an unbound integer value for indexing a value of type @GTPC_Types.PS_HandoverXIDParameters_List."); return (*this)[(int)index_value]; } PS__HandoverXIDParameters__List PS__HandoverXIDParameters__List::operator<<=(int rotate_count) const { return *this >>= (-rotate_count); } PS__HandoverXIDParameters__List PS__HandoverXIDParameters__List::operator<<=(const INTEGER& rotate_count) const { rotate_count.must_bound("Unbound integer operand of rotate left operator."); return *this >>= (int)(-rotate_count); } PS__HandoverXIDParameters__List PS__HandoverXIDParameters__List::operator>>=(const INTEGER& rotate_count) const { rotate_count.must_bound("Unbound integer operand of rotate right operator."); return *this >>= (int)rotate_count; } PS__HandoverXIDParameters__List PS__HandoverXIDParameters__List::operator>>=(int rotate_count) const { if (val_ptr == NULL) TTCN_error("Performing rotation operation on an unbound value of type @GTPC_Types.PS_HandoverXIDParameters_List."); 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; PS__HandoverXIDParameters__List 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 PS__HandoverXIDParameters(*val_ptr->value_elements[i]); } } return ret_val; } PS__HandoverXIDParameters__List PS__HandoverXIDParameters__List::operator+(const PS__HandoverXIDParameters__List& other_value) const { if (val_ptr == NULL || other_value.val_ptr == NULL) TTCN_error("Unbound operand of @GTPC_Types.PS_HandoverXIDParameters_List concatenation."); if (val_ptr->n_elements == 0) return other_value; if (other_value.val_ptr->n_elements == 0) return *this; PS__HandoverXIDParameters__List 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 PS__HandoverXIDParameters(*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 PS__HandoverXIDParameters(*other_value.val_ptr->value_elements[i]); } } return ret_val; } PS__HandoverXIDParameters__List PS__HandoverXIDParameters__List::substr(int index, int returncount) const { if (val_ptr == NULL) TTCN_error("The first argument of substr() is an unbound value of type @GTPC_Types.PS_HandoverXIDParameters_List."); check_substr_arguments(val_ptr->n_elements, index, returncount, "@GTPC_Types.PS_HandoverXIDParameters_List","element"); PS__HandoverXIDParameters__List ret_val; ret_val.set_size(returncount); for (int i=0; ivalue_elements[i+index] != NULL) { ret_val.val_ptr->value_elements[i] = new PS__HandoverXIDParameters(*val_ptr->value_elements[i+index]); } } return ret_val; } PS__HandoverXIDParameters__List PS__HandoverXIDParameters__List::replace(int index, int len, const PS__HandoverXIDParameters__List& repl) const { if (val_ptr == NULL) TTCN_error("The first argument of replace() is an unbound value of type @GTPC_Types.PS_HandoverXIDParameters_List."); if (repl.val_ptr == NULL) TTCN_error("The fourth argument of replace() is an unbound value of type @GTPC_Types.PS_HandoverXIDParameters_List."); check_replace_arguments(val_ptr->n_elements, index, len, "@GTPC_Types.PS_HandoverXIDParameters_List","element"); PS__HandoverXIDParameters__List 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 PS__HandoverXIDParameters(*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 PS__HandoverXIDParameters(*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 PS__HandoverXIDParameters(*val_ptr->value_elements[index+i+len]); } } return ret_val; } PS__HandoverXIDParameters__List PS__HandoverXIDParameters__List::replace(int index, int len, const PS__HandoverXIDParameters__List_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 PS__HandoverXIDParameters__List::set_size(int new_size) { if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a value of type @GTPC_Types.PS_HandoverXIDParameters_List."); 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 = (PS__HandoverXIDParameters**)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 PS__HandoverXIDParameters(*(val_ptr->value_elements[elem_count])); } } clean_up(); val_ptr = new_val_ptr; } if (new_size > val_ptr->n_elements) { val_ptr->value_elements = (PS__HandoverXIDParameters**)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 @GTPC_Types.PS_HandoverXIDParameters_List: %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 = (PS__HandoverXIDParameters**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size); val_ptr->n_elements = new_size; } } boolean PS__HandoverXIDParameters__List::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 PS__HandoverXIDParameters__List::size_of() const { if (val_ptr == NULL) TTCN_error("Performing sizeof operation on an unbound value of type @GTPC_Types.PS_HandoverXIDParameters_List."); return val_ptr->n_elements; } int PS__HandoverXIDParameters__List::lengthof() const { if (val_ptr == NULL) TTCN_error("Performing lengthof operation on an unbound value of type @GTPC_Types.PS_HandoverXIDParameters_List."); 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 PS__HandoverXIDParameters__List::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 PS__HandoverXIDParameters__List::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 PS__HandoverXIDParameters__List::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", "@GTPC_Types.PS_HandoverXIDParameters_List"); } 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", "@GTPC_Types.PS_HandoverXIDParameters_List"); } break; default: TTCN_error("Internal error: Unknown operation type."); } } void PS__HandoverXIDParameters__List::encode_text(Text_Buf& text_buf) const { if (val_ptr == NULL) TTCN_error("Text encoder: Encoding an unbound value of type @GTPC_Types.PS_HandoverXIDParameters_List."); 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 PS__HandoverXIDParameters__List::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 @GTPC_Types.PS_HandoverXIDParameters_List."); val_ptr->value_elements = (PS__HandoverXIDParameters**)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 PS__HandoverXIDParameters; val_ptr->value_elements[elem_count]->decode_text(text_buf); } } void PS__HandoverXIDParameters__List::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 PS__HandoverXIDParameters__List::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 PS__HandoverXIDParameters__List::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 PS__HandoverXIDParameters__List::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 PS__HandoverXIDParameters__List_template::copy_value(const PS__HandoverXIDParameters__List& other_value) { if (!other_value.is_bound()) TTCN_error("Initialization of a template of type @GTPC_Types.PS_HandoverXIDParameters_List with an unbound value."); single_value.n_elements = other_value.size_of(); single_value.value_elements = (PS__HandoverXIDParameters_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 PS__HandoverXIDParameters_template(other_value[elem_count]); } else { single_value.value_elements[elem_count] = new PS__HandoverXIDParameters_template; } } set_selection(SPECIFIC_VALUE); } void PS__HandoverXIDParameters__List_template::copy_template(const PS__HandoverXIDParameters__List_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 = (PS__HandoverXIDParameters_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 PS__HandoverXIDParameters_template(*other_value.single_value.value_elements[elem_count]); } else { single_value.value_elements[elem_count] = new PS__HandoverXIDParameters_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 PS__HandoverXIDParameters__List_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 PS__HandoverXIDParameters__List_template(*other_value.implication_.precondition); implication_.implied_template = new PS__HandoverXIDParameters__List_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 @GTPC_Types.PS_HandoverXIDParameters_List."); break; } set_selection(other_value); } boolean PS__HandoverXIDParameters__List_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 PS__HandoverXIDParameters__List_template*)template_ptr)->single_value.value_elements[template_index]->match((*(const PS__HandoverXIDParameters__List*)value_ptr)[value_index], legacy); else return ((const PS__HandoverXIDParameters__List_template*)template_ptr)->single_value.value_elements[template_index]->is_any_or_omit(); } PS__HandoverXIDParameters__List_template::PS__HandoverXIDParameters__List_template() { } PS__HandoverXIDParameters__List_template::PS__HandoverXIDParameters__List_template(template_sel other_value) : Base_Record_Of_Template(other_value) { check_single_selection(other_value); } PS__HandoverXIDParameters__List_template::PS__HandoverXIDParameters__List_template(null_type) : Base_Record_Of_Template(SPECIFIC_VALUE) { single_value.n_elements = 0; single_value.value_elements = NULL; } PS__HandoverXIDParameters__List_template::PS__HandoverXIDParameters__List_template(const PS__HandoverXIDParameters__List& other_value) { copy_value(other_value); } PS__HandoverXIDParameters__List_template::PS__HandoverXIDParameters__List_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PS__HandoverXIDParameters__List&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.PS_HandoverXIDParameters_List from an unbound optional field."); } } PS__HandoverXIDParameters__List_template::PS__HandoverXIDParameters__List_template(PS__HandoverXIDParameters__List_template* p_precondition, PS__HandoverXIDParameters__List_template* p_implied_template) : Base_Record_Of_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } PS__HandoverXIDParameters__List_template::PS__HandoverXIDParameters__List_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; } PS__HandoverXIDParameters__List_template::PS__HandoverXIDParameters__List_template(const PS__HandoverXIDParameters__List_template& other_value) : Base_Record_Of_Template() { copy_template(other_value); } PS__HandoverXIDParameters__List_template::~PS__HandoverXIDParameters__List_template() { clean_up(); } void PS__HandoverXIDParameters__List_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; } PS__HandoverXIDParameters__List_template& PS__HandoverXIDParameters__List_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } PS__HandoverXIDParameters__List_template& PS__HandoverXIDParameters__List_template::operator=(null_type) { clean_up(); set_selection(SPECIFIC_VALUE); single_value.n_elements = 0; single_value.value_elements = NULL; return *this; } PS__HandoverXIDParameters__List_template& PS__HandoverXIDParameters__List_template::operator=(const PS__HandoverXIDParameters__List& other_value) { clean_up(); copy_value(other_value); return *this; } PS__HandoverXIDParameters__List_template& PS__HandoverXIDParameters__List_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PS__HandoverXIDParameters__List&)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 @GTPC_Types.PS_HandoverXIDParameters_List."); } return *this; } PS__HandoverXIDParameters__List_template& PS__HandoverXIDParameters__List_template::operator=(const PS__HandoverXIDParameters__List_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } PS__HandoverXIDParameters_template& PS__HandoverXIDParameters__List_template::operator[](int index_value) { if (index_value < 0) TTCN_error("Accessing an element of a template for type @GTPC_Types.PS_HandoverXIDParameters_List 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 @GTPC_Types.PS_HandoverXIDParameters_List."); break; } return *single_value.value_elements[index_value]; } PS__HandoverXIDParameters_template& PS__HandoverXIDParameters__List_template::operator[](const INTEGER& index_value) { index_value.must_bound("Using an unbound integer value for indexing a template of type @GTPC_Types.PS_HandoverXIDParameters_List."); return (*this)[(int)index_value]; } const PS__HandoverXIDParameters_template& PS__HandoverXIDParameters__List_template::operator[](int index_value) const { if (index_value < 0) TTCN_error("Accessing an element of a template for type @GTPC_Types.PS_HandoverXIDParameters_List using a negative index: %d.", index_value); if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing an element of a non-specific template for type @GTPC_Types.PS_HandoverXIDParameters_List."); if (index_value >= single_value.n_elements) TTCN_error("Index overflow in a template of type @GTPC_Types.PS_HandoverXIDParameters_List: 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 PS__HandoverXIDParameters_template& PS__HandoverXIDParameters__List_template::operator[](const INTEGER& index_value) const { index_value.must_bound("Using an unbound integer value for indexing a template of type @GTPC_Types.PS_HandoverXIDParameters_List."); return (*this)[(int)index_value]; } void PS__HandoverXIDParameters__List_template::set_size(int new_size) { if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a template of type @GTPC_Types.PS_HandoverXIDParameters_List."); 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 = (PS__HandoverXIDParameters_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 PS__HandoverXIDParameters_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 PS__HandoverXIDParameters_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 = (PS__HandoverXIDParameters_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size); single_value.n_elements = new_size; } } int PS__HandoverXIDParameters__List_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 PS__HandoverXIDParameters__List_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 @GTPC_Types.PS_HandoverXIDParameters_List 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 @GTPC_Types.PS_HandoverXIDParameters_List 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 @GTPC_Types.PS_HandoverXIDParameters_List 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 @GTPC_Types.PS_HandoverXIDParameters_List 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 @GTPC_Types.PS_HandoverXIDParameters_List 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 @GTPC_Types.PS_HandoverXIDParameters_List containing complemented list.", op_name); default: TTCN_error("Performing %sof() operation on an uninitialized/unsupported template of type @GTPC_Types.PS_HandoverXIDParameters_List.", op_name); } return check_section_is_single(min_size, has_any_or_none, op_name, "a", "template of type @GTPC_Types.PS_HandoverXIDParameters_List"); } boolean PS__HandoverXIDParameters__List_template::match(const PS__HandoverXIDParameters__List& 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 @GTPC_Types.PS_HandoverXIDParameters_List."); } return FALSE; } boolean PS__HandoverXIDParameters__List_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; } PS__HandoverXIDParameters__List PS__HandoverXIDParameters__List_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 @GTPC_Types.PS_HandoverXIDParameters_List."); PS__HandoverXIDParameters__List 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; } PS__HandoverXIDParameters__List PS__HandoverXIDParameters__List_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); } PS__HandoverXIDParameters__List PS__HandoverXIDParameters__List_template::replace(int index, int len, const PS__HandoverXIDParameters__List_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()); } PS__HandoverXIDParameters__List PS__HandoverXIDParameters__List_template::replace(int index, int len, const PS__HandoverXIDParameters__List& 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 PS__HandoverXIDParameters__List_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 PS__HandoverXIDParameters__List_template[list_length]; break; default: TTCN_error("Internal error: Setting an invalid type for a template of type @GTPC_Types.PS_HandoverXIDParameters_List."); } set_selection(template_type); } PS__HandoverXIDParameters__List_template& PS__HandoverXIDParameters__List_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 @GTPC_Types.PS_HandoverXIDParameters_List."); if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of type @GTPC_Types.PS_HandoverXIDParameters_List."); return value_list.list_value[list_index]; } void PS__HandoverXIDParameters__List_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 PS__HandoverXIDParameters__List_template::log_match(const PS__HandoverXIDParameters__List& 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 PS__HandoverXIDParameters__List_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 @GTPC_Types.PS_HandoverXIDParameters_List."); } } void PS__HandoverXIDParameters__List_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 @GTPC_Types.PS_HandoverXIDParameters_List."); single_value.value_elements = (PS__HandoverXIDParameters_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 PS__HandoverXIDParameters_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 PS__HandoverXIDParameters__List_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 @GTPC_Types.PS_HandoverXIDParameters_List."); } } boolean PS__HandoverXIDParameters__List_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean PS__HandoverXIDParameters__List_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: { PS__HandoverXIDParameters__List_template* precondition = new PS__HandoverXIDParameters__List_template; precondition->set_param(*param.get_elem(0)); PS__HandoverXIDParameters__List_template* implied_template = new PS__HandoverXIDParameters__List_template; implied_template->set_param(*param.get_elem(1)); *this = PS__HandoverXIDParameters__List_template(precondition, implied_template); } break; default: param.type_error("record of template", "@GTPC_Types.PS_HandoverXIDParameters_List"); } is_ifpresent = param.get_ifpresent(); set_length_range(param); } void PS__HandoverXIDParameters__List_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 : "@GTPC_Types.PS_HandoverXIDParameters_List"); 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 : "@GTPC_Types.PS_HandoverXIDParameters_List"); } boolean PS__HandoverXIDParameters__List_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); } } PS__HandoverXIDParameters::PS__HandoverXIDParameters() { } PS__HandoverXIDParameters::PS__HandoverXIDParameters(const OCTETSTRING& par_type__gtpc, const INTEGER& par_lengthf, const BITSTRING& par_sapi, const BITSTRING& par_spare, const INTEGER& par_xID__ParametersLength, const OPTIONAL< XID__Information__GTPC >& par_xID__Parameters) : field_type__gtpc(par_type__gtpc), field_lengthf(par_lengthf), field_sapi(par_sapi), field_spare(par_spare), field_xID__ParametersLength(par_xID__ParametersLength), field_xID__Parameters(par_xID__Parameters) { } PS__HandoverXIDParameters::PS__HandoverXIDParameters(const PS__HandoverXIDParameters& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GTPC_Types.PS_HandoverXIDParameters."); if (other_value.type__gtpc().is_bound()) field_type__gtpc = other_value.type__gtpc(); else field_type__gtpc.clean_up(); if (other_value.lengthf().is_bound()) field_lengthf = other_value.lengthf(); else field_lengthf.clean_up(); if (other_value.sapi().is_bound()) field_sapi = other_value.sapi(); else field_sapi.clean_up(); if (other_value.spare().is_bound()) field_spare = other_value.spare(); else field_spare.clean_up(); if (other_value.xID__ParametersLength().is_bound()) field_xID__ParametersLength = other_value.xID__ParametersLength(); else field_xID__ParametersLength.clean_up(); if (other_value.xID__Parameters().is_bound()) field_xID__Parameters = other_value.xID__Parameters(); else field_xID__Parameters.clean_up(); } void PS__HandoverXIDParameters::clean_up() { field_type__gtpc.clean_up(); field_lengthf.clean_up(); field_sapi.clean_up(); field_spare.clean_up(); field_xID__ParametersLength.clean_up(); field_xID__Parameters.clean_up(); } const TTCN_Typedescriptor_t* PS__HandoverXIDParameters::get_descriptor() const { return &PS__HandoverXIDParameters_descr_; } PS__HandoverXIDParameters& PS__HandoverXIDParameters::operator=(const PS__HandoverXIDParameters& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GTPC_Types.PS_HandoverXIDParameters."); if (other_value.type__gtpc().is_bound()) field_type__gtpc = other_value.type__gtpc(); else field_type__gtpc.clean_up(); if (other_value.lengthf().is_bound()) field_lengthf = other_value.lengthf(); else field_lengthf.clean_up(); if (other_value.sapi().is_bound()) field_sapi = other_value.sapi(); else field_sapi.clean_up(); if (other_value.spare().is_bound()) field_spare = other_value.spare(); else field_spare.clean_up(); if (other_value.xID__ParametersLength().is_bound()) field_xID__ParametersLength = other_value.xID__ParametersLength(); else field_xID__ParametersLength.clean_up(); if (other_value.xID__Parameters().is_bound()) field_xID__Parameters = other_value.xID__Parameters(); else field_xID__Parameters.clean_up(); } return *this; } boolean PS__HandoverXIDParameters::operator==(const PS__HandoverXIDParameters& other_value) const { return field_type__gtpc==other_value.field_type__gtpc && field_lengthf==other_value.field_lengthf && field_sapi==other_value.field_sapi && field_spare==other_value.field_spare && field_xID__ParametersLength==other_value.field_xID__ParametersLength && field_xID__Parameters==other_value.field_xID__Parameters; } boolean PS__HandoverXIDParameters::is_bound() const { return (field_type__gtpc.is_bound()) || (field_lengthf.is_bound()) || (field_sapi.is_bound()) || (field_spare.is_bound()) || (field_xID__ParametersLength.is_bound()) || (OPTIONAL_OMIT == field_xID__Parameters.get_selection() || field_xID__Parameters.is_bound()); } boolean PS__HandoverXIDParameters::is_value() const { return field_type__gtpc.is_value() && field_lengthf.is_value() && field_sapi.is_value() && field_spare.is_value() && field_xID__ParametersLength.is_value() && (OPTIONAL_OMIT == field_xID__Parameters.get_selection() || field_xID__Parameters.is_value()); } int PS__HandoverXIDParameters::size_of() const { int ret_val = 5; if (field_xID__Parameters.ispresent()) ret_val++; return ret_val; } void PS__HandoverXIDParameters::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ type_gtpc := "); field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); field_lengthf.log(); TTCN_Logger::log_event_str(", sapi := "); field_sapi.log(); TTCN_Logger::log_event_str(", spare := "); field_spare.log(); TTCN_Logger::log_event_str(", xID_ParametersLength := "); field_xID__ParametersLength.log(); TTCN_Logger::log_event_str(", xID_Parameters := "); field_xID__Parameters.log(); TTCN_Logger::log_event_str(" }"); } void PS__HandoverXIDParameters::set_implicit_omit() { if (type__gtpc().is_bound()) type__gtpc().set_implicit_omit(); if (lengthf().is_bound()) lengthf().set_implicit_omit(); if (sapi().is_bound()) sapi().set_implicit_omit(); if (spare().is_bound()) spare().set_implicit_omit(); if (xID__ParametersLength().is_bound()) xID__ParametersLength().set_implicit_omit(); if (!xID__Parameters().is_bound()) xID__Parameters() = OMIT_VALUE; else xID__Parameters().set_implicit_omit(); } void PS__HandoverXIDParameters::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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) sapi().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) xID__ParametersLength().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) xID__Parameters().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "sapi")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { sapi().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "spare")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "xID_ParametersLength")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { xID__ParametersLength().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "xID_Parameters")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { xID__Parameters().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.PS_HandoverXIDParameters: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.PS_HandoverXIDParameters"); } } void PS__HandoverXIDParameters::encode_text(Text_Buf& text_buf) const { field_type__gtpc.encode_text(text_buf); field_lengthf.encode_text(text_buf); field_sapi.encode_text(text_buf); field_spare.encode_text(text_buf); field_xID__ParametersLength.encode_text(text_buf); field_xID__Parameters.encode_text(text_buf); } void PS__HandoverXIDParameters::decode_text(Text_Buf& text_buf) { field_type__gtpc.decode_text(text_buf); field_lengthf.decode_text(text_buf); field_sapi.decode_text(text_buf); field_spare.decode_text(text_buf); field_xID__ParametersLength.decode_text(text_buf); field_xID__Parameters.decode_text(text_buf); } void PS__HandoverXIDParameters::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 PS__HandoverXIDParameters::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 PS__HandoverXIDParameters::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; int value_of_length_field1 = 0; int value_of_length_field4 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_type__gtpc.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, PS__HandoverXIDParameters_lengthf_descr_.raw->forceomit); decoded_field_length = field_lengthf.RAW_decode(PS__HandoverXIDParameters_lengthf_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()); INTEGER tmp1 = field_lengthf.convert_to_Integer(PS__HandoverXIDParameters_lengthf_descr_); field_lengthf = tmp1; value_of_length_field1 += tmp1.get_long_long_val() * 8; RAW_Force_Omit field_2_force_omit(2, force_omit, General__Types::BIT4_descr_.raw->forceomit); decoded_field_length = field_sapi.RAW_decode(General__Types::BIT4_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::BIT4_descr_.raw->forceomit); decoded_field_length = field_spare.RAW_decode(General__Types::BIT4_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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_field1 -= decoded_field_length; RAW_Force_Omit field_4_force_omit(4, force_omit, PS__HandoverXIDParameters_xID__ParametersLength_descr_.raw->forceomit); decoded_field_length = field_xID__ParametersLength.RAW_decode(PS__HandoverXIDParameters_xID__ParametersLength_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, no_err, -1, TRUE, &field_4_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); INTEGER tmp4 = field_xID__ParametersLength.convert_to_Integer(PS__HandoverXIDParameters_xID__ParametersLength_descr_); field_xID__ParametersLength = tmp4; value_of_length_field4 += tmp4.get_long_long_val() * 8; value_of_length_field1 -= decoded_field_length; if (limit > 0 && value_of_length_field1 > 0 && value_of_length_field4 > 0){ if (force_omit != NULL && (*force_omit)(5)) { field_xID__Parameters = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_5_force_omit(5, force_omit, XID__Information__GTPC_descr_.raw->forceomit); decoded_field_length = field_xID__Parameters().RAW_decode(XID__Information__GTPC_descr_, p_buf, min_of_ints(3, limit, value_of_length_field1, value_of_length_field4), local_top_order, TRUE, -1, TRUE, &field_5_force_omit); if (decoded_field_length < 1) { field_xID__Parameters = 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()); value_of_length_field1 -= decoded_field_length; value_of_length_field4 -= decoded_field_length; } } } else field_xID__Parameters=OMIT_VALUE; if (field_type__gtpc != os_90) return -1; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int PS__HandoverXIDParameters::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, PS__HandoverXIDParameters_lengthf_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, General__Types::BIT4_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::BIT4_descr_.raw); myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, PS__HandoverXIDParameters_xID__ParametersLength_descr_.raw); if (field_xID__Parameters.ispresent()) { myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, XID__Information__GTPC_descr_.raw); } else myleaf.body.node.nodes[5] = NULL; encoded_length += field_type__gtpc.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += 16; myleaf.body.node.nodes[1]->calc = CALC_LENGTH; myleaf.body.node.nodes[1]->coding_descr = &PS__HandoverXIDParameters_lengthf_descr_; myleaf.body.node.nodes[1]->calcof.lengthto.num_of_fields = 4; myleaf.body.node.nodes[1]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[1]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields = init_lengthto_fields_list(4); myleaf.body.node.nodes[1]->length = 16; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[2]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[2]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].level = myleaf.body.node.nodes[3]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].pos = myleaf.body.node.nodes[3]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].level = myleaf.body.node.nodes[4]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].pos = myleaf.body.node.nodes[4]->curr_pos.pos; if (field_xID__Parameters.ispresent()) { myleaf.body.node.nodes[1]->calcof.lengthto.fields[3].level = myleaf.body.node.nodes[5]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[3].pos = myleaf.body.node.nodes[5]->curr_pos.pos; } else { myleaf.body.node.nodes[1]->calcof.lengthto.fields[3].level = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields[3].pos = 0; } encoded_length += field_sapi.RAW_encode(General__Types::BIT4_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_spare.RAW_encode(General__Types::BIT4_descr_, *myleaf.body.node.nodes[3]); encoded_length += 8; myleaf.body.node.nodes[4]->calc = CALC_LENGTH; myleaf.body.node.nodes[4]->coding_descr = &PS__HandoverXIDParameters_xID__ParametersLength_descr_; myleaf.body.node.nodes[4]->calcof.lengthto.num_of_fields = 1; myleaf.body.node.nodes[4]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[4]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[4]->calcof.lengthto.fields = init_lengthto_fields_list(1); myleaf.body.node.nodes[4]->length = 8; if (field_xID__Parameters.ispresent()) { myleaf.body.node.nodes[4]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[5]->curr_pos.level; myleaf.body.node.nodes[4]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[5]->curr_pos.pos; } else { myleaf.body.node.nodes[4]->calcof.lengthto.fields[0].level = 0; myleaf.body.node.nodes[4]->calcof.lengthto.fields[0].pos = 0; } if (field_xID__Parameters.ispresent()) { encoded_length += field_xID__Parameters().RAW_encode(XID__Information__GTPC_descr_, *myleaf.body.node.nodes[5]); } if (field_type__gtpc != os_90) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={0}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ os_90.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 PS__HandoverXIDParameters_template::single_value_struct { OCTETSTRING_template field_type__gtpc; INTEGER_template field_lengthf; BITSTRING_template field_sapi; BITSTRING_template field_spare; INTEGER_template field_xID__ParametersLength; XID__Information__GTPC_template field_xID__Parameters; }; void PS__HandoverXIDParameters_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_type__gtpc = ANY_VALUE; single_value->field_lengthf = ANY_VALUE; single_value->field_sapi = ANY_VALUE; single_value->field_spare = ANY_VALUE; single_value->field_xID__ParametersLength = ANY_VALUE; single_value->field_xID__Parameters = ANY_OR_OMIT; } } } void PS__HandoverXIDParameters_template::copy_value(const PS__HandoverXIDParameters& other_value) { single_value = new single_value_struct; if (other_value.type__gtpc().is_bound()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (other_value.lengthf().is_bound()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (other_value.sapi().is_bound()) { single_value->field_sapi = other_value.sapi(); } else { single_value->field_sapi.clean_up(); } if (other_value.spare().is_bound()) { single_value->field_spare = other_value.spare(); } else { single_value->field_spare.clean_up(); } if (other_value.xID__ParametersLength().is_bound()) { single_value->field_xID__ParametersLength = other_value.xID__ParametersLength(); } else { single_value->field_xID__ParametersLength.clean_up(); } if (other_value.xID__Parameters().is_bound()) { if (other_value.xID__Parameters().ispresent()) single_value->field_xID__Parameters = other_value.xID__Parameters()(); else single_value->field_xID__Parameters = OMIT_VALUE; } else { single_value->field_xID__Parameters.clean_up(); } set_selection(SPECIFIC_VALUE); } void PS__HandoverXIDParameters_template::copy_template(const PS__HandoverXIDParameters_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.type__gtpc().get_selection()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lengthf().get_selection()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.sapi().get_selection()) { single_value->field_sapi = other_value.sapi(); } else { single_value->field_sapi.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.spare().get_selection()) { single_value->field_spare = other_value.spare(); } else { single_value->field_spare.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.xID__ParametersLength().get_selection()) { single_value->field_xID__ParametersLength = other_value.xID__ParametersLength(); } else { single_value->field_xID__ParametersLength.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.xID__Parameters().get_selection()) { single_value->field_xID__Parameters = other_value.xID__Parameters(); } else { single_value->field_xID__Parameters.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 PS__HandoverXIDParameters_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 PS__HandoverXIDParameters_template(*other_value.implication_.precondition); implication_.implied_template = new PS__HandoverXIDParameters_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 @GTPC_Types.PS_HandoverXIDParameters."); break; } set_selection(other_value); } PS__HandoverXIDParameters_template::PS__HandoverXIDParameters_template() { } PS__HandoverXIDParameters_template::PS__HandoverXIDParameters_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } PS__HandoverXIDParameters_template::PS__HandoverXIDParameters_template(const PS__HandoverXIDParameters& other_value) { copy_value(other_value); } PS__HandoverXIDParameters_template::PS__HandoverXIDParameters_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PS__HandoverXIDParameters&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.PS_HandoverXIDParameters from an unbound optional field."); } } PS__HandoverXIDParameters_template::PS__HandoverXIDParameters_template(PS__HandoverXIDParameters_template* p_precondition, PS__HandoverXIDParameters_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } PS__HandoverXIDParameters_template::PS__HandoverXIDParameters_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; } PS__HandoverXIDParameters_template::PS__HandoverXIDParameters_template(const PS__HandoverXIDParameters_template& other_value) : Base_Template() { copy_template(other_value); } PS__HandoverXIDParameters_template::~PS__HandoverXIDParameters_template() { clean_up(); } PS__HandoverXIDParameters_template& PS__HandoverXIDParameters_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } PS__HandoverXIDParameters_template& PS__HandoverXIDParameters_template::operator=(const PS__HandoverXIDParameters& other_value) { clean_up(); copy_value(other_value); return *this; } PS__HandoverXIDParameters_template& PS__HandoverXIDParameters_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PS__HandoverXIDParameters&)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 @GTPC_Types.PS_HandoverXIDParameters."); } return *this; } PS__HandoverXIDParameters_template& PS__HandoverXIDParameters_template::operator=(const PS__HandoverXIDParameters_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean PS__HandoverXIDParameters_template::match(const PS__HandoverXIDParameters& 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.type__gtpc().is_bound()) return FALSE; if(!single_value->field_type__gtpc.match(other_value.type__gtpc(), legacy))return FALSE; if(!other_value.lengthf().is_bound()) return FALSE; if(!single_value->field_lengthf.match(other_value.lengthf(), legacy))return FALSE; if(!other_value.sapi().is_bound()) return FALSE; if(!single_value->field_sapi.match(other_value.sapi(), legacy))return FALSE; if(!other_value.spare().is_bound()) return FALSE; if(!single_value->field_spare.match(other_value.spare(), legacy))return FALSE; if(!other_value.xID__ParametersLength().is_bound()) return FALSE; if(!single_value->field_xID__ParametersLength.match(other_value.xID__ParametersLength(), legacy))return FALSE; if(!other_value.xID__Parameters().is_bound()) return FALSE; if((other_value.xID__Parameters().ispresent() ? !single_value->field_xID__Parameters.match((const XID__Information__GTPC&)other_value.xID__Parameters(), legacy) : !single_value->field_xID__Parameters.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 @GTPC_Types.PS_HandoverXIDParameters."); } return FALSE; } boolean PS__HandoverXIDParameters_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_type__gtpc.is_bound() || single_value->field_lengthf.is_bound() || single_value->field_sapi.is_bound() || single_value->field_spare.is_bound() || single_value->field_xID__ParametersLength.is_bound() || (single_value->field_xID__Parameters.is_omit() || single_value->field_xID__Parameters.is_bound()); } boolean PS__HandoverXIDParameters_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_type__gtpc.is_value() && single_value->field_lengthf.is_value() && single_value->field_sapi.is_value() && single_value->field_spare.is_value() && single_value->field_xID__ParametersLength.is_value() && (single_value->field_xID__Parameters.is_omit() || single_value->field_xID__Parameters.is_value()); } void PS__HandoverXIDParameters_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; } PS__HandoverXIDParameters PS__HandoverXIDParameters_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 @GTPC_Types.PS_HandoverXIDParameters."); PS__HandoverXIDParameters ret_val; if (single_value->field_type__gtpc.is_bound()) { ret_val.type__gtpc() = single_value->field_type__gtpc.valueof(); } if (single_value->field_lengthf.is_bound()) { ret_val.lengthf() = single_value->field_lengthf.valueof(); } if (single_value->field_sapi.is_bound()) { ret_val.sapi() = single_value->field_sapi.valueof(); } if (single_value->field_spare.is_bound()) { ret_val.spare() = single_value->field_spare.valueof(); } if (single_value->field_xID__ParametersLength.is_bound()) { ret_val.xID__ParametersLength() = single_value->field_xID__ParametersLength.valueof(); } if (single_value->field_xID__Parameters.is_omit()) ret_val.xID__Parameters() = OMIT_VALUE; else if (single_value->field_xID__Parameters.is_bound()) { ret_val.xID__Parameters() = single_value->field_xID__Parameters.valueof(); } return ret_val; } void PS__HandoverXIDParameters_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 @GTPC_Types.PS_HandoverXIDParameters."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new PS__HandoverXIDParameters_template[list_length]; } PS__HandoverXIDParameters_template& PS__HandoverXIDParameters_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 @GTPC_Types.PS_HandoverXIDParameters."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.PS_HandoverXIDParameters."); return value_list.list_value[list_index]; } OCTETSTRING_template& PS__HandoverXIDParameters_template::type__gtpc() { set_specific(); return single_value->field_type__gtpc; } const OCTETSTRING_template& PS__HandoverXIDParameters_template::type__gtpc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field type_gtpc of a non-specific template of type @GTPC_Types.PS_HandoverXIDParameters."); return single_value->field_type__gtpc; } INTEGER_template& PS__HandoverXIDParameters_template::lengthf() { set_specific(); return single_value->field_lengthf; } const INTEGER_template& PS__HandoverXIDParameters_template::lengthf() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthf of a non-specific template of type @GTPC_Types.PS_HandoverXIDParameters."); return single_value->field_lengthf; } BITSTRING_template& PS__HandoverXIDParameters_template::sapi() { set_specific(); return single_value->field_sapi; } const BITSTRING_template& PS__HandoverXIDParameters_template::sapi() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field sapi of a non-specific template of type @GTPC_Types.PS_HandoverXIDParameters."); return single_value->field_sapi; } BITSTRING_template& PS__HandoverXIDParameters_template::spare() { set_specific(); return single_value->field_spare; } const BITSTRING_template& PS__HandoverXIDParameters_template::spare() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field spare of a non-specific template of type @GTPC_Types.PS_HandoverXIDParameters."); return single_value->field_spare; } INTEGER_template& PS__HandoverXIDParameters_template::xID__ParametersLength() { set_specific(); return single_value->field_xID__ParametersLength; } const INTEGER_template& PS__HandoverXIDParameters_template::xID__ParametersLength() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field xID_ParametersLength of a non-specific template of type @GTPC_Types.PS_HandoverXIDParameters."); return single_value->field_xID__ParametersLength; } XID__Information__GTPC_template& PS__HandoverXIDParameters_template::xID__Parameters() { set_specific(); return single_value->field_xID__Parameters; } const XID__Information__GTPC_template& PS__HandoverXIDParameters_template::xID__Parameters() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field xID_Parameters of a non-specific template of type @GTPC_Types.PS_HandoverXIDParameters."); return single_value->field_xID__Parameters; } int PS__HandoverXIDParameters_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.PS_HandoverXIDParameters which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 5; if (single_value->field_xID__Parameters.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 @GTPC_Types.PS_HandoverXIDParameters 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 @GTPC_Types.PS_HandoverXIDParameters containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.PS_HandoverXIDParameters containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.PS_HandoverXIDParameters containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.PS_HandoverXIDParameters containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.PS_HandoverXIDParameters containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.PS_HandoverXIDParameters containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.PS_HandoverXIDParameters containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.PS_HandoverXIDParameters."); } return 0; } void PS__HandoverXIDParameters_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ type_gtpc := "); single_value->field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log(); TTCN_Logger::log_event_str(", sapi := "); single_value->field_sapi.log(); TTCN_Logger::log_event_str(", spare := "); single_value->field_spare.log(); TTCN_Logger::log_event_str(", xID_ParametersLength := "); single_value->field_xID__ParametersLength.log(); TTCN_Logger::log_event_str(", xID_Parameters := "); single_value->field_xID__Parameters.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 PS__HandoverXIDParameters_template::log_match(const PS__HandoverXIDParameters& 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_type__gtpc.match(match_value.type__gtpc(), legacy)){ TTCN_Logger::log_logmatch_info(".type_gtpc"); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lengthf.match(match_value.lengthf(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthf"); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_sapi.match(match_value.sapi(), legacy)){ TTCN_Logger::log_logmatch_info(".sapi"); single_value->field_sapi.log_match(match_value.sapi(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_spare.match(match_value.spare(), legacy)){ TTCN_Logger::log_logmatch_info(".spare"); single_value->field_spare.log_match(match_value.spare(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_xID__ParametersLength.match(match_value.xID__ParametersLength(), legacy)){ TTCN_Logger::log_logmatch_info(".xID_ParametersLength"); single_value->field_xID__ParametersLength.log_match(match_value.xID__ParametersLength(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.xID__Parameters().ispresent()){ if(!single_value->field_xID__Parameters.match(match_value.xID__Parameters(), legacy)){ TTCN_Logger::log_logmatch_info(".xID_Parameters"); single_value->field_xID__Parameters.log_match(match_value.xID__Parameters(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_xID__Parameters.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".xID_Parameters := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_xID__Parameters.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("{ type_gtpc := "); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::log_event_str(", sapi := "); single_value->field_sapi.log_match(match_value.sapi(), legacy); TTCN_Logger::log_event_str(", spare := "); single_value->field_spare.log_match(match_value.spare(), legacy); TTCN_Logger::log_event_str(", xID_ParametersLength := "); single_value->field_xID__ParametersLength.log_match(match_value.xID__ParametersLength(), legacy); TTCN_Logger::log_event_str(", xID_Parameters := "); if (match_value.xID__Parameters().ispresent()) { single_value->field_xID__Parameters.log_match(match_value.xID__Parameters(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_xID__Parameters.log(); if (single_value->field_xID__Parameters.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 PS__HandoverXIDParameters_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_type__gtpc.encode_text(text_buf); single_value->field_lengthf.encode_text(text_buf); single_value->field_sapi.encode_text(text_buf); single_value->field_spare.encode_text(text_buf); single_value->field_xID__ParametersLength.encode_text(text_buf); single_value->field_xID__Parameters.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 @GTPC_Types.PS_HandoverXIDParameters."); } } void PS__HandoverXIDParameters_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_type__gtpc.decode_text(text_buf); single_value->field_lengthf.decode_text(text_buf); single_value->field_sapi.decode_text(text_buf); single_value->field_spare.decode_text(text_buf); single_value->field_xID__ParametersLength.decode_text(text_buf); single_value->field_xID__Parameters.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 PS__HandoverXIDParameters_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 @GTPC_Types.PS_HandoverXIDParameters."); } } void PS__HandoverXIDParameters_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: { PS__HandoverXIDParameters_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) sapi().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) xID__ParametersLength().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) xID__Parameters().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "sapi")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { sapi().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "spare")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "xID_ParametersLength")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { xID__ParametersLength().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "xID_Parameters")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { xID__Parameters().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.PS_HandoverXIDParameters: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { PS__HandoverXIDParameters_template* precondition = new PS__HandoverXIDParameters_template; precondition->set_param(*param.get_elem(0)); PS__HandoverXIDParameters_template* implied_template = new PS__HandoverXIDParameters_template; implied_template->set_param(*param.get_elem(1)); *this = PS__HandoverXIDParameters_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.PS_HandoverXIDParameters"); } is_ifpresent = param.get_ifpresent(); } void PS__HandoverXIDParameters_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_type__gtpc.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.PS_HandoverXIDParameters"); single_value->field_lengthf.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.PS_HandoverXIDParameters"); single_value->field_sapi.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.PS_HandoverXIDParameters"); single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.PS_HandoverXIDParameters"); single_value->field_xID__ParametersLength.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.PS_HandoverXIDParameters"); single_value->field_xID__Parameters.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.PS_HandoverXIDParameters"); 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 : "@GTPC_Types.PS_HandoverXIDParameters"); } boolean PS__HandoverXIDParameters_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean PS__HandoverXIDParameters_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; } XID__Information__GTPC::XID__Information__GTPC(const XID__Information__GTPC& other_value) { if (!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GTPC_Types.XID_Information_GTPC."); val_ptr = other_value.val_ptr; val_ptr->ref_count++; } XID__Information__GTPC::~XID__Information__GTPC() { clean_up(); if (val_ptr != NULL) val_ptr = NULL; } void XID__Information__GTPC::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."); } } XID__Information__GTPC& XID__Information__GTPC::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; } XID__Information__GTPC& XID__Information__GTPC::operator=(const XID__Information__GTPC& other_value) { if (other_value.val_ptr == NULL) TTCN_error("Assigning an unbound value of type @GTPC_Types.XID_Information_GTPC."); if (this != &other_value) { clean_up(); val_ptr = other_value.val_ptr; val_ptr->ref_count++; } return *this; } boolean XID__Information__GTPC::operator==(null_type) const { if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @GTPC_Types.XID_Information_GTPC."); return val_ptr->n_elements == 0 ; } boolean XID__Information__GTPC::operator==(const XID__Information__GTPC& other_value) const { if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @GTPC_Types.XID_Information_GTPC."); if (other_value.val_ptr == NULL) TTCN_error("The right operand of comparison is an unbound value of type @GTPC_Types.XID_Information_GTPC."); 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; } XID__GTPC& XID__Information__GTPC::operator[](int index_value) { if (index_value < 0) TTCN_error("Accessing an element of type @GTPC_Types.XID_Information_GTPC 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 = (XID__GTPC**)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 XID__GTPC(*(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 XID__GTPC; } return *val_ptr->value_elements[index_value]; } XID__GTPC& XID__Information__GTPC::operator[](const INTEGER& index_value) { index_value.must_bound("Using an unbound integer value for indexing a value of type @GTPC_Types.XID_Information_GTPC."); return (*this)[(int)index_value]; } const XID__GTPC& XID__Information__GTPC::operator[](int index_value) const { if (val_ptr == NULL) TTCN_error("Accessing an element in an unbound value of type @GTPC_Types.XID_Information_GTPC."); if (index_value < 0) TTCN_error("Accessing an element of type @GTPC_Types.XID_Information_GTPC using a negative index: %d.", index_value); if (index_value >= val_ptr->n_elements) TTCN_error("Index overflow in a value of type @GTPC_Types.XID_Information_GTPC: 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 XID__GTPC& XID__Information__GTPC::operator[](const INTEGER& index_value) const { index_value.must_bound("Using an unbound integer value for indexing a value of type @GTPC_Types.XID_Information_GTPC."); return (*this)[(int)index_value]; } XID__Information__GTPC XID__Information__GTPC::operator<<=(int rotate_count) const { return *this >>= (-rotate_count); } XID__Information__GTPC XID__Information__GTPC::operator<<=(const INTEGER& rotate_count) const { rotate_count.must_bound("Unbound integer operand of rotate left operator."); return *this >>= (int)(-rotate_count); } XID__Information__GTPC XID__Information__GTPC::operator>>=(const INTEGER& rotate_count) const { rotate_count.must_bound("Unbound integer operand of rotate right operator."); return *this >>= (int)rotate_count; } XID__Information__GTPC XID__Information__GTPC::operator>>=(int rotate_count) const { if (val_ptr == NULL) TTCN_error("Performing rotation operation on an unbound value of type @GTPC_Types.XID_Information_GTPC."); 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; XID__Information__GTPC 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 XID__GTPC(*val_ptr->value_elements[i]); } } return ret_val; } XID__Information__GTPC XID__Information__GTPC::operator+(const XID__Information__GTPC& other_value) const { if (val_ptr == NULL || other_value.val_ptr == NULL) TTCN_error("Unbound operand of @GTPC_Types.XID_Information_GTPC concatenation."); if (val_ptr->n_elements == 0) return other_value; if (other_value.val_ptr->n_elements == 0) return *this; XID__Information__GTPC 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 XID__GTPC(*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 XID__GTPC(*other_value.val_ptr->value_elements[i]); } } return ret_val; } XID__Information__GTPC XID__Information__GTPC::substr(int index, int returncount) const { if (val_ptr == NULL) TTCN_error("The first argument of substr() is an unbound value of type @GTPC_Types.XID_Information_GTPC."); check_substr_arguments(val_ptr->n_elements, index, returncount, "@GTPC_Types.XID_Information_GTPC","element"); XID__Information__GTPC ret_val; ret_val.set_size(returncount); for (int i=0; ivalue_elements[i+index] != NULL) { ret_val.val_ptr->value_elements[i] = new XID__GTPC(*val_ptr->value_elements[i+index]); } } return ret_val; } XID__Information__GTPC XID__Information__GTPC::replace(int index, int len, const XID__Information__GTPC& repl) const { if (val_ptr == NULL) TTCN_error("The first argument of replace() is an unbound value of type @GTPC_Types.XID_Information_GTPC."); if (repl.val_ptr == NULL) TTCN_error("The fourth argument of replace() is an unbound value of type @GTPC_Types.XID_Information_GTPC."); check_replace_arguments(val_ptr->n_elements, index, len, "@GTPC_Types.XID_Information_GTPC","element"); XID__Information__GTPC 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 XID__GTPC(*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 XID__GTPC(*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 XID__GTPC(*val_ptr->value_elements[index+i+len]); } } return ret_val; } XID__Information__GTPC XID__Information__GTPC::replace(int index, int len, const XID__Information__GTPC_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 XID__Information__GTPC::set_size(int new_size) { if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a value of type @GTPC_Types.XID_Information_GTPC."); 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 = (XID__GTPC**)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 XID__GTPC(*(val_ptr->value_elements[elem_count])); } } clean_up(); val_ptr = new_val_ptr; } if (new_size > val_ptr->n_elements) { val_ptr->value_elements = (XID__GTPC**)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 @GTPC_Types.XID_Information_GTPC: %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 = (XID__GTPC**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size); val_ptr->n_elements = new_size; } } boolean XID__Information__GTPC::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 XID__Information__GTPC::size_of() const { if (val_ptr == NULL) TTCN_error("Performing sizeof operation on an unbound value of type @GTPC_Types.XID_Information_GTPC."); return val_ptr->n_elements; } int XID__Information__GTPC::lengthof() const { if (val_ptr == NULL) TTCN_error("Performing lengthof operation on an unbound value of type @GTPC_Types.XID_Information_GTPC."); 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 XID__Information__GTPC::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 XID__Information__GTPC::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 XID__Information__GTPC::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", "@GTPC_Types.XID_Information_GTPC"); } 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", "@GTPC_Types.XID_Information_GTPC"); } break; default: TTCN_error("Internal error: Unknown operation type."); } } void XID__Information__GTPC::encode_text(Text_Buf& text_buf) const { if (val_ptr == NULL) TTCN_error("Text encoder: Encoding an unbound value of type @GTPC_Types.XID_Information_GTPC."); 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 XID__Information__GTPC::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 @GTPC_Types.XID_Information_GTPC."); val_ptr->value_elements = (XID__GTPC**)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 XID__GTPC; val_ptr->value_elements[elem_count]->decode_text(text_buf); } } void XID__Information__GTPC::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 XID__Information__GTPC::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 XID__Information__GTPC::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 XID__Information__GTPC::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 XID__Information__GTPC_template::copy_value(const XID__Information__GTPC& other_value) { if (!other_value.is_bound()) TTCN_error("Initialization of a template of type @GTPC_Types.XID_Information_GTPC with an unbound value."); single_value.n_elements = other_value.size_of(); single_value.value_elements = (XID__GTPC_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 XID__GTPC_template(other_value[elem_count]); } else { single_value.value_elements[elem_count] = new XID__GTPC_template; } } set_selection(SPECIFIC_VALUE); } void XID__Information__GTPC_template::copy_template(const XID__Information__GTPC_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 = (XID__GTPC_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 XID__GTPC_template(*other_value.single_value.value_elements[elem_count]); } else { single_value.value_elements[elem_count] = new XID__GTPC_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 XID__Information__GTPC_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 XID__Information__GTPC_template(*other_value.implication_.precondition); implication_.implied_template = new XID__Information__GTPC_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 @GTPC_Types.XID_Information_GTPC."); break; } set_selection(other_value); } boolean XID__Information__GTPC_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 XID__Information__GTPC_template*)template_ptr)->single_value.value_elements[template_index]->match((*(const XID__Information__GTPC*)value_ptr)[value_index], legacy); else return ((const XID__Information__GTPC_template*)template_ptr)->single_value.value_elements[template_index]->is_any_or_omit(); } XID__Information__GTPC_template::XID__Information__GTPC_template() { } XID__Information__GTPC_template::XID__Information__GTPC_template(template_sel other_value) : Base_Record_Of_Template(other_value) { check_single_selection(other_value); } XID__Information__GTPC_template::XID__Information__GTPC_template(null_type) : Base_Record_Of_Template(SPECIFIC_VALUE) { single_value.n_elements = 0; single_value.value_elements = NULL; } XID__Information__GTPC_template::XID__Information__GTPC_template(const XID__Information__GTPC& other_value) { copy_value(other_value); } XID__Information__GTPC_template::XID__Information__GTPC_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const XID__Information__GTPC&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.XID_Information_GTPC from an unbound optional field."); } } XID__Information__GTPC_template::XID__Information__GTPC_template(XID__Information__GTPC_template* p_precondition, XID__Information__GTPC_template* p_implied_template) : Base_Record_Of_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } XID__Information__GTPC_template::XID__Information__GTPC_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; } XID__Information__GTPC_template::XID__Information__GTPC_template(const XID__Information__GTPC_template& other_value) : Base_Record_Of_Template() { copy_template(other_value); } XID__Information__GTPC_template::~XID__Information__GTPC_template() { clean_up(); } void XID__Information__GTPC_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; } XID__Information__GTPC_template& XID__Information__GTPC_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } XID__Information__GTPC_template& XID__Information__GTPC_template::operator=(null_type) { clean_up(); set_selection(SPECIFIC_VALUE); single_value.n_elements = 0; single_value.value_elements = NULL; return *this; } XID__Information__GTPC_template& XID__Information__GTPC_template::operator=(const XID__Information__GTPC& other_value) { clean_up(); copy_value(other_value); return *this; } XID__Information__GTPC_template& XID__Information__GTPC_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const XID__Information__GTPC&)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 @GTPC_Types.XID_Information_GTPC."); } return *this; } XID__Information__GTPC_template& XID__Information__GTPC_template::operator=(const XID__Information__GTPC_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } XID__GTPC_template& XID__Information__GTPC_template::operator[](int index_value) { if (index_value < 0) TTCN_error("Accessing an element of a template for type @GTPC_Types.XID_Information_GTPC 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 @GTPC_Types.XID_Information_GTPC."); break; } return *single_value.value_elements[index_value]; } XID__GTPC_template& XID__Information__GTPC_template::operator[](const INTEGER& index_value) { index_value.must_bound("Using an unbound integer value for indexing a template of type @GTPC_Types.XID_Information_GTPC."); return (*this)[(int)index_value]; } const XID__GTPC_template& XID__Information__GTPC_template::operator[](int index_value) const { if (index_value < 0) TTCN_error("Accessing an element of a template for type @GTPC_Types.XID_Information_GTPC using a negative index: %d.", index_value); if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing an element of a non-specific template for type @GTPC_Types.XID_Information_GTPC."); if (index_value >= single_value.n_elements) TTCN_error("Index overflow in a template of type @GTPC_Types.XID_Information_GTPC: 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 XID__GTPC_template& XID__Information__GTPC_template::operator[](const INTEGER& index_value) const { index_value.must_bound("Using an unbound integer value for indexing a template of type @GTPC_Types.XID_Information_GTPC."); return (*this)[(int)index_value]; } void XID__Information__GTPC_template::set_size(int new_size) { if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a template of type @GTPC_Types.XID_Information_GTPC."); 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 = (XID__GTPC_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 XID__GTPC_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 XID__GTPC_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 = (XID__GTPC_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size); single_value.n_elements = new_size; } } int XID__Information__GTPC_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 XID__Information__GTPC_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 @GTPC_Types.XID_Information_GTPC 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 @GTPC_Types.XID_Information_GTPC 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 @GTPC_Types.XID_Information_GTPC 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 @GTPC_Types.XID_Information_GTPC 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 @GTPC_Types.XID_Information_GTPC 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 @GTPC_Types.XID_Information_GTPC containing complemented list.", op_name); default: TTCN_error("Performing %sof() operation on an uninitialized/unsupported template of type @GTPC_Types.XID_Information_GTPC.", op_name); } return check_section_is_single(min_size, has_any_or_none, op_name, "a", "template of type @GTPC_Types.XID_Information_GTPC"); } boolean XID__Information__GTPC_template::match(const XID__Information__GTPC& 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 @GTPC_Types.XID_Information_GTPC."); } return FALSE; } boolean XID__Information__GTPC_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; } XID__Information__GTPC XID__Information__GTPC_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 @GTPC_Types.XID_Information_GTPC."); XID__Information__GTPC 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; } XID__Information__GTPC XID__Information__GTPC_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); } XID__Information__GTPC XID__Information__GTPC_template::replace(int index, int len, const XID__Information__GTPC_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()); } XID__Information__GTPC XID__Information__GTPC_template::replace(int index, int len, const XID__Information__GTPC& 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 XID__Information__GTPC_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 XID__Information__GTPC_template[list_length]; break; default: TTCN_error("Internal error: Setting an invalid type for a template of type @GTPC_Types.XID_Information_GTPC."); } set_selection(template_type); } XID__Information__GTPC_template& XID__Information__GTPC_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 @GTPC_Types.XID_Information_GTPC."); if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of type @GTPC_Types.XID_Information_GTPC."); return value_list.list_value[list_index]; } void XID__Information__GTPC_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 XID__Information__GTPC_template::log_match(const XID__Information__GTPC& 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 XID__Information__GTPC_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 @GTPC_Types.XID_Information_GTPC."); } } void XID__Information__GTPC_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 @GTPC_Types.XID_Information_GTPC."); single_value.value_elements = (XID__GTPC_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 XID__GTPC_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 XID__Information__GTPC_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 @GTPC_Types.XID_Information_GTPC."); } } boolean XID__Information__GTPC_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean XID__Information__GTPC_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: { XID__Information__GTPC_template* precondition = new XID__Information__GTPC_template; precondition->set_param(*param.get_elem(0)); XID__Information__GTPC_template* implied_template = new XID__Information__GTPC_template; implied_template->set_param(*param.get_elem(1)); *this = XID__Information__GTPC_template(precondition, implied_template); } break; default: param.type_error("record of template", "@GTPC_Types.XID_Information_GTPC"); } is_ifpresent = param.get_ifpresent(); set_length_range(param); } void XID__Information__GTPC_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 : "@GTPC_Types.XID_Information_GTPC"); 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 : "@GTPC_Types.XID_Information_GTPC"); } boolean XID__Information__GTPC_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); } } void XID__length__GTPC::copy_value(const XID__length__GTPC& other_value) { switch (other_value.union_selection) { case ALT_short__len: field_short__len = new INTEGER(*other_value.field_short__len); break; case ALT_long__len: field_long__len = new INTEGER(*other_value.field_long__len); break; default: TTCN_error("Assignment of an unbound union value of type @GTPC_Types.XID_length_GTPC."); } union_selection = other_value.union_selection; } XID__length__GTPC::XID__length__GTPC() { union_selection = UNBOUND_VALUE; } XID__length__GTPC::XID__length__GTPC(const XID__length__GTPC& other_value) : Base_Type(){ copy_value(other_value); } XID__length__GTPC::~XID__length__GTPC() { clean_up(); } XID__length__GTPC& XID__length__GTPC::operator=(const XID__length__GTPC& other_value) { if (this != &other_value) { clean_up(); copy_value(other_value); } return *this; } boolean XID__length__GTPC::operator==(const XID__length__GTPC& other_value) const { if (union_selection == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of union type @GTPC_Types.XID_length_GTPC."); if (other_value.union_selection == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of union type @GTPC_Types.XID_length_GTPC."); if (union_selection != other_value.union_selection) return FALSE; switch (union_selection) { case ALT_short__len: return *field_short__len == *other_value.field_short__len; case ALT_long__len: return *field_long__len == *other_value.field_long__len; default: return FALSE; } } INTEGER& XID__length__GTPC::short__len() { if (union_selection != ALT_short__len) { clean_up(); field_short__len = new INTEGER; union_selection = ALT_short__len; } return *field_short__len; } const INTEGER& XID__length__GTPC::short__len() const { if (union_selection != ALT_short__len) TTCN_error("Using non-selected field short_len in a value of union type @GTPC_Types.XID_length_GTPC."); return *field_short__len; } INTEGER& XID__length__GTPC::long__len() { if (union_selection != ALT_long__len) { clean_up(); field_long__len = new INTEGER; union_selection = ALT_long__len; } return *field_long__len; } const INTEGER& XID__length__GTPC::long__len() const { if (union_selection != ALT_long__len) TTCN_error("Using non-selected field long_len in a value of union type @GTPC_Types.XID_length_GTPC."); return *field_long__len; } boolean XID__length__GTPC::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 @GTPC_Types.XID_length_GTPC."); return union_selection == checked_selection; } boolean XID__length__GTPC::is_bound() const { return union_selection != UNBOUND_VALUE; } boolean XID__length__GTPC::is_value() const { switch (union_selection) { case UNBOUND_VALUE: return FALSE; case ALT_short__len: return field_short__len->is_value(); case ALT_long__len: return field_long__len->is_value(); default: TTCN_error("Invalid selection in union is_bound");} } void XID__length__GTPC::clean_up() { switch (union_selection) { case ALT_short__len: delete field_short__len; break; case ALT_long__len: delete field_long__len; break; default: break; } union_selection = UNBOUND_VALUE; } void XID__length__GTPC::log() const { switch (union_selection) { case ALT_short__len: TTCN_Logger::log_event_str("{ short_len := "); field_short__len->log(); TTCN_Logger::log_event_str(" }"); break; case ALT_long__len: TTCN_Logger::log_event_str("{ long_len := "); field_long__len->log(); TTCN_Logger::log_event_str(" }"); break; default: TTCN_Logger::log_event_unbound(); } } void XID__length__GTPC::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, "short_len")) { short__len().set_param(*mp_last); if (!short__len().is_bound()) clean_up(); return; } if (!strcmp(last_name, "long_len")) { long__len().set_param(*mp_last); if (!long__len().is_bound()) clean_up(); return; } mp_last->error("Field %s does not exist in type @GTPC_Types.XID_length_GTPC.", last_name); } void XID__length__GTPC::set_implicit_omit() { switch (union_selection) { case ALT_short__len: field_short__len->set_implicit_omit(); break; case ALT_long__len: field_long__len->set_implicit_omit(); break; default: break; } } void XID__length__GTPC::encode_text(Text_Buf& text_buf) const { text_buf.push_int(union_selection); switch (union_selection) { case ALT_short__len: field_short__len->encode_text(text_buf); break; case ALT_long__len: field_long__len->encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an unbound value of union type @GTPC_Types.XID_length_GTPC."); } } void XID__length__GTPC::decode_text(Text_Buf& text_buf) { switch ((union_selection_type)text_buf.pull_int().get_val()) { case ALT_short__len: short__len().decode_text(text_buf); break; case ALT_long__len: long__len().decode_text(text_buf); break; default: TTCN_error("Text decoder: Unrecognized union selector was received for type @GTPC_Types.XID_length_GTPC."); } } void XID__length__GTPC::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 XID__length__GTPC::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 XID__length__GTPC::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, XID__length__GTPC_short__len_descr_.raw->forceomit); decoded_length = short__len().RAW_decode(XID__length__GTPC_short__len_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, XID__length__GTPC_long__len_descr_.raw->forceomit); decoded_length = long__len().RAW_decode(XID__length__GTPC_long__len_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, XID__length__GTPC_short__len_descr_.raw->forceomit); decoded_length = short__len().RAW_decode(XID__length__GTPC_short__len_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, XID__length__GTPC_long__len_descr_.raw->forceomit); decoded_length = long__len().RAW_decode(XID__length__GTPC_long__len_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 XID__length__GTPC::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_short__len: myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 0, XID__length__GTPC_short__len_descr_.raw); encoded_length = field_short__len->RAW_encode(XID__length__GTPC_short__len_descr_, *myleaf.body.node.nodes[0]); myleaf.body.node.nodes[0]->coding_descr = &XID__length__GTPC_short__len_descr_; break; case ALT_long__len: myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 1, XID__length__GTPC_long__len_descr_.raw); encoded_length = field_long__len->RAW_encode(XID__length__GTPC_long__len_descr_, *myleaf.body.node.nodes[1]); myleaf.body.node.nodes[1]->coding_descr = &XID__length__GTPC_long__len_descr_; break; default: TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value."); } return encoded_length; } void XID__length__GTPC_template::copy_value(const XID__length__GTPC& other_value) { single_value.union_selection = other_value.get_selection(); switch (single_value.union_selection) { case XID__length__GTPC::ALT_short__len: single_value.field_short__len = new INTEGER_template(other_value.short__len()); break; case XID__length__GTPC::ALT_long__len: single_value.field_long__len = new INTEGER_template(other_value.long__len()); break; default: TTCN_error("Initializing a template with an unbound value of type @GTPC_Types.XID_length_GTPC."); } set_selection(SPECIFIC_VALUE); } void XID__length__GTPC_template::copy_template(const XID__length__GTPC_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 XID__length__GTPC::ALT_short__len: single_value.field_short__len = new INTEGER_template(*other_value.single_value.field_short__len); break; case XID__length__GTPC::ALT_long__len: single_value.field_long__len = new INTEGER_template(*other_value.single_value.field_long__len); break; default: TTCN_error("Internal error: Invalid union selector in a specific value when copying a template of type @GTPC_Types.XID_length_GTPC."); } 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 XID__length__GTPC_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 XID__length__GTPC_template(*other_value.implication_.precondition); implication_.implied_template = new XID__length__GTPC_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 @GTPC_Types.XID_length_GTPC."); } set_selection(other_value); } XID__length__GTPC_template::XID__length__GTPC_template() { } XID__length__GTPC_template::XID__length__GTPC_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } XID__length__GTPC_template::XID__length__GTPC_template(const XID__length__GTPC& other_value) { copy_value(other_value); } XID__length__GTPC_template::XID__length__GTPC_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const XID__length__GTPC&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of union type @GTPC_Types.XID_length_GTPC from an unbound optional field."); } } XID__length__GTPC_template::XID__length__GTPC_template(XID__length__GTPC_template* p_precondition, XID__length__GTPC_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } XID__length__GTPC_template::XID__length__GTPC_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; } XID__length__GTPC_template::XID__length__GTPC_template(const XID__length__GTPC_template& other_value) : Base_Template(){ copy_template(other_value); } XID__length__GTPC_template::~XID__length__GTPC_template() { clean_up(); } void XID__length__GTPC_template::clean_up() { switch (template_selection) { case SPECIFIC_VALUE: switch (single_value.union_selection) { case XID__length__GTPC::ALT_short__len: delete single_value.field_short__len; break; case XID__length__GTPC::ALT_long__len: delete single_value.field_long__len; 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; } XID__length__GTPC_template& XID__length__GTPC_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } XID__length__GTPC_template& XID__length__GTPC_template::operator=(const XID__length__GTPC& other_value) { clean_up(); copy_value(other_value); return *this; } XID__length__GTPC_template& XID__length__GTPC_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const XID__length__GTPC&)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 @GTPC_Types.XID_length_GTPC."); } return *this; } XID__length__GTPC_template& XID__length__GTPC_template::operator=(const XID__length__GTPC_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean XID__length__GTPC_template::match(const XID__length__GTPC& 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: { XID__length__GTPC::union_selection_type value_selection = other_value.get_selection(); if (value_selection == XID__length__GTPC::UNBOUND_VALUE) return FALSE; if (value_selection != single_value.union_selection) return FALSE; switch (value_selection) { case XID__length__GTPC::ALT_short__len: return single_value.field_short__len->match(other_value.short__len(), legacy); case XID__length__GTPC::ALT_long__len: return single_value.field_long__len->match(other_value.long__len(), legacy); default: TTCN_error("Internal error: Invalid selector in a specific value when matching a template of union type @GTPC_Types.XID_length_GTPC."); } } 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 @GTPC_Types.XID_length_GTPC."); } return FALSE; } boolean XID__length__GTPC_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; switch (single_value.union_selection) { case XID__length__GTPC::ALT_short__len: return single_value.field_short__len->is_value(); case XID__length__GTPC::ALT_long__len: return single_value.field_long__len->is_value(); default: TTCN_error("Internal error: Invalid selector in a specific value when performing is_value operation on a template of union type @GTPC_Types.XID_length_GTPC."); } } XID__length__GTPC XID__length__GTPC_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 @GTPC_Types.XID_length_GTPC."); XID__length__GTPC ret_val; switch (single_value.union_selection) { case XID__length__GTPC::ALT_short__len: ret_val.short__len() = single_value.field_short__len->valueof(); break; case XID__length__GTPC::ALT_long__len: ret_val.long__len() = single_value.field_long__len->valueof(); break; default: TTCN_error("Internal error: Invalid selector in a specific value when performing valueof operation on a template of union type @GTPC_Types.XID_length_GTPC."); } return ret_val; } XID__length__GTPC_template& XID__length__GTPC_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 @GTPC_Types.XID_length_GTPC."); if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of union type @GTPC_Types.XID_length_GTPC."); return value_list.list_value[list_index]; } void XID__length__GTPC_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 @GTPC_Types.XID_length_GTPC."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new XID__length__GTPC_template[list_length]; } INTEGER_template& XID__length__GTPC_template::short__len() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != XID__length__GTPC::ALT_short__len) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_short__len = new INTEGER_template(ANY_VALUE); else single_value.field_short__len = new INTEGER_template; single_value.union_selection = XID__length__GTPC::ALT_short__len; set_selection(SPECIFIC_VALUE); } return *single_value.field_short__len; } const INTEGER_template& XID__length__GTPC_template::short__len() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field short_len in a non-specific template of union type @GTPC_Types.XID_length_GTPC."); if (single_value.union_selection != XID__length__GTPC::ALT_short__len) TTCN_error("Accessing non-selected field short_len in a template of union type @GTPC_Types.XID_length_GTPC."); return *single_value.field_short__len; } INTEGER_template& XID__length__GTPC_template::long__len() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != XID__length__GTPC::ALT_long__len) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_long__len = new INTEGER_template(ANY_VALUE); else single_value.field_long__len = new INTEGER_template; single_value.union_selection = XID__length__GTPC::ALT_long__len; set_selection(SPECIFIC_VALUE); } return *single_value.field_long__len; } const INTEGER_template& XID__length__GTPC_template::long__len() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field long_len in a non-specific template of union type @GTPC_Types.XID_length_GTPC."); if (single_value.union_selection != XID__length__GTPC::ALT_long__len) TTCN_error("Accessing non-selected field long_len in a template of union type @GTPC_Types.XID_length_GTPC."); return *single_value.field_long__len; } boolean XID__length__GTPC_template::ischosen(XID__length__GTPC::union_selection_type checked_selection) const { if (checked_selection == XID__length__GTPC::UNBOUND_VALUE) TTCN_error("Internal error: Performing ischosen() operation on an invalid field of union type @GTPC_Types.XID_length_GTPC."); switch (template_selection) { case SPECIFIC_VALUE: if (single_value.union_selection == XID__length__GTPC::UNBOUND_VALUE) TTCN_error("Internal error: Invalid selector in a specific value when performing ischosen() operation on a template of union type @GTPC_Types.XID_length_GTPC."); 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 @GTPC_Types.XID_length_GTPC 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 XID__length__GTPC_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: switch (single_value.union_selection) { case XID__length__GTPC::ALT_short__len: TTCN_Logger::log_event_str("{ short_len := "); single_value.field_short__len->log(); TTCN_Logger::log_event_str(" }"); break; case XID__length__GTPC::ALT_long__len: TTCN_Logger::log_event_str("{ long_len := "); single_value.field_long__len->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 XID__length__GTPC_template::log_match(const XID__length__GTPC& 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 XID__length__GTPC::ALT_short__len: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".short_len"); single_value.field_short__len->log_match(match_value.short__len(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ short_len := "); single_value.field_short__len->log_match(match_value.short__len(), legacy); TTCN_Logger::log_event_str(" }"); } break; case XID__length__GTPC::ALT_long__len: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".long_len"); single_value.field_long__len->log_match(match_value.long__len(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ long_len := "); single_value.field_long__len->log_match(match_value.long__len(), 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 XID__length__GTPC_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 XID__length__GTPC::ALT_short__len: single_value.field_short__len->encode_text(text_buf); break; case XID__length__GTPC::ALT_long__len: single_value.field_long__len->encode_text(text_buf); break; default: TTCN_error("Internal error: Invalid selector in a specific value when encoding a template of union type @GTPC_Types.XID_length_GTPC."); } 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 @GTPC_Types.XID_length_GTPC."); } } void XID__length__GTPC_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: { single_value.union_selection = XID__length__GTPC::UNBOUND_VALUE; XID__length__GTPC::union_selection_type new_selection = (XID__length__GTPC::union_selection_type)text_buf.pull_int().get_val(); switch (new_selection) { case XID__length__GTPC::ALT_short__len: single_value.field_short__len = new INTEGER_template; single_value.field_short__len->decode_text(text_buf); break; case XID__length__GTPC::ALT_long__len: single_value.field_long__len = new INTEGER_template; single_value.field_long__len->decode_text(text_buf); break; default: TTCN_error("Text decoder: Unrecognized union selector was received for a template of type @GTPC_Types.XID_length_GTPC."); } 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 XID__length__GTPC_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 @GTPC_Types.XID_length_GTPC."); } } boolean XID__length__GTPC_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean XID__length__GTPC_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 `@GTPC_Types.XID_length_GTPC'"); } if (strcmp("short_len", param_field) == 0) { short__len().set_param(param); return; } else if (strcmp("long_len", param_field) == 0) { long__len().set_param(param); return; } else param.error("Field `%s' not found in union template type `@GTPC_Types.XID_length_GTPC'", 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: { XID__length__GTPC_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", "@GTPC_Types.XID_length_GTPC"); 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, "short_len")) { short__len().set_param(*mp_last); break; } if (!strcmp(last_name, "long_len")) { long__len().set_param(*mp_last); break; } mp_last->error("Field %s does not exist in type @GTPC_Types.XID_length_GTPC.", last_name); } break; case Module_Param::MP_Implication_Template: { XID__length__GTPC_template* precondition = new XID__length__GTPC_template; precondition->set_param(*m_p->get_elem(0)); XID__length__GTPC_template* implied_template = new XID__length__GTPC_template; implied_template->set_param(*m_p->get_elem(1)); *this = XID__length__GTPC_template(precondition, implied_template); } break; default: param.type_error("union template", "@GTPC_Types.XID_length_GTPC"); } is_ifpresent = param.get_ifpresent(); } void XID__length__GTPC_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 XID__length__GTPC::ALT_short__len: single_value.field_short__len->check_restriction(t_res, t_name ? t_name : "@GTPC_Types.XID_length_GTPC"); return; case XID__length__GTPC::ALT_long__len: single_value.field_long__len->check_restriction(t_res, t_name ? t_name : "@GTPC_Types.XID_length_GTPC"); return; default: TTCN_error("Internal error: Invalid selector in a specific value when performing check_restriction operation on a template of union type @GTPC_Types.XID_length_GTPC."); } 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 : "@GTPC_Types.XID_length_GTPC"); } void XID__Data__GTPC::copy_value(const XID__Data__GTPC& other_value) { switch (other_value.union_selection) { case ALT_version: field_version = new Version__GTPC(*other_value.field_version); break; case ALT_iOV__UI: field_iOV__UI = new OCTETSTRING(*other_value.field_iOV__UI); break; case ALT_iOV__I: field_iOV__I = new OCTETSTRING(*other_value.field_iOV__I); break; case ALT_t200: field_t200 = new T200__GTPC(*other_value.field_t200); break; case ALT_n200: field_n200 = new N200__GTPC(*other_value.field_n200); break; case ALT_n201__U: field_n201__U = new N201__U__GTPC(*other_value.field_n201__U); break; case ALT_n201__I: field_n201__I = new N201__I__GTPC(*other_value.field_n201__I); break; case ALT_mD: field_mD = new MD__GTPC(*other_value.field_mD); break; case ALT_mU: field_mU = new MU__GTPC(*other_value.field_mU); break; case ALT_kD: field_kD = new INTEGER(*other_value.field_kD); break; case ALT_kU: field_kU = new INTEGER(*other_value.field_kU); break; case ALT_l3param: field_l3param = new OCTETSTRING(*other_value.field_l3param); break; case ALT_reset: field_reset = new OCTETSTRING(*other_value.field_reset); break; default: TTCN_error("Assignment of an unbound union value of type @GTPC_Types.XID_Data_GTPC."); } union_selection = other_value.union_selection; } XID__Data__GTPC::XID__Data__GTPC() { union_selection = UNBOUND_VALUE; } XID__Data__GTPC::XID__Data__GTPC(const XID__Data__GTPC& other_value) : Base_Type(){ copy_value(other_value); } XID__Data__GTPC::~XID__Data__GTPC() { clean_up(); } XID__Data__GTPC& XID__Data__GTPC::operator=(const XID__Data__GTPC& other_value) { if (this != &other_value) { clean_up(); copy_value(other_value); } return *this; } boolean XID__Data__GTPC::operator==(const XID__Data__GTPC& other_value) const { if (union_selection == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of union type @GTPC_Types.XID_Data_GTPC."); if (other_value.union_selection == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of union type @GTPC_Types.XID_Data_GTPC."); if (union_selection != other_value.union_selection) return FALSE; switch (union_selection) { case ALT_version: return *field_version == *other_value.field_version; case ALT_iOV__UI: return *field_iOV__UI == *other_value.field_iOV__UI; case ALT_iOV__I: return *field_iOV__I == *other_value.field_iOV__I; case ALT_t200: return *field_t200 == *other_value.field_t200; case ALT_n200: return *field_n200 == *other_value.field_n200; case ALT_n201__U: return *field_n201__U == *other_value.field_n201__U; case ALT_n201__I: return *field_n201__I == *other_value.field_n201__I; case ALT_mD: return *field_mD == *other_value.field_mD; case ALT_mU: return *field_mU == *other_value.field_mU; case ALT_kD: return *field_kD == *other_value.field_kD; case ALT_kU: return *field_kU == *other_value.field_kU; case ALT_l3param: return *field_l3param == *other_value.field_l3param; case ALT_reset: return *field_reset == *other_value.field_reset; default: return FALSE; } } Version__GTPC& XID__Data__GTPC::version() { if (union_selection != ALT_version) { clean_up(); field_version = new Version__GTPC; union_selection = ALT_version; } return *field_version; } const Version__GTPC& XID__Data__GTPC::version() const { if (union_selection != ALT_version) TTCN_error("Using non-selected field version in a value of union type @GTPC_Types.XID_Data_GTPC."); return *field_version; } OCTETSTRING& XID__Data__GTPC::iOV__UI() { if (union_selection != ALT_iOV__UI) { clean_up(); field_iOV__UI = new OCTETSTRING; union_selection = ALT_iOV__UI; } return *field_iOV__UI; } const OCTETSTRING& XID__Data__GTPC::iOV__UI() const { if (union_selection != ALT_iOV__UI) TTCN_error("Using non-selected field iOV_UI in a value of union type @GTPC_Types.XID_Data_GTPC."); return *field_iOV__UI; } OCTETSTRING& XID__Data__GTPC::iOV__I() { if (union_selection != ALT_iOV__I) { clean_up(); field_iOV__I = new OCTETSTRING; union_selection = ALT_iOV__I; } return *field_iOV__I; } const OCTETSTRING& XID__Data__GTPC::iOV__I() const { if (union_selection != ALT_iOV__I) TTCN_error("Using non-selected field iOV_I in a value of union type @GTPC_Types.XID_Data_GTPC."); return *field_iOV__I; } T200__GTPC& XID__Data__GTPC::t200() { if (union_selection != ALT_t200) { clean_up(); field_t200 = new T200__GTPC; union_selection = ALT_t200; } return *field_t200; } const T200__GTPC& XID__Data__GTPC::t200() const { if (union_selection != ALT_t200) TTCN_error("Using non-selected field t200 in a value of union type @GTPC_Types.XID_Data_GTPC."); return *field_t200; } N200__GTPC& XID__Data__GTPC::n200() { if (union_selection != ALT_n200) { clean_up(); field_n200 = new N200__GTPC; union_selection = ALT_n200; } return *field_n200; } const N200__GTPC& XID__Data__GTPC::n200() const { if (union_selection != ALT_n200) TTCN_error("Using non-selected field n200 in a value of union type @GTPC_Types.XID_Data_GTPC."); return *field_n200; } N201__U__GTPC& XID__Data__GTPC::n201__U() { if (union_selection != ALT_n201__U) { clean_up(); field_n201__U = new N201__U__GTPC; union_selection = ALT_n201__U; } return *field_n201__U; } const N201__U__GTPC& XID__Data__GTPC::n201__U() const { if (union_selection != ALT_n201__U) TTCN_error("Using non-selected field n201_U in a value of union type @GTPC_Types.XID_Data_GTPC."); return *field_n201__U; } N201__I__GTPC& XID__Data__GTPC::n201__I() { if (union_selection != ALT_n201__I) { clean_up(); field_n201__I = new N201__I__GTPC; union_selection = ALT_n201__I; } return *field_n201__I; } const N201__I__GTPC& XID__Data__GTPC::n201__I() const { if (union_selection != ALT_n201__I) TTCN_error("Using non-selected field n201_I in a value of union type @GTPC_Types.XID_Data_GTPC."); return *field_n201__I; } MD__GTPC& XID__Data__GTPC::mD() { if (union_selection != ALT_mD) { clean_up(); field_mD = new MD__GTPC; union_selection = ALT_mD; } return *field_mD; } const MD__GTPC& XID__Data__GTPC::mD() const { if (union_selection != ALT_mD) TTCN_error("Using non-selected field mD in a value of union type @GTPC_Types.XID_Data_GTPC."); return *field_mD; } MU__GTPC& XID__Data__GTPC::mU() { if (union_selection != ALT_mU) { clean_up(); field_mU = new MU__GTPC; union_selection = ALT_mU; } return *field_mU; } const MU__GTPC& XID__Data__GTPC::mU() const { if (union_selection != ALT_mU) TTCN_error("Using non-selected field mU in a value of union type @GTPC_Types.XID_Data_GTPC."); return *field_mU; } INTEGER& XID__Data__GTPC::kD() { if (union_selection != ALT_kD) { clean_up(); field_kD = new INTEGER; union_selection = ALT_kD; } return *field_kD; } const INTEGER& XID__Data__GTPC::kD() const { if (union_selection != ALT_kD) TTCN_error("Using non-selected field kD in a value of union type @GTPC_Types.XID_Data_GTPC."); return *field_kD; } INTEGER& XID__Data__GTPC::kU() { if (union_selection != ALT_kU) { clean_up(); field_kU = new INTEGER; union_selection = ALT_kU; } return *field_kU; } const INTEGER& XID__Data__GTPC::kU() const { if (union_selection != ALT_kU) TTCN_error("Using non-selected field kU in a value of union type @GTPC_Types.XID_Data_GTPC."); return *field_kU; } OCTETSTRING& XID__Data__GTPC::l3param() { if (union_selection != ALT_l3param) { clean_up(); field_l3param = new OCTETSTRING; union_selection = ALT_l3param; } return *field_l3param; } const OCTETSTRING& XID__Data__GTPC::l3param() const { if (union_selection != ALT_l3param) TTCN_error("Using non-selected field l3param in a value of union type @GTPC_Types.XID_Data_GTPC."); return *field_l3param; } OCTETSTRING& XID__Data__GTPC::reset() { if (union_selection != ALT_reset) { clean_up(); field_reset = new OCTETSTRING; union_selection = ALT_reset; } return *field_reset; } const OCTETSTRING& XID__Data__GTPC::reset() const { if (union_selection != ALT_reset) TTCN_error("Using non-selected field reset in a value of union type @GTPC_Types.XID_Data_GTPC."); return *field_reset; } boolean XID__Data__GTPC::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 @GTPC_Types.XID_Data_GTPC."); return union_selection == checked_selection; } boolean XID__Data__GTPC::is_bound() const { return union_selection != UNBOUND_VALUE; } boolean XID__Data__GTPC::is_value() const { switch (union_selection) { case UNBOUND_VALUE: return FALSE; case ALT_version: return field_version->is_value(); case ALT_iOV__UI: return field_iOV__UI->is_value(); case ALT_iOV__I: return field_iOV__I->is_value(); case ALT_t200: return field_t200->is_value(); case ALT_n200: return field_n200->is_value(); case ALT_n201__U: return field_n201__U->is_value(); case ALT_n201__I: return field_n201__I->is_value(); case ALT_mD: return field_mD->is_value(); case ALT_mU: return field_mU->is_value(); case ALT_kD: return field_kD->is_value(); case ALT_kU: return field_kU->is_value(); case ALT_l3param: return field_l3param->is_value(); case ALT_reset: return field_reset->is_value(); default: TTCN_error("Invalid selection in union is_bound");} } void XID__Data__GTPC::clean_up() { switch (union_selection) { case ALT_version: delete field_version; break; case ALT_iOV__UI: delete field_iOV__UI; break; case ALT_iOV__I: delete field_iOV__I; break; case ALT_t200: delete field_t200; break; case ALT_n200: delete field_n200; break; case ALT_n201__U: delete field_n201__U; break; case ALT_n201__I: delete field_n201__I; break; case ALT_mD: delete field_mD; break; case ALT_mU: delete field_mU; break; case ALT_kD: delete field_kD; break; case ALT_kU: delete field_kU; break; case ALT_l3param: delete field_l3param; break; case ALT_reset: delete field_reset; break; default: break; } union_selection = UNBOUND_VALUE; } void XID__Data__GTPC::log() const { switch (union_selection) { case ALT_version: TTCN_Logger::log_event_str("{ version := "); field_version->log(); TTCN_Logger::log_event_str(" }"); break; case ALT_iOV__UI: TTCN_Logger::log_event_str("{ iOV_UI := "); field_iOV__UI->log(); TTCN_Logger::log_event_str(" }"); break; case ALT_iOV__I: TTCN_Logger::log_event_str("{ iOV_I := "); field_iOV__I->log(); TTCN_Logger::log_event_str(" }"); break; case ALT_t200: TTCN_Logger::log_event_str("{ t200 := "); field_t200->log(); TTCN_Logger::log_event_str(" }"); break; case ALT_n200: TTCN_Logger::log_event_str("{ n200 := "); field_n200->log(); TTCN_Logger::log_event_str(" }"); break; case ALT_n201__U: TTCN_Logger::log_event_str("{ n201_U := "); field_n201__U->log(); TTCN_Logger::log_event_str(" }"); break; case ALT_n201__I: TTCN_Logger::log_event_str("{ n201_I := "); field_n201__I->log(); TTCN_Logger::log_event_str(" }"); break; case ALT_mD: TTCN_Logger::log_event_str("{ mD := "); field_mD->log(); TTCN_Logger::log_event_str(" }"); break; case ALT_mU: TTCN_Logger::log_event_str("{ mU := "); field_mU->log(); TTCN_Logger::log_event_str(" }"); break; case ALT_kD: TTCN_Logger::log_event_str("{ kD := "); field_kD->log(); TTCN_Logger::log_event_str(" }"); break; case ALT_kU: TTCN_Logger::log_event_str("{ kU := "); field_kU->log(); TTCN_Logger::log_event_str(" }"); break; case ALT_l3param: TTCN_Logger::log_event_str("{ l3param := "); field_l3param->log(); TTCN_Logger::log_event_str(" }"); break; case ALT_reset: TTCN_Logger::log_event_str("{ reset := "); field_reset->log(); TTCN_Logger::log_event_str(" }"); break; default: TTCN_Logger::log_event_unbound(); } } void XID__Data__GTPC::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, "version")) { version().set_param(*mp_last); if (!version().is_bound()) clean_up(); return; } if (!strcmp(last_name, "iOV_UI")) { iOV__UI().set_param(*mp_last); if (!iOV__UI().is_bound()) clean_up(); return; } if (!strcmp(last_name, "iOV_I")) { iOV__I().set_param(*mp_last); if (!iOV__I().is_bound()) clean_up(); return; } if (!strcmp(last_name, "t200")) { t200().set_param(*mp_last); if (!t200().is_bound()) clean_up(); return; } if (!strcmp(last_name, "n200")) { n200().set_param(*mp_last); if (!n200().is_bound()) clean_up(); return; } if (!strcmp(last_name, "n201_U")) { n201__U().set_param(*mp_last); if (!n201__U().is_bound()) clean_up(); return; } if (!strcmp(last_name, "n201_I")) { n201__I().set_param(*mp_last); if (!n201__I().is_bound()) clean_up(); return; } if (!strcmp(last_name, "mD")) { mD().set_param(*mp_last); if (!mD().is_bound()) clean_up(); return; } if (!strcmp(last_name, "mU")) { mU().set_param(*mp_last); if (!mU().is_bound()) clean_up(); return; } if (!strcmp(last_name, "kD")) { kD().set_param(*mp_last); if (!kD().is_bound()) clean_up(); return; } if (!strcmp(last_name, "kU")) { kU().set_param(*mp_last); if (!kU().is_bound()) clean_up(); return; } if (!strcmp(last_name, "l3param")) { l3param().set_param(*mp_last); if (!l3param().is_bound()) clean_up(); return; } if (!strcmp(last_name, "reset")) { reset().set_param(*mp_last); if (!reset().is_bound()) clean_up(); return; } mp_last->error("Field %s does not exist in type @GTPC_Types.XID_Data_GTPC.", last_name); } void XID__Data__GTPC::set_implicit_omit() { switch (union_selection) { case ALT_version: field_version->set_implicit_omit(); break; case ALT_iOV__UI: field_iOV__UI->set_implicit_omit(); break; case ALT_iOV__I: field_iOV__I->set_implicit_omit(); break; case ALT_t200: field_t200->set_implicit_omit(); break; case ALT_n200: field_n200->set_implicit_omit(); break; case ALT_n201__U: field_n201__U->set_implicit_omit(); break; case ALT_n201__I: field_n201__I->set_implicit_omit(); break; case ALT_mD: field_mD->set_implicit_omit(); break; case ALT_mU: field_mU->set_implicit_omit(); break; case ALT_kD: field_kD->set_implicit_omit(); break; case ALT_kU: field_kU->set_implicit_omit(); break; case ALT_l3param: field_l3param->set_implicit_omit(); break; case ALT_reset: field_reset->set_implicit_omit(); break; default: break; } } void XID__Data__GTPC::encode_text(Text_Buf& text_buf) const { text_buf.push_int(union_selection); switch (union_selection) { case ALT_version: field_version->encode_text(text_buf); break; case ALT_iOV__UI: field_iOV__UI->encode_text(text_buf); break; case ALT_iOV__I: field_iOV__I->encode_text(text_buf); break; case ALT_t200: field_t200->encode_text(text_buf); break; case ALT_n200: field_n200->encode_text(text_buf); break; case ALT_n201__U: field_n201__U->encode_text(text_buf); break; case ALT_n201__I: field_n201__I->encode_text(text_buf); break; case ALT_mD: field_mD->encode_text(text_buf); break; case ALT_mU: field_mU->encode_text(text_buf); break; case ALT_kD: field_kD->encode_text(text_buf); break; case ALT_kU: field_kU->encode_text(text_buf); break; case ALT_l3param: field_l3param->encode_text(text_buf); break; case ALT_reset: field_reset->encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an unbound value of union type @GTPC_Types.XID_Data_GTPC."); } } void XID__Data__GTPC::decode_text(Text_Buf& text_buf) { switch ((union_selection_type)text_buf.pull_int().get_val()) { case ALT_version: version().decode_text(text_buf); break; case ALT_iOV__UI: iOV__UI().decode_text(text_buf); break; case ALT_iOV__I: iOV__I().decode_text(text_buf); break; case ALT_t200: t200().decode_text(text_buf); break; case ALT_n200: n200().decode_text(text_buf); break; case ALT_n201__U: n201__U().decode_text(text_buf); break; case ALT_n201__I: n201__I().decode_text(text_buf); break; case ALT_mD: mD().decode_text(text_buf); break; case ALT_mU: mU().decode_text(text_buf); break; case ALT_kD: kD().decode_text(text_buf); break; case ALT_kU: kU().decode_text(text_buf); break; case ALT_l3param: l3param().decode_text(text_buf); break; case ALT_reset: reset().decode_text(text_buf); break; default: TTCN_error("Text decoder: Unrecognized union selector was received for type @GTPC_Types.XID_Data_GTPC."); } } void XID__Data__GTPC::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 XID__Data__GTPC::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 XID__Data__GTPC::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, Version__GTPC_descr_.raw->forceomit); decoded_length = version().RAW_decode(Version__GTPC_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, IOV__UI__GTPC_descr_.raw->forceomit); decoded_length = iOV__UI().RAW_decode(IOV__UI__GTPC_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, IOV__I__GTPC_descr_.raw->forceomit); decoded_length = iOV__I().RAW_decode(IOV__I__GTPC_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, T200__GTPC_descr_.raw->forceomit); decoded_length = t200().RAW_decode(T200__GTPC_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, N200__GTPC_descr_.raw->forceomit); decoded_length = n200().RAW_decode(N200__GTPC_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, N201__U__GTPC_descr_.raw->forceomit); decoded_length = n201__U().RAW_decode(N201__U__GTPC_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, N201__I__GTPC_descr_.raw->forceomit); decoded_length = n201__I().RAW_decode(N201__I__GTPC_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, MD__GTPC_descr_.raw->forceomit); decoded_length = mD().RAW_decode(MD__GTPC_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, MU__GTPC_descr_.raw->forceomit); decoded_length = mU().RAW_decode(MU__GTPC_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, KD__GTPC_descr_.raw->forceomit); decoded_length = kD().RAW_decode(KD__GTPC_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, KU__GTPC_descr_.raw->forceomit); decoded_length = kU().RAW_decode(KU__GTPC_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, L3param__GTPC_descr_.raw->forceomit); decoded_length = l3param().RAW_decode(L3param__GTPC_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, Reset__LLC__GTPC_descr_.raw->forceomit); decoded_length = reset().RAW_decode(Reset__LLC__GTPC_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, Version__GTPC_descr_.raw->forceomit); decoded_length = version().RAW_decode(Version__GTPC_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, IOV__UI__GTPC_descr_.raw->forceomit); decoded_length = iOV__UI().RAW_decode(IOV__UI__GTPC_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; } p_buf.set_pos_bit(starting_pos); RAW_Force_Omit field_2_force_omit(2, force_omit, IOV__I__GTPC_descr_.raw->forceomit); decoded_length = iOV__I().RAW_decode(IOV__I__GTPC_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_2_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_3_force_omit(3, force_omit, T200__GTPC_descr_.raw->forceomit); decoded_length = t200().RAW_decode(T200__GTPC_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_3_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_4_force_omit(4, force_omit, N200__GTPC_descr_.raw->forceomit); decoded_length = n200().RAW_decode(N200__GTPC_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_4_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_5_force_omit(5, force_omit, N201__U__GTPC_descr_.raw->forceomit); decoded_length = n201__U().RAW_decode(N201__U__GTPC_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_5_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_6_force_omit(6, force_omit, N201__I__GTPC_descr_.raw->forceomit); decoded_length = n201__I().RAW_decode(N201__I__GTPC_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_6_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_7_force_omit(7, force_omit, MD__GTPC_descr_.raw->forceomit); decoded_length = mD().RAW_decode(MD__GTPC_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_7_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_8_force_omit(8, force_omit, MU__GTPC_descr_.raw->forceomit); decoded_length = mU().RAW_decode(MU__GTPC_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_8_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_9_force_omit(9, force_omit, KD__GTPC_descr_.raw->forceomit); decoded_length = kD().RAW_decode(KD__GTPC_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_9_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_10_force_omit(10, force_omit, KU__GTPC_descr_.raw->forceomit); decoded_length = kU().RAW_decode(KU__GTPC_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_10_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_11_force_omit(11, force_omit, L3param__GTPC_descr_.raw->forceomit); decoded_length = l3param().RAW_decode(L3param__GTPC_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_11_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_12_force_omit(12, force_omit, Reset__LLC__GTPC_descr_.raw->forceomit); decoded_length = reset().RAW_decode(Reset__LLC__GTPC_descr_, p_buf, limit, top_bit_ord, TRUE, -1, TRUE, &field_12_force_omit); if (decoded_length >= 0) { return decoded_length + p_buf.increase_pos_padd(p_td.raw->padding) + prepaddlength; } } clean_up(); return -1; } int XID__Data__GTPC::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const { int encoded_length = 0; myleaf.isleaf = FALSE; myleaf.body.node.num_of_nodes = 13; myleaf.body.node.nodes = init_nodes_of_enc_tree(13); memset(myleaf.body.node.nodes, 0, 13 * sizeof(RAW_enc_tree *)); switch (union_selection) { case ALT_version: myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 0, Version__GTPC_descr_.raw); encoded_length = field_version->RAW_encode(Version__GTPC_descr_, *myleaf.body.node.nodes[0]); myleaf.body.node.nodes[0]->coding_descr = &Version__GTPC_descr_; break; case ALT_iOV__UI: myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 1, IOV__UI__GTPC_descr_.raw); encoded_length = field_iOV__UI->RAW_encode(IOV__UI__GTPC_descr_, *myleaf.body.node.nodes[1]); myleaf.body.node.nodes[1]->coding_descr = &IOV__UI__GTPC_descr_; break; case ALT_iOV__I: myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 2, IOV__I__GTPC_descr_.raw); encoded_length = field_iOV__I->RAW_encode(IOV__I__GTPC_descr_, *myleaf.body.node.nodes[2]); myleaf.body.node.nodes[2]->coding_descr = &IOV__I__GTPC_descr_; break; case ALT_t200: myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 3, T200__GTPC_descr_.raw); encoded_length = field_t200->RAW_encode(T200__GTPC_descr_, *myleaf.body.node.nodes[3]); myleaf.body.node.nodes[3]->coding_descr = &T200__GTPC_descr_; break; case ALT_n200: myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 4, N200__GTPC_descr_.raw); encoded_length = field_n200->RAW_encode(N200__GTPC_descr_, *myleaf.body.node.nodes[4]); myleaf.body.node.nodes[4]->coding_descr = &N200__GTPC_descr_; break; case ALT_n201__U: myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 5, N201__U__GTPC_descr_.raw); encoded_length = field_n201__U->RAW_encode(N201__U__GTPC_descr_, *myleaf.body.node.nodes[5]); myleaf.body.node.nodes[5]->coding_descr = &N201__U__GTPC_descr_; break; case ALT_n201__I: myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 6, N201__I__GTPC_descr_.raw); encoded_length = field_n201__I->RAW_encode(N201__I__GTPC_descr_, *myleaf.body.node.nodes[6]); myleaf.body.node.nodes[6]->coding_descr = &N201__I__GTPC_descr_; break; case ALT_mD: myleaf.body.node.nodes[7] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 7, MD__GTPC_descr_.raw); encoded_length = field_mD->RAW_encode(MD__GTPC_descr_, *myleaf.body.node.nodes[7]); myleaf.body.node.nodes[7]->coding_descr = &MD__GTPC_descr_; break; case ALT_mU: myleaf.body.node.nodes[8] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 8, MU__GTPC_descr_.raw); encoded_length = field_mU->RAW_encode(MU__GTPC_descr_, *myleaf.body.node.nodes[8]); myleaf.body.node.nodes[8]->coding_descr = &MU__GTPC_descr_; break; case ALT_kD: myleaf.body.node.nodes[9] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 9, KD__GTPC_descr_.raw); encoded_length = field_kD->RAW_encode(KD__GTPC_descr_, *myleaf.body.node.nodes[9]); myleaf.body.node.nodes[9]->coding_descr = &KD__GTPC_descr_; break; case ALT_kU: myleaf.body.node.nodes[10] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 10, KU__GTPC_descr_.raw); encoded_length = field_kU->RAW_encode(KU__GTPC_descr_, *myleaf.body.node.nodes[10]); myleaf.body.node.nodes[10]->coding_descr = &KU__GTPC_descr_; break; case ALT_l3param: myleaf.body.node.nodes[11] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 11, L3param__GTPC_descr_.raw); encoded_length = field_l3param->RAW_encode(L3param__GTPC_descr_, *myleaf.body.node.nodes[11]); myleaf.body.node.nodes[11]->coding_descr = &L3param__GTPC_descr_; break; case ALT_reset: myleaf.body.node.nodes[12] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 12, Reset__LLC__GTPC_descr_.raw); encoded_length = field_reset->RAW_encode(Reset__LLC__GTPC_descr_, *myleaf.body.node.nodes[12]); myleaf.body.node.nodes[12]->coding_descr = &Reset__LLC__GTPC_descr_; break; default: TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value."); } return encoded_length; } void XID__Data__GTPC_template::copy_value(const XID__Data__GTPC& other_value) { single_value.union_selection = other_value.get_selection(); switch (single_value.union_selection) { case XID__Data__GTPC::ALT_version: single_value.field_version = new Version__GTPC_template(other_value.version()); break; case XID__Data__GTPC::ALT_iOV__UI: single_value.field_iOV__UI = new OCTETSTRING_template(other_value.iOV__UI()); break; case XID__Data__GTPC::ALT_iOV__I: single_value.field_iOV__I = new OCTETSTRING_template(other_value.iOV__I()); break; case XID__Data__GTPC::ALT_t200: single_value.field_t200 = new T200__GTPC_template(other_value.t200()); break; case XID__Data__GTPC::ALT_n200: single_value.field_n200 = new N200__GTPC_template(other_value.n200()); break; case XID__Data__GTPC::ALT_n201__U: single_value.field_n201__U = new N201__U__GTPC_template(other_value.n201__U()); break; case XID__Data__GTPC::ALT_n201__I: single_value.field_n201__I = new N201__I__GTPC_template(other_value.n201__I()); break; case XID__Data__GTPC::ALT_mD: single_value.field_mD = new MD__GTPC_template(other_value.mD()); break; case XID__Data__GTPC::ALT_mU: single_value.field_mU = new MU__GTPC_template(other_value.mU()); break; case XID__Data__GTPC::ALT_kD: single_value.field_kD = new INTEGER_template(other_value.kD()); break; case XID__Data__GTPC::ALT_kU: single_value.field_kU = new INTEGER_template(other_value.kU()); break; case XID__Data__GTPC::ALT_l3param: single_value.field_l3param = new OCTETSTRING_template(other_value.l3param()); break; case XID__Data__GTPC::ALT_reset: single_value.field_reset = new OCTETSTRING_template(other_value.reset()); break; default: TTCN_error("Initializing a template with an unbound value of type @GTPC_Types.XID_Data_GTPC."); } set_selection(SPECIFIC_VALUE); } void XID__Data__GTPC_template::copy_template(const XID__Data__GTPC_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 XID__Data__GTPC::ALT_version: single_value.field_version = new Version__GTPC_template(*other_value.single_value.field_version); break; case XID__Data__GTPC::ALT_iOV__UI: single_value.field_iOV__UI = new OCTETSTRING_template(*other_value.single_value.field_iOV__UI); break; case XID__Data__GTPC::ALT_iOV__I: single_value.field_iOV__I = new OCTETSTRING_template(*other_value.single_value.field_iOV__I); break; case XID__Data__GTPC::ALT_t200: single_value.field_t200 = new T200__GTPC_template(*other_value.single_value.field_t200); break; case XID__Data__GTPC::ALT_n200: single_value.field_n200 = new N200__GTPC_template(*other_value.single_value.field_n200); break; case XID__Data__GTPC::ALT_n201__U: single_value.field_n201__U = new N201__U__GTPC_template(*other_value.single_value.field_n201__U); break; case XID__Data__GTPC::ALT_n201__I: single_value.field_n201__I = new N201__I__GTPC_template(*other_value.single_value.field_n201__I); break; case XID__Data__GTPC::ALT_mD: single_value.field_mD = new MD__GTPC_template(*other_value.single_value.field_mD); break; case XID__Data__GTPC::ALT_mU: single_value.field_mU = new MU__GTPC_template(*other_value.single_value.field_mU); break; case XID__Data__GTPC::ALT_kD: single_value.field_kD = new INTEGER_template(*other_value.single_value.field_kD); break; case XID__Data__GTPC::ALT_kU: single_value.field_kU = new INTEGER_template(*other_value.single_value.field_kU); break; case XID__Data__GTPC::ALT_l3param: single_value.field_l3param = new OCTETSTRING_template(*other_value.single_value.field_l3param); break; case XID__Data__GTPC::ALT_reset: single_value.field_reset = new OCTETSTRING_template(*other_value.single_value.field_reset); break; default: TTCN_error("Internal error: Invalid union selector in a specific value when copying a template of type @GTPC_Types.XID_Data_GTPC."); } 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 XID__Data__GTPC_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 XID__Data__GTPC_template(*other_value.implication_.precondition); implication_.implied_template = new XID__Data__GTPC_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 @GTPC_Types.XID_Data_GTPC."); } set_selection(other_value); } XID__Data__GTPC_template::XID__Data__GTPC_template() { } XID__Data__GTPC_template::XID__Data__GTPC_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } XID__Data__GTPC_template::XID__Data__GTPC_template(const XID__Data__GTPC& other_value) { copy_value(other_value); } XID__Data__GTPC_template::XID__Data__GTPC_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const XID__Data__GTPC&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of union type @GTPC_Types.XID_Data_GTPC from an unbound optional field."); } } XID__Data__GTPC_template::XID__Data__GTPC_template(XID__Data__GTPC_template* p_precondition, XID__Data__GTPC_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } XID__Data__GTPC_template::XID__Data__GTPC_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; } XID__Data__GTPC_template::XID__Data__GTPC_template(const XID__Data__GTPC_template& other_value) : Base_Template(){ copy_template(other_value); } XID__Data__GTPC_template::~XID__Data__GTPC_template() { clean_up(); } void XID__Data__GTPC_template::clean_up() { switch (template_selection) { case SPECIFIC_VALUE: switch (single_value.union_selection) { case XID__Data__GTPC::ALT_version: delete single_value.field_version; break; case XID__Data__GTPC::ALT_iOV__UI: delete single_value.field_iOV__UI; break; case XID__Data__GTPC::ALT_iOV__I: delete single_value.field_iOV__I; break; case XID__Data__GTPC::ALT_t200: delete single_value.field_t200; break; case XID__Data__GTPC::ALT_n200: delete single_value.field_n200; break; case XID__Data__GTPC::ALT_n201__U: delete single_value.field_n201__U; break; case XID__Data__GTPC::ALT_n201__I: delete single_value.field_n201__I; break; case XID__Data__GTPC::ALT_mD: delete single_value.field_mD; break; case XID__Data__GTPC::ALT_mU: delete single_value.field_mU; break; case XID__Data__GTPC::ALT_kD: delete single_value.field_kD; break; case XID__Data__GTPC::ALT_kU: delete single_value.field_kU; break; case XID__Data__GTPC::ALT_l3param: delete single_value.field_l3param; break; case XID__Data__GTPC::ALT_reset: delete single_value.field_reset; 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; } XID__Data__GTPC_template& XID__Data__GTPC_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } XID__Data__GTPC_template& XID__Data__GTPC_template::operator=(const XID__Data__GTPC& other_value) { clean_up(); copy_value(other_value); return *this; } XID__Data__GTPC_template& XID__Data__GTPC_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const XID__Data__GTPC&)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 @GTPC_Types.XID_Data_GTPC."); } return *this; } XID__Data__GTPC_template& XID__Data__GTPC_template::operator=(const XID__Data__GTPC_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean XID__Data__GTPC_template::match(const XID__Data__GTPC& 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: { XID__Data__GTPC::union_selection_type value_selection = other_value.get_selection(); if (value_selection == XID__Data__GTPC::UNBOUND_VALUE) return FALSE; if (value_selection != single_value.union_selection) return FALSE; switch (value_selection) { case XID__Data__GTPC::ALT_version: return single_value.field_version->match(other_value.version(), legacy); case XID__Data__GTPC::ALT_iOV__UI: return single_value.field_iOV__UI->match(other_value.iOV__UI(), legacy); case XID__Data__GTPC::ALT_iOV__I: return single_value.field_iOV__I->match(other_value.iOV__I(), legacy); case XID__Data__GTPC::ALT_t200: return single_value.field_t200->match(other_value.t200(), legacy); case XID__Data__GTPC::ALT_n200: return single_value.field_n200->match(other_value.n200(), legacy); case XID__Data__GTPC::ALT_n201__U: return single_value.field_n201__U->match(other_value.n201__U(), legacy); case XID__Data__GTPC::ALT_n201__I: return single_value.field_n201__I->match(other_value.n201__I(), legacy); case XID__Data__GTPC::ALT_mD: return single_value.field_mD->match(other_value.mD(), legacy); case XID__Data__GTPC::ALT_mU: return single_value.field_mU->match(other_value.mU(), legacy); case XID__Data__GTPC::ALT_kD: return single_value.field_kD->match(other_value.kD(), legacy); case XID__Data__GTPC::ALT_kU: return single_value.field_kU->match(other_value.kU(), legacy); case XID__Data__GTPC::ALT_l3param: return single_value.field_l3param->match(other_value.l3param(), legacy); case XID__Data__GTPC::ALT_reset: return single_value.field_reset->match(other_value.reset(), legacy); default: TTCN_error("Internal error: Invalid selector in a specific value when matching a template of union type @GTPC_Types.XID_Data_GTPC."); } } 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 @GTPC_Types.XID_Data_GTPC."); } return FALSE; } boolean XID__Data__GTPC_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; switch (single_value.union_selection) { case XID__Data__GTPC::ALT_version: return single_value.field_version->is_value(); case XID__Data__GTPC::ALT_iOV__UI: return single_value.field_iOV__UI->is_value(); case XID__Data__GTPC::ALT_iOV__I: return single_value.field_iOV__I->is_value(); case XID__Data__GTPC::ALT_t200: return single_value.field_t200->is_value(); case XID__Data__GTPC::ALT_n200: return single_value.field_n200->is_value(); case XID__Data__GTPC::ALT_n201__U: return single_value.field_n201__U->is_value(); case XID__Data__GTPC::ALT_n201__I: return single_value.field_n201__I->is_value(); case XID__Data__GTPC::ALT_mD: return single_value.field_mD->is_value(); case XID__Data__GTPC::ALT_mU: return single_value.field_mU->is_value(); case XID__Data__GTPC::ALT_kD: return single_value.field_kD->is_value(); case XID__Data__GTPC::ALT_kU: return single_value.field_kU->is_value(); case XID__Data__GTPC::ALT_l3param: return single_value.field_l3param->is_value(); case XID__Data__GTPC::ALT_reset: return single_value.field_reset->is_value(); default: TTCN_error("Internal error: Invalid selector in a specific value when performing is_value operation on a template of union type @GTPC_Types.XID_Data_GTPC."); } } XID__Data__GTPC XID__Data__GTPC_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 @GTPC_Types.XID_Data_GTPC."); XID__Data__GTPC ret_val; switch (single_value.union_selection) { case XID__Data__GTPC::ALT_version: ret_val.version() = single_value.field_version->valueof(); break; case XID__Data__GTPC::ALT_iOV__UI: ret_val.iOV__UI() = single_value.field_iOV__UI->valueof(); break; case XID__Data__GTPC::ALT_iOV__I: ret_val.iOV__I() = single_value.field_iOV__I->valueof(); break; case XID__Data__GTPC::ALT_t200: ret_val.t200() = single_value.field_t200->valueof(); break; case XID__Data__GTPC::ALT_n200: ret_val.n200() = single_value.field_n200->valueof(); break; case XID__Data__GTPC::ALT_n201__U: ret_val.n201__U() = single_value.field_n201__U->valueof(); break; case XID__Data__GTPC::ALT_n201__I: ret_val.n201__I() = single_value.field_n201__I->valueof(); break; case XID__Data__GTPC::ALT_mD: ret_val.mD() = single_value.field_mD->valueof(); break; case XID__Data__GTPC::ALT_mU: ret_val.mU() = single_value.field_mU->valueof(); break; case XID__Data__GTPC::ALT_kD: ret_val.kD() = single_value.field_kD->valueof(); break; case XID__Data__GTPC::ALT_kU: ret_val.kU() = single_value.field_kU->valueof(); break; case XID__Data__GTPC::ALT_l3param: ret_val.l3param() = single_value.field_l3param->valueof(); break; case XID__Data__GTPC::ALT_reset: ret_val.reset() = single_value.field_reset->valueof(); break; default: TTCN_error("Internal error: Invalid selector in a specific value when performing valueof operation on a template of union type @GTPC_Types.XID_Data_GTPC."); } return ret_val; } XID__Data__GTPC_template& XID__Data__GTPC_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 @GTPC_Types.XID_Data_GTPC."); if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of union type @GTPC_Types.XID_Data_GTPC."); return value_list.list_value[list_index]; } void XID__Data__GTPC_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 @GTPC_Types.XID_Data_GTPC."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new XID__Data__GTPC_template[list_length]; } Version__GTPC_template& XID__Data__GTPC_template::version() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != XID__Data__GTPC::ALT_version) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_version = new Version__GTPC_template(ANY_VALUE); else single_value.field_version = new Version__GTPC_template; single_value.union_selection = XID__Data__GTPC::ALT_version; set_selection(SPECIFIC_VALUE); } return *single_value.field_version; } const Version__GTPC_template& XID__Data__GTPC_template::version() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field version in a non-specific template of union type @GTPC_Types.XID_Data_GTPC."); if (single_value.union_selection != XID__Data__GTPC::ALT_version) TTCN_error("Accessing non-selected field version in a template of union type @GTPC_Types.XID_Data_GTPC."); return *single_value.field_version; } OCTETSTRING_template& XID__Data__GTPC_template::iOV__UI() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != XID__Data__GTPC::ALT_iOV__UI) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_iOV__UI = new OCTETSTRING_template(ANY_VALUE); else single_value.field_iOV__UI = new OCTETSTRING_template; single_value.union_selection = XID__Data__GTPC::ALT_iOV__UI; set_selection(SPECIFIC_VALUE); } return *single_value.field_iOV__UI; } const OCTETSTRING_template& XID__Data__GTPC_template::iOV__UI() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field iOV_UI in a non-specific template of union type @GTPC_Types.XID_Data_GTPC."); if (single_value.union_selection != XID__Data__GTPC::ALT_iOV__UI) TTCN_error("Accessing non-selected field iOV_UI in a template of union type @GTPC_Types.XID_Data_GTPC."); return *single_value.field_iOV__UI; } OCTETSTRING_template& XID__Data__GTPC_template::iOV__I() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != XID__Data__GTPC::ALT_iOV__I) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_iOV__I = new OCTETSTRING_template(ANY_VALUE); else single_value.field_iOV__I = new OCTETSTRING_template; single_value.union_selection = XID__Data__GTPC::ALT_iOV__I; set_selection(SPECIFIC_VALUE); } return *single_value.field_iOV__I; } const OCTETSTRING_template& XID__Data__GTPC_template::iOV__I() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field iOV_I in a non-specific template of union type @GTPC_Types.XID_Data_GTPC."); if (single_value.union_selection != XID__Data__GTPC::ALT_iOV__I) TTCN_error("Accessing non-selected field iOV_I in a template of union type @GTPC_Types.XID_Data_GTPC."); return *single_value.field_iOV__I; } T200__GTPC_template& XID__Data__GTPC_template::t200() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != XID__Data__GTPC::ALT_t200) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_t200 = new T200__GTPC_template(ANY_VALUE); else single_value.field_t200 = new T200__GTPC_template; single_value.union_selection = XID__Data__GTPC::ALT_t200; set_selection(SPECIFIC_VALUE); } return *single_value.field_t200; } const T200__GTPC_template& XID__Data__GTPC_template::t200() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field t200 in a non-specific template of union type @GTPC_Types.XID_Data_GTPC."); if (single_value.union_selection != XID__Data__GTPC::ALT_t200) TTCN_error("Accessing non-selected field t200 in a template of union type @GTPC_Types.XID_Data_GTPC."); return *single_value.field_t200; } N200__GTPC_template& XID__Data__GTPC_template::n200() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != XID__Data__GTPC::ALT_n200) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_n200 = new N200__GTPC_template(ANY_VALUE); else single_value.field_n200 = new N200__GTPC_template; single_value.union_selection = XID__Data__GTPC::ALT_n200; set_selection(SPECIFIC_VALUE); } return *single_value.field_n200; } const N200__GTPC_template& XID__Data__GTPC_template::n200() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field n200 in a non-specific template of union type @GTPC_Types.XID_Data_GTPC."); if (single_value.union_selection != XID__Data__GTPC::ALT_n200) TTCN_error("Accessing non-selected field n200 in a template of union type @GTPC_Types.XID_Data_GTPC."); return *single_value.field_n200; } N201__U__GTPC_template& XID__Data__GTPC_template::n201__U() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != XID__Data__GTPC::ALT_n201__U) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_n201__U = new N201__U__GTPC_template(ANY_VALUE); else single_value.field_n201__U = new N201__U__GTPC_template; single_value.union_selection = XID__Data__GTPC::ALT_n201__U; set_selection(SPECIFIC_VALUE); } return *single_value.field_n201__U; } const N201__U__GTPC_template& XID__Data__GTPC_template::n201__U() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field n201_U in a non-specific template of union type @GTPC_Types.XID_Data_GTPC."); if (single_value.union_selection != XID__Data__GTPC::ALT_n201__U) TTCN_error("Accessing non-selected field n201_U in a template of union type @GTPC_Types.XID_Data_GTPC."); return *single_value.field_n201__U; } N201__I__GTPC_template& XID__Data__GTPC_template::n201__I() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != XID__Data__GTPC::ALT_n201__I) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_n201__I = new N201__I__GTPC_template(ANY_VALUE); else single_value.field_n201__I = new N201__I__GTPC_template; single_value.union_selection = XID__Data__GTPC::ALT_n201__I; set_selection(SPECIFIC_VALUE); } return *single_value.field_n201__I; } const N201__I__GTPC_template& XID__Data__GTPC_template::n201__I() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field n201_I in a non-specific template of union type @GTPC_Types.XID_Data_GTPC."); if (single_value.union_selection != XID__Data__GTPC::ALT_n201__I) TTCN_error("Accessing non-selected field n201_I in a template of union type @GTPC_Types.XID_Data_GTPC."); return *single_value.field_n201__I; } MD__GTPC_template& XID__Data__GTPC_template::mD() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != XID__Data__GTPC::ALT_mD) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_mD = new MD__GTPC_template(ANY_VALUE); else single_value.field_mD = new MD__GTPC_template; single_value.union_selection = XID__Data__GTPC::ALT_mD; set_selection(SPECIFIC_VALUE); } return *single_value.field_mD; } const MD__GTPC_template& XID__Data__GTPC_template::mD() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field mD in a non-specific template of union type @GTPC_Types.XID_Data_GTPC."); if (single_value.union_selection != XID__Data__GTPC::ALT_mD) TTCN_error("Accessing non-selected field mD in a template of union type @GTPC_Types.XID_Data_GTPC."); return *single_value.field_mD; } MU__GTPC_template& XID__Data__GTPC_template::mU() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != XID__Data__GTPC::ALT_mU) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_mU = new MU__GTPC_template(ANY_VALUE); else single_value.field_mU = new MU__GTPC_template; single_value.union_selection = XID__Data__GTPC::ALT_mU; set_selection(SPECIFIC_VALUE); } return *single_value.field_mU; } const MU__GTPC_template& XID__Data__GTPC_template::mU() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field mU in a non-specific template of union type @GTPC_Types.XID_Data_GTPC."); if (single_value.union_selection != XID__Data__GTPC::ALT_mU) TTCN_error("Accessing non-selected field mU in a template of union type @GTPC_Types.XID_Data_GTPC."); return *single_value.field_mU; } INTEGER_template& XID__Data__GTPC_template::kD() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != XID__Data__GTPC::ALT_kD) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_kD = new INTEGER_template(ANY_VALUE); else single_value.field_kD = new INTEGER_template; single_value.union_selection = XID__Data__GTPC::ALT_kD; set_selection(SPECIFIC_VALUE); } return *single_value.field_kD; } const INTEGER_template& XID__Data__GTPC_template::kD() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field kD in a non-specific template of union type @GTPC_Types.XID_Data_GTPC."); if (single_value.union_selection != XID__Data__GTPC::ALT_kD) TTCN_error("Accessing non-selected field kD in a template of union type @GTPC_Types.XID_Data_GTPC."); return *single_value.field_kD; } INTEGER_template& XID__Data__GTPC_template::kU() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != XID__Data__GTPC::ALT_kU) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_kU = new INTEGER_template(ANY_VALUE); else single_value.field_kU = new INTEGER_template; single_value.union_selection = XID__Data__GTPC::ALT_kU; set_selection(SPECIFIC_VALUE); } return *single_value.field_kU; } const INTEGER_template& XID__Data__GTPC_template::kU() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field kU in a non-specific template of union type @GTPC_Types.XID_Data_GTPC."); if (single_value.union_selection != XID__Data__GTPC::ALT_kU) TTCN_error("Accessing non-selected field kU in a template of union type @GTPC_Types.XID_Data_GTPC."); return *single_value.field_kU; } OCTETSTRING_template& XID__Data__GTPC_template::l3param() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != XID__Data__GTPC::ALT_l3param) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_l3param = new OCTETSTRING_template(ANY_VALUE); else single_value.field_l3param = new OCTETSTRING_template; single_value.union_selection = XID__Data__GTPC::ALT_l3param; set_selection(SPECIFIC_VALUE); } return *single_value.field_l3param; } const OCTETSTRING_template& XID__Data__GTPC_template::l3param() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field l3param in a non-specific template of union type @GTPC_Types.XID_Data_GTPC."); if (single_value.union_selection != XID__Data__GTPC::ALT_l3param) TTCN_error("Accessing non-selected field l3param in a template of union type @GTPC_Types.XID_Data_GTPC."); return *single_value.field_l3param; } OCTETSTRING_template& XID__Data__GTPC_template::reset() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != XID__Data__GTPC::ALT_reset) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_reset = new OCTETSTRING_template(ANY_VALUE); else single_value.field_reset = new OCTETSTRING_template; single_value.union_selection = XID__Data__GTPC::ALT_reset; set_selection(SPECIFIC_VALUE); } return *single_value.field_reset; } const OCTETSTRING_template& XID__Data__GTPC_template::reset() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field reset in a non-specific template of union type @GTPC_Types.XID_Data_GTPC."); if (single_value.union_selection != XID__Data__GTPC::ALT_reset) TTCN_error("Accessing non-selected field reset in a template of union type @GTPC_Types.XID_Data_GTPC."); return *single_value.field_reset; } boolean XID__Data__GTPC_template::ischosen(XID__Data__GTPC::union_selection_type checked_selection) const { if (checked_selection == XID__Data__GTPC::UNBOUND_VALUE) TTCN_error("Internal error: Performing ischosen() operation on an invalid field of union type @GTPC_Types.XID_Data_GTPC."); switch (template_selection) { case SPECIFIC_VALUE: if (single_value.union_selection == XID__Data__GTPC::UNBOUND_VALUE) TTCN_error("Internal error: Invalid selector in a specific value when performing ischosen() operation on a template of union type @GTPC_Types.XID_Data_GTPC."); 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 @GTPC_Types.XID_Data_GTPC 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 XID__Data__GTPC_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: switch (single_value.union_selection) { case XID__Data__GTPC::ALT_version: TTCN_Logger::log_event_str("{ version := "); single_value.field_version->log(); TTCN_Logger::log_event_str(" }"); break; case XID__Data__GTPC::ALT_iOV__UI: TTCN_Logger::log_event_str("{ iOV_UI := "); single_value.field_iOV__UI->log(); TTCN_Logger::log_event_str(" }"); break; case XID__Data__GTPC::ALT_iOV__I: TTCN_Logger::log_event_str("{ iOV_I := "); single_value.field_iOV__I->log(); TTCN_Logger::log_event_str(" }"); break; case XID__Data__GTPC::ALT_t200: TTCN_Logger::log_event_str("{ t200 := "); single_value.field_t200->log(); TTCN_Logger::log_event_str(" }"); break; case XID__Data__GTPC::ALT_n200: TTCN_Logger::log_event_str("{ n200 := "); single_value.field_n200->log(); TTCN_Logger::log_event_str(" }"); break; case XID__Data__GTPC::ALT_n201__U: TTCN_Logger::log_event_str("{ n201_U := "); single_value.field_n201__U->log(); TTCN_Logger::log_event_str(" }"); break; case XID__Data__GTPC::ALT_n201__I: TTCN_Logger::log_event_str("{ n201_I := "); single_value.field_n201__I->log(); TTCN_Logger::log_event_str(" }"); break; case XID__Data__GTPC::ALT_mD: TTCN_Logger::log_event_str("{ mD := "); single_value.field_mD->log(); TTCN_Logger::log_event_str(" }"); break; case XID__Data__GTPC::ALT_mU: TTCN_Logger::log_event_str("{ mU := "); single_value.field_mU->log(); TTCN_Logger::log_event_str(" }"); break; case XID__Data__GTPC::ALT_kD: TTCN_Logger::log_event_str("{ kD := "); single_value.field_kD->log(); TTCN_Logger::log_event_str(" }"); break; case XID__Data__GTPC::ALT_kU: TTCN_Logger::log_event_str("{ kU := "); single_value.field_kU->log(); TTCN_Logger::log_event_str(" }"); break; case XID__Data__GTPC::ALT_l3param: TTCN_Logger::log_event_str("{ l3param := "); single_value.field_l3param->log(); TTCN_Logger::log_event_str(" }"); break; case XID__Data__GTPC::ALT_reset: TTCN_Logger::log_event_str("{ reset := "); single_value.field_reset->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 XID__Data__GTPC_template::log_match(const XID__Data__GTPC& 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 XID__Data__GTPC::ALT_version: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".version"); single_value.field_version->log_match(match_value.version(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ version := "); single_value.field_version->log_match(match_value.version(), legacy); TTCN_Logger::log_event_str(" }"); } break; case XID__Data__GTPC::ALT_iOV__UI: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".iOV_UI"); single_value.field_iOV__UI->log_match(match_value.iOV__UI(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ iOV_UI := "); single_value.field_iOV__UI->log_match(match_value.iOV__UI(), legacy); TTCN_Logger::log_event_str(" }"); } break; case XID__Data__GTPC::ALT_iOV__I: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".iOV_I"); single_value.field_iOV__I->log_match(match_value.iOV__I(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ iOV_I := "); single_value.field_iOV__I->log_match(match_value.iOV__I(), legacy); TTCN_Logger::log_event_str(" }"); } break; case XID__Data__GTPC::ALT_t200: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".t200"); single_value.field_t200->log_match(match_value.t200(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ t200 := "); single_value.field_t200->log_match(match_value.t200(), legacy); TTCN_Logger::log_event_str(" }"); } break; case XID__Data__GTPC::ALT_n200: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".n200"); single_value.field_n200->log_match(match_value.n200(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ n200 := "); single_value.field_n200->log_match(match_value.n200(), legacy); TTCN_Logger::log_event_str(" }"); } break; case XID__Data__GTPC::ALT_n201__U: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".n201_U"); single_value.field_n201__U->log_match(match_value.n201__U(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ n201_U := "); single_value.field_n201__U->log_match(match_value.n201__U(), legacy); TTCN_Logger::log_event_str(" }"); } break; case XID__Data__GTPC::ALT_n201__I: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".n201_I"); single_value.field_n201__I->log_match(match_value.n201__I(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ n201_I := "); single_value.field_n201__I->log_match(match_value.n201__I(), legacy); TTCN_Logger::log_event_str(" }"); } break; case XID__Data__GTPC::ALT_mD: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".mD"); single_value.field_mD->log_match(match_value.mD(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ mD := "); single_value.field_mD->log_match(match_value.mD(), legacy); TTCN_Logger::log_event_str(" }"); } break; case XID__Data__GTPC::ALT_mU: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".mU"); single_value.field_mU->log_match(match_value.mU(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ mU := "); single_value.field_mU->log_match(match_value.mU(), legacy); TTCN_Logger::log_event_str(" }"); } break; case XID__Data__GTPC::ALT_kD: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".kD"); single_value.field_kD->log_match(match_value.kD(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ kD := "); single_value.field_kD->log_match(match_value.kD(), legacy); TTCN_Logger::log_event_str(" }"); } break; case XID__Data__GTPC::ALT_kU: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".kU"); single_value.field_kU->log_match(match_value.kU(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ kU := "); single_value.field_kU->log_match(match_value.kU(), legacy); TTCN_Logger::log_event_str(" }"); } break; case XID__Data__GTPC::ALT_l3param: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".l3param"); single_value.field_l3param->log_match(match_value.l3param(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ l3param := "); single_value.field_l3param->log_match(match_value.l3param(), legacy); TTCN_Logger::log_event_str(" }"); } break; case XID__Data__GTPC::ALT_reset: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".reset"); single_value.field_reset->log_match(match_value.reset(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ reset := "); single_value.field_reset->log_match(match_value.reset(), 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 XID__Data__GTPC_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 XID__Data__GTPC::ALT_version: single_value.field_version->encode_text(text_buf); break; case XID__Data__GTPC::ALT_iOV__UI: single_value.field_iOV__UI->encode_text(text_buf); break; case XID__Data__GTPC::ALT_iOV__I: single_value.field_iOV__I->encode_text(text_buf); break; case XID__Data__GTPC::ALT_t200: single_value.field_t200->encode_text(text_buf); break; case XID__Data__GTPC::ALT_n200: single_value.field_n200->encode_text(text_buf); break; case XID__Data__GTPC::ALT_n201__U: single_value.field_n201__U->encode_text(text_buf); break; case XID__Data__GTPC::ALT_n201__I: single_value.field_n201__I->encode_text(text_buf); break; case XID__Data__GTPC::ALT_mD: single_value.field_mD->encode_text(text_buf); break; case XID__Data__GTPC::ALT_mU: single_value.field_mU->encode_text(text_buf); break; case XID__Data__GTPC::ALT_kD: single_value.field_kD->encode_text(text_buf); break; case XID__Data__GTPC::ALT_kU: single_value.field_kU->encode_text(text_buf); break; case XID__Data__GTPC::ALT_l3param: single_value.field_l3param->encode_text(text_buf); break; case XID__Data__GTPC::ALT_reset: single_value.field_reset->encode_text(text_buf); break; default: TTCN_error("Internal error: Invalid selector in a specific value when encoding a template of union type @GTPC_Types.XID_Data_GTPC."); } 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 @GTPC_Types.XID_Data_GTPC."); } } void XID__Data__GTPC_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: { single_value.union_selection = XID__Data__GTPC::UNBOUND_VALUE; XID__Data__GTPC::union_selection_type new_selection = (XID__Data__GTPC::union_selection_type)text_buf.pull_int().get_val(); switch (new_selection) { case XID__Data__GTPC::ALT_version: single_value.field_version = new Version__GTPC_template; single_value.field_version->decode_text(text_buf); break; case XID__Data__GTPC::ALT_iOV__UI: single_value.field_iOV__UI = new OCTETSTRING_template; single_value.field_iOV__UI->decode_text(text_buf); break; case XID__Data__GTPC::ALT_iOV__I: single_value.field_iOV__I = new OCTETSTRING_template; single_value.field_iOV__I->decode_text(text_buf); break; case XID__Data__GTPC::ALT_t200: single_value.field_t200 = new T200__GTPC_template; single_value.field_t200->decode_text(text_buf); break; case XID__Data__GTPC::ALT_n200: single_value.field_n200 = new N200__GTPC_template; single_value.field_n200->decode_text(text_buf); break; case XID__Data__GTPC::ALT_n201__U: single_value.field_n201__U = new N201__U__GTPC_template; single_value.field_n201__U->decode_text(text_buf); break; case XID__Data__GTPC::ALT_n201__I: single_value.field_n201__I = new N201__I__GTPC_template; single_value.field_n201__I->decode_text(text_buf); break; case XID__Data__GTPC::ALT_mD: single_value.field_mD = new MD__GTPC_template; single_value.field_mD->decode_text(text_buf); break; case XID__Data__GTPC::ALT_mU: single_value.field_mU = new MU__GTPC_template; single_value.field_mU->decode_text(text_buf); break; case XID__Data__GTPC::ALT_kD: single_value.field_kD = new INTEGER_template; single_value.field_kD->decode_text(text_buf); break; case XID__Data__GTPC::ALT_kU: single_value.field_kU = new INTEGER_template; single_value.field_kU->decode_text(text_buf); break; case XID__Data__GTPC::ALT_l3param: single_value.field_l3param = new OCTETSTRING_template; single_value.field_l3param->decode_text(text_buf); break; case XID__Data__GTPC::ALT_reset: single_value.field_reset = new OCTETSTRING_template; single_value.field_reset->decode_text(text_buf); break; default: TTCN_error("Text decoder: Unrecognized union selector was received for a template of type @GTPC_Types.XID_Data_GTPC."); } 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 XID__Data__GTPC_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 @GTPC_Types.XID_Data_GTPC."); } } boolean XID__Data__GTPC_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean XID__Data__GTPC_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 `@GTPC_Types.XID_Data_GTPC'"); } if (strcmp("version", param_field) == 0) { version().set_param(param); return; } else if (strcmp("iOV_UI", param_field) == 0) { iOV__UI().set_param(param); return; } else if (strcmp("iOV_I", param_field) == 0) { iOV__I().set_param(param); return; } else if (strcmp("t200", param_field) == 0) { t200().set_param(param); return; } else if (strcmp("n200", param_field) == 0) { n200().set_param(param); return; } else if (strcmp("n201_U", param_field) == 0) { n201__U().set_param(param); return; } else if (strcmp("n201_I", param_field) == 0) { n201__I().set_param(param); return; } else if (strcmp("mD", param_field) == 0) { mD().set_param(param); return; } else if (strcmp("mU", param_field) == 0) { mU().set_param(param); return; } else if (strcmp("kD", param_field) == 0) { kD().set_param(param); return; } else if (strcmp("kU", param_field) == 0) { kU().set_param(param); return; } else if (strcmp("l3param", param_field) == 0) { l3param().set_param(param); return; } else if (strcmp("reset", param_field) == 0) { reset().set_param(param); return; } else param.error("Field `%s' not found in union template type `@GTPC_Types.XID_Data_GTPC'", 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: { XID__Data__GTPC_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", "@GTPC_Types.XID_Data_GTPC"); 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, "version")) { version().set_param(*mp_last); break; } if (!strcmp(last_name, "iOV_UI")) { iOV__UI().set_param(*mp_last); break; } if (!strcmp(last_name, "iOV_I")) { iOV__I().set_param(*mp_last); break; } if (!strcmp(last_name, "t200")) { t200().set_param(*mp_last); break; } if (!strcmp(last_name, "n200")) { n200().set_param(*mp_last); break; } if (!strcmp(last_name, "n201_U")) { n201__U().set_param(*mp_last); break; } if (!strcmp(last_name, "n201_I")) { n201__I().set_param(*mp_last); break; } if (!strcmp(last_name, "mD")) { mD().set_param(*mp_last); break; } if (!strcmp(last_name, "mU")) { mU().set_param(*mp_last); break; } if (!strcmp(last_name, "kD")) { kD().set_param(*mp_last); break; } if (!strcmp(last_name, "kU")) { kU().set_param(*mp_last); break; } if (!strcmp(last_name, "l3param")) { l3param().set_param(*mp_last); break; } if (!strcmp(last_name, "reset")) { reset().set_param(*mp_last); break; } mp_last->error("Field %s does not exist in type @GTPC_Types.XID_Data_GTPC.", last_name); } break; case Module_Param::MP_Implication_Template: { XID__Data__GTPC_template* precondition = new XID__Data__GTPC_template; precondition->set_param(*m_p->get_elem(0)); XID__Data__GTPC_template* implied_template = new XID__Data__GTPC_template; implied_template->set_param(*m_p->get_elem(1)); *this = XID__Data__GTPC_template(precondition, implied_template); } break; default: param.type_error("union template", "@GTPC_Types.XID_Data_GTPC"); } is_ifpresent = param.get_ifpresent(); } void XID__Data__GTPC_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 XID__Data__GTPC::ALT_version: single_value.field_version->check_restriction(t_res, t_name ? t_name : "@GTPC_Types.XID_Data_GTPC"); return; case XID__Data__GTPC::ALT_iOV__UI: single_value.field_iOV__UI->check_restriction(t_res, t_name ? t_name : "@GTPC_Types.XID_Data_GTPC"); return; case XID__Data__GTPC::ALT_iOV__I: single_value.field_iOV__I->check_restriction(t_res, t_name ? t_name : "@GTPC_Types.XID_Data_GTPC"); return; case XID__Data__GTPC::ALT_t200: single_value.field_t200->check_restriction(t_res, t_name ? t_name : "@GTPC_Types.XID_Data_GTPC"); return; case XID__Data__GTPC::ALT_n200: single_value.field_n200->check_restriction(t_res, t_name ? t_name : "@GTPC_Types.XID_Data_GTPC"); return; case XID__Data__GTPC::ALT_n201__U: single_value.field_n201__U->check_restriction(t_res, t_name ? t_name : "@GTPC_Types.XID_Data_GTPC"); return; case XID__Data__GTPC::ALT_n201__I: single_value.field_n201__I->check_restriction(t_res, t_name ? t_name : "@GTPC_Types.XID_Data_GTPC"); return; case XID__Data__GTPC::ALT_mD: single_value.field_mD->check_restriction(t_res, t_name ? t_name : "@GTPC_Types.XID_Data_GTPC"); return; case XID__Data__GTPC::ALT_mU: single_value.field_mU->check_restriction(t_res, t_name ? t_name : "@GTPC_Types.XID_Data_GTPC"); return; case XID__Data__GTPC::ALT_kD: single_value.field_kD->check_restriction(t_res, t_name ? t_name : "@GTPC_Types.XID_Data_GTPC"); return; case XID__Data__GTPC::ALT_kU: single_value.field_kU->check_restriction(t_res, t_name ? t_name : "@GTPC_Types.XID_Data_GTPC"); return; case XID__Data__GTPC::ALT_l3param: single_value.field_l3param->check_restriction(t_res, t_name ? t_name : "@GTPC_Types.XID_Data_GTPC"); return; case XID__Data__GTPC::ALT_reset: single_value.field_reset->check_restriction(t_res, t_name ? t_name : "@GTPC_Types.XID_Data_GTPC"); return; default: TTCN_error("Internal error: Invalid selector in a specific value when performing check_restriction operation on a template of union type @GTPC_Types.XID_Data_GTPC."); } 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 : "@GTPC_Types.XID_Data_GTPC"); } Version__GTPC::Version__GTPC() { } Version__GTPC::Version__GTPC(const INTEGER& par_version__value, const BITSTRING& par_spare) : field_version__value(par_version__value), field_spare(par_spare) { } Version__GTPC::Version__GTPC(const Version__GTPC& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GTPC_Types.Version_GTPC."); if (other_value.version__value().is_bound()) field_version__value = other_value.version__value(); else field_version__value.clean_up(); if (other_value.spare().is_bound()) field_spare = other_value.spare(); else field_spare.clean_up(); } void Version__GTPC::clean_up() { field_version__value.clean_up(); field_spare.clean_up(); } const TTCN_Typedescriptor_t* Version__GTPC::get_descriptor() const { return &Version__GTPC_descr_; } Version__GTPC& Version__GTPC::operator=(const Version__GTPC& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GTPC_Types.Version_GTPC."); if (other_value.version__value().is_bound()) field_version__value = other_value.version__value(); else field_version__value.clean_up(); if (other_value.spare().is_bound()) field_spare = other_value.spare(); else field_spare.clean_up(); } return *this; } boolean Version__GTPC::operator==(const Version__GTPC& other_value) const { return field_version__value==other_value.field_version__value && field_spare==other_value.field_spare; } boolean Version__GTPC::is_bound() const { return (field_version__value.is_bound()) || (field_spare.is_bound()); } boolean Version__GTPC::is_value() const { return field_version__value.is_value() && field_spare.is_value(); } void Version__GTPC::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ version_value := "); field_version__value.log(); TTCN_Logger::log_event_str(", spare := "); field_spare.log(); TTCN_Logger::log_event_str(" }"); } void Version__GTPC::set_implicit_omit() { if (version__value().is_bound()) version__value().set_implicit_omit(); if (spare().is_bound()) spare().set_implicit_omit(); } void Version__GTPC::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "record value"); switch (param.get_type()) { case Module_Param::MP_Value_List: if (20 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) version__value().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(), "version_value")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { version__value().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 @GTPC_Types.Version_GTPC: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.Version_GTPC"); } } void Version__GTPC::encode_text(Text_Buf& text_buf) const { field_version__value.encode_text(text_buf); field_spare.encode_text(text_buf); } void Version__GTPC::decode_text(Text_Buf& text_buf) { field_version__value.decode_text(text_buf); field_spare.decode_text(text_buf); } void Version__GTPC::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 Version__GTPC::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 Version__GTPC::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, Version__GTPC_version__value_descr_.raw->forceomit); decoded_field_length = field_version__value.RAW_decode(Version__GTPC_version__value_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::BIT4_descr_.raw->forceomit); decoded_field_length = field_spare.RAW_decode(General__Types::BIT4_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 Version__GTPC::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, Version__GTPC_version__value_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, General__Types::BIT4_descr_.raw); encoded_length += field_version__value.RAW_encode(Version__GTPC_version__value_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_spare.RAW_encode(General__Types::BIT4_descr_, *myleaf.body.node.nodes[1]); return myleaf.length = encoded_length; } struct Version__GTPC_template::single_value_struct { INTEGER_template field_version__value; BITSTRING_template field_spare; }; void Version__GTPC_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_version__value = ANY_VALUE; single_value->field_spare = ANY_VALUE; } } } void Version__GTPC_template::copy_value(const Version__GTPC& other_value) { single_value = new single_value_struct; if (other_value.version__value().is_bound()) { single_value->field_version__value = other_value.version__value(); } else { single_value->field_version__value.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 Version__GTPC_template::copy_template(const Version__GTPC_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.version__value().get_selection()) { single_value->field_version__value = other_value.version__value(); } else { single_value->field_version__value.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 Version__GTPC_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 Version__GTPC_template(*other_value.implication_.precondition); implication_.implied_template = new Version__GTPC_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 @GTPC_Types.Version_GTPC."); break; } set_selection(other_value); } Version__GTPC_template::Version__GTPC_template() { } Version__GTPC_template::Version__GTPC_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } Version__GTPC_template::Version__GTPC_template(const Version__GTPC& other_value) { copy_value(other_value); } Version__GTPC_template::Version__GTPC_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const Version__GTPC&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.Version_GTPC from an unbound optional field."); } } Version__GTPC_template::Version__GTPC_template(Version__GTPC_template* p_precondition, Version__GTPC_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } Version__GTPC_template::Version__GTPC_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; } Version__GTPC_template::Version__GTPC_template(const Version__GTPC_template& other_value) : Base_Template() { copy_template(other_value); } Version__GTPC_template::~Version__GTPC_template() { clean_up(); } Version__GTPC_template& Version__GTPC_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } Version__GTPC_template& Version__GTPC_template::operator=(const Version__GTPC& other_value) { clean_up(); copy_value(other_value); return *this; } Version__GTPC_template& Version__GTPC_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const Version__GTPC&)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 @GTPC_Types.Version_GTPC."); } return *this; } Version__GTPC_template& Version__GTPC_template::operator=(const Version__GTPC_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean Version__GTPC_template::match(const Version__GTPC& 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.version__value().is_bound()) return FALSE; if(!single_value->field_version__value.match(other_value.version__value(), 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 @GTPC_Types.Version_GTPC."); } return FALSE; } boolean Version__GTPC_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_version__value.is_bound() || single_value->field_spare.is_bound(); } boolean Version__GTPC_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_version__value.is_value() && single_value->field_spare.is_value(); } void Version__GTPC_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; } Version__GTPC Version__GTPC_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 @GTPC_Types.Version_GTPC."); Version__GTPC ret_val; if (single_value->field_version__value.is_bound()) { ret_val.version__value() = single_value->field_version__value.valueof(); } if (single_value->field_spare.is_bound()) { ret_val.spare() = single_value->field_spare.valueof(); } return ret_val; } void Version__GTPC_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 @GTPC_Types.Version_GTPC."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new Version__GTPC_template[list_length]; } Version__GTPC_template& Version__GTPC_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 @GTPC_Types.Version_GTPC."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.Version_GTPC."); return value_list.list_value[list_index]; } INTEGER_template& Version__GTPC_template::version__value() { set_specific(); return single_value->field_version__value; } const INTEGER_template& Version__GTPC_template::version__value() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field version_value of a non-specific template of type @GTPC_Types.Version_GTPC."); return single_value->field_version__value; } BITSTRING_template& Version__GTPC_template::spare() { set_specific(); return single_value->field_spare; } const BITSTRING_template& Version__GTPC_template::spare() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field spare of a non-specific template of type @GTPC_Types.Version_GTPC."); return single_value->field_spare; } int Version__GTPC_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.Version_GTPC 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 @GTPC_Types.Version_GTPC 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 @GTPC_Types.Version_GTPC containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.Version_GTPC containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.Version_GTPC containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.Version_GTPC containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.Version_GTPC containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.Version_GTPC containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.Version_GTPC containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.Version_GTPC."); } return 0; } void Version__GTPC_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ version_value := "); single_value->field_version__value.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 Version__GTPC_template::log_match(const Version__GTPC& 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_version__value.match(match_value.version__value(), legacy)){ TTCN_Logger::log_logmatch_info(".version_value"); single_value->field_version__value.log_match(match_value.version__value(), 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("{ version_value := "); single_value->field_version__value.log_match(match_value.version__value(), 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 Version__GTPC_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_version__value.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 @GTPC_Types.Version_GTPC."); } } void Version__GTPC_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_version__value.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 Version__GTPC_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 @GTPC_Types.Version_GTPC."); } } void Version__GTPC_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: { Version__GTPC_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) version__value().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(), "version_value")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { version__value().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 @GTPC_Types.Version_GTPC: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { Version__GTPC_template* precondition = new Version__GTPC_template; precondition->set_param(*param.get_elem(0)); Version__GTPC_template* implied_template = new Version__GTPC_template; implied_template->set_param(*param.get_elem(1)); *this = Version__GTPC_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.Version_GTPC"); } is_ifpresent = param.get_ifpresent(); } void Version__GTPC_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_version__value.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.Version_GTPC"); single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.Version_GTPC"); 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 : "@GTPC_Types.Version_GTPC"); } boolean Version__GTPC_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean Version__GTPC_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int l_idx=0; l_idx0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) t200Value().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(), "spare")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "t200Value")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { t200Value().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.T200_GTPC: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.T200_GTPC"); } } void T200__GTPC::encode_text(Text_Buf& text_buf) const { field_spare.encode_text(text_buf); field_t200Value.encode_text(text_buf); } void T200__GTPC::decode_text(Text_Buf& text_buf) { field_spare.decode_text(text_buf); field_t200Value.decode_text(text_buf); } void T200__GTPC::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 T200__GTPC::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 T200__GTPC::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, T200__GTPC_spare_descr_.raw->forceomit); decoded_field_length = field_spare.RAW_decode(T200__GTPC_spare_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); RAW_Force_Omit field_1_force_omit(1, force_omit, T200__GTPC_t200Value_descr_.raw->forceomit); decoded_field_length = field_t200Value.RAW_decode(T200__GTPC_t200Value_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 T200__GTPC::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, T200__GTPC_spare_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, T200__GTPC_t200Value_descr_.raw); encoded_length += field_spare.RAW_encode(T200__GTPC_spare_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_t200Value.RAW_encode(T200__GTPC_t200Value_descr_, *myleaf.body.node.nodes[1]); return myleaf.length = encoded_length; } struct T200__GTPC_template::single_value_struct { BITSTRING_template field_spare; INTEGER_template field_t200Value; }; void T200__GTPC_template::set_specific() { if (template_selection != SPECIFIC_VALUE) { template_sel old_selection = template_selection; clean_up(); single_value = new single_value_struct; set_selection(SPECIFIC_VALUE); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) { single_value->field_spare = ANY_VALUE; single_value->field_t200Value = ANY_VALUE; } } } void T200__GTPC_template::copy_value(const T200__GTPC& other_value) { single_value = new single_value_struct; if (other_value.spare().is_bound()) { single_value->field_spare = other_value.spare(); } else { single_value->field_spare.clean_up(); } if (other_value.t200Value().is_bound()) { single_value->field_t200Value = other_value.t200Value(); } else { single_value->field_t200Value.clean_up(); } set_selection(SPECIFIC_VALUE); } void T200__GTPC_template::copy_template(const T200__GTPC_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.spare().get_selection()) { single_value->field_spare = other_value.spare(); } else { single_value->field_spare.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.t200Value().get_selection()) { single_value->field_t200Value = other_value.t200Value(); } else { single_value->field_t200Value.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 T200__GTPC_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 T200__GTPC_template(*other_value.implication_.precondition); implication_.implied_template = new T200__GTPC_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 @GTPC_Types.T200_GTPC."); break; } set_selection(other_value); } T200__GTPC_template::T200__GTPC_template() { } T200__GTPC_template::T200__GTPC_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } T200__GTPC_template::T200__GTPC_template(const T200__GTPC& other_value) { copy_value(other_value); } T200__GTPC_template::T200__GTPC_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const T200__GTPC&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.T200_GTPC from an unbound optional field."); } } T200__GTPC_template::T200__GTPC_template(T200__GTPC_template* p_precondition, T200__GTPC_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } T200__GTPC_template::T200__GTPC_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; } T200__GTPC_template::T200__GTPC_template(const T200__GTPC_template& other_value) : Base_Template() { copy_template(other_value); } T200__GTPC_template::~T200__GTPC_template() { clean_up(); } T200__GTPC_template& T200__GTPC_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } T200__GTPC_template& T200__GTPC_template::operator=(const T200__GTPC& other_value) { clean_up(); copy_value(other_value); return *this; } T200__GTPC_template& T200__GTPC_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const T200__GTPC&)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 @GTPC_Types.T200_GTPC."); } return *this; } T200__GTPC_template& T200__GTPC_template::operator=(const T200__GTPC_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean T200__GTPC_template::match(const T200__GTPC& other_value, boolean legacy) const { if (!other_value.is_bound()) return FALSE; switch (template_selection) { case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case OMIT_VALUE: return FALSE; case SPECIFIC_VALUE: if(!other_value.spare().is_bound()) return FALSE; if(!single_value->field_spare.match(other_value.spare(), legacy))return FALSE; if(!other_value.t200Value().is_bound()) return FALSE; if(!single_value->field_t200Value.match(other_value.t200Value(), 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 @GTPC_Types.T200_GTPC."); } return FALSE; } boolean T200__GTPC_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_spare.is_bound() || single_value->field_t200Value.is_bound(); } boolean T200__GTPC_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_spare.is_value() && single_value->field_t200Value.is_value(); } void T200__GTPC_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; } T200__GTPC T200__GTPC_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 @GTPC_Types.T200_GTPC."); T200__GTPC ret_val; if (single_value->field_spare.is_bound()) { ret_val.spare() = single_value->field_spare.valueof(); } if (single_value->field_t200Value.is_bound()) { ret_val.t200Value() = single_value->field_t200Value.valueof(); } return ret_val; } void T200__GTPC_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 @GTPC_Types.T200_GTPC."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new T200__GTPC_template[list_length]; } T200__GTPC_template& T200__GTPC_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 @GTPC_Types.T200_GTPC."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.T200_GTPC."); return value_list.list_value[list_index]; } BITSTRING_template& T200__GTPC_template::spare() { set_specific(); return single_value->field_spare; } const BITSTRING_template& T200__GTPC_template::spare() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field spare of a non-specific template of type @GTPC_Types.T200_GTPC."); return single_value->field_spare; } INTEGER_template& T200__GTPC_template::t200Value() { set_specific(); return single_value->field_t200Value; } const INTEGER_template& T200__GTPC_template::t200Value() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field t200Value of a non-specific template of type @GTPC_Types.T200_GTPC."); return single_value->field_t200Value; } int T200__GTPC_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.T200_GTPC 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 @GTPC_Types.T200_GTPC 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 @GTPC_Types.T200_GTPC containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.T200_GTPC containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.T200_GTPC containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.T200_GTPC containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.T200_GTPC containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.T200_GTPC containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.T200_GTPC containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.T200_GTPC."); } return 0; } void T200__GTPC_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ spare := "); single_value->field_spare.log(); TTCN_Logger::log_event_str(", t200Value := "); single_value->field_t200Value.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 T200__GTPC_template::log_match(const T200__GTPC& match_value, boolean legacy) const { if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ if(match(match_value, legacy)){ TTCN_Logger::print_logmatch_buffer(); TTCN_Logger::log_event_str(" matched"); } else{ if (template_selection == SPECIFIC_VALUE) { size_t previous_size = TTCN_Logger::get_logmatch_buffer_len(); if(!single_value->field_spare.match(match_value.spare(), legacy)){ TTCN_Logger::log_logmatch_info(".spare"); single_value->field_spare.log_match(match_value.spare(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_t200Value.match(match_value.t200Value(), legacy)){ TTCN_Logger::log_logmatch_info(".t200Value"); single_value->field_t200Value.log_match(match_value.t200Value(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } }else { TTCN_Logger::print_logmatch_buffer(); match_value.log(); TTCN_Logger::log_event_str(" with "); log(); TTCN_Logger::log_event_str(" unmatched"); } } return; } if (template_selection == SPECIFIC_VALUE) { TTCN_Logger::log_event_str("{ spare := "); single_value->field_spare.log_match(match_value.spare(), legacy); TTCN_Logger::log_event_str(", t200Value := "); single_value->field_t200Value.log_match(match_value.t200Value(), 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 T200__GTPC_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_spare.encode_text(text_buf); single_value->field_t200Value.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 @GTPC_Types.T200_GTPC."); } } void T200__GTPC_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; single_value->field_spare.decode_text(text_buf); single_value->field_t200Value.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 T200__GTPC_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 @GTPC_Types.T200_GTPC."); } } void T200__GTPC_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: { T200__GTPC_template new_temp; new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size()); for (size_t p_i=0; p_i0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) t200Value().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(), "spare")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "t200Value")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { t200Value().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.T200_GTPC: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { T200__GTPC_template* precondition = new T200__GTPC_template; precondition->set_param(*param.get_elem(0)); T200__GTPC_template* implied_template = new T200__GTPC_template; implied_template->set_param(*param.get_elem(1)); *this = T200__GTPC_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.T200_GTPC"); } is_ifpresent = param.get_ifpresent(); } void T200__GTPC_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_OMIT: if (template_selection==OMIT_VALUE) return; case TR_VALUE: if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break; single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.T200_GTPC"); single_value->field_t200Value.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.T200_GTPC"); 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 : "@GTPC_Types.T200_GTPC"); } boolean T200__GTPC_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean T200__GTPC_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) retransmissions().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(), "retransmissions")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { retransmissions().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 @GTPC_Types.N200_GTPC: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.N200_GTPC"); } } void N200__GTPC::encode_text(Text_Buf& text_buf) const { field_retransmissions.encode_text(text_buf); field_spare.encode_text(text_buf); } void N200__GTPC::decode_text(Text_Buf& text_buf) { field_retransmissions.decode_text(text_buf); field_spare.decode_text(text_buf); } void N200__GTPC::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 N200__GTPC::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 N200__GTPC::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, N200__GTPC_retransmissions_descr_.raw->forceomit); decoded_field_length = field_retransmissions.RAW_decode(N200__GTPC_retransmissions_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::BIT4_descr_.raw->forceomit); decoded_field_length = field_spare.RAW_decode(General__Types::BIT4_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 N200__GTPC::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, N200__GTPC_retransmissions_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, General__Types::BIT4_descr_.raw); encoded_length += field_retransmissions.RAW_encode(N200__GTPC_retransmissions_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_spare.RAW_encode(General__Types::BIT4_descr_, *myleaf.body.node.nodes[1]); return myleaf.length = encoded_length; } struct N200__GTPC_template::single_value_struct { INTEGER_template field_retransmissions; BITSTRING_template field_spare; }; void N200__GTPC_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_retransmissions = ANY_VALUE; single_value->field_spare = ANY_VALUE; } } } void N200__GTPC_template::copy_value(const N200__GTPC& other_value) { single_value = new single_value_struct; if (other_value.retransmissions().is_bound()) { single_value->field_retransmissions = other_value.retransmissions(); } else { single_value->field_retransmissions.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 N200__GTPC_template::copy_template(const N200__GTPC_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.retransmissions().get_selection()) { single_value->field_retransmissions = other_value.retransmissions(); } else { single_value->field_retransmissions.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 N200__GTPC_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 N200__GTPC_template(*other_value.implication_.precondition); implication_.implied_template = new N200__GTPC_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 @GTPC_Types.N200_GTPC."); break; } set_selection(other_value); } N200__GTPC_template::N200__GTPC_template() { } N200__GTPC_template::N200__GTPC_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } N200__GTPC_template::N200__GTPC_template(const N200__GTPC& other_value) { copy_value(other_value); } N200__GTPC_template::N200__GTPC_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const N200__GTPC&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.N200_GTPC from an unbound optional field."); } } N200__GTPC_template::N200__GTPC_template(N200__GTPC_template* p_precondition, N200__GTPC_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } N200__GTPC_template::N200__GTPC_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; } N200__GTPC_template::N200__GTPC_template(const N200__GTPC_template& other_value) : Base_Template() { copy_template(other_value); } N200__GTPC_template::~N200__GTPC_template() { clean_up(); } N200__GTPC_template& N200__GTPC_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } N200__GTPC_template& N200__GTPC_template::operator=(const N200__GTPC& other_value) { clean_up(); copy_value(other_value); return *this; } N200__GTPC_template& N200__GTPC_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const N200__GTPC&)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 @GTPC_Types.N200_GTPC."); } return *this; } N200__GTPC_template& N200__GTPC_template::operator=(const N200__GTPC_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean N200__GTPC_template::match(const N200__GTPC& 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.retransmissions().is_bound()) return FALSE; if(!single_value->field_retransmissions.match(other_value.retransmissions(), 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 @GTPC_Types.N200_GTPC."); } return FALSE; } boolean N200__GTPC_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_retransmissions.is_bound() || single_value->field_spare.is_bound(); } boolean N200__GTPC_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_retransmissions.is_value() && single_value->field_spare.is_value(); } void N200__GTPC_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; } N200__GTPC N200__GTPC_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 @GTPC_Types.N200_GTPC."); N200__GTPC ret_val; if (single_value->field_retransmissions.is_bound()) { ret_val.retransmissions() = single_value->field_retransmissions.valueof(); } if (single_value->field_spare.is_bound()) { ret_val.spare() = single_value->field_spare.valueof(); } return ret_val; } void N200__GTPC_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 @GTPC_Types.N200_GTPC."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new N200__GTPC_template[list_length]; } N200__GTPC_template& N200__GTPC_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 @GTPC_Types.N200_GTPC."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.N200_GTPC."); return value_list.list_value[list_index]; } INTEGER_template& N200__GTPC_template::retransmissions() { set_specific(); return single_value->field_retransmissions; } const INTEGER_template& N200__GTPC_template::retransmissions() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field retransmissions of a non-specific template of type @GTPC_Types.N200_GTPC."); return single_value->field_retransmissions; } BITSTRING_template& N200__GTPC_template::spare() { set_specific(); return single_value->field_spare; } const BITSTRING_template& N200__GTPC_template::spare() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field spare of a non-specific template of type @GTPC_Types.N200_GTPC."); return single_value->field_spare; } int N200__GTPC_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.N200_GTPC 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 @GTPC_Types.N200_GTPC 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 @GTPC_Types.N200_GTPC containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.N200_GTPC containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.N200_GTPC containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.N200_GTPC containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.N200_GTPC containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.N200_GTPC containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.N200_GTPC containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.N200_GTPC."); } return 0; } void N200__GTPC_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ retransmissions := "); single_value->field_retransmissions.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 N200__GTPC_template::log_match(const N200__GTPC& 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_retransmissions.match(match_value.retransmissions(), legacy)){ TTCN_Logger::log_logmatch_info(".retransmissions"); single_value->field_retransmissions.log_match(match_value.retransmissions(), 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("{ retransmissions := "); single_value->field_retransmissions.log_match(match_value.retransmissions(), 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 N200__GTPC_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_retransmissions.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 @GTPC_Types.N200_GTPC."); } } void N200__GTPC_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_retransmissions.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 N200__GTPC_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 @GTPC_Types.N200_GTPC."); } } void N200__GTPC_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: { N200__GTPC_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) retransmissions().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(), "retransmissions")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { retransmissions().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 @GTPC_Types.N200_GTPC: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { N200__GTPC_template* precondition = new N200__GTPC_template; precondition->set_param(*param.get_elem(0)); N200__GTPC_template* implied_template = new N200__GTPC_template; implied_template->set_param(*param.get_elem(1)); *this = N200__GTPC_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.N200_GTPC"); } is_ifpresent = param.get_ifpresent(); } void N200__GTPC_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_retransmissions.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.N200_GTPC"); single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.N200_GTPC"); 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 : "@GTPC_Types.N200_GTPC"); } boolean N200__GTPC_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean N200__GTPC_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int l_idx=0; l_idx0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) n201UValue().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(), "spare")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "n201UValue")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { n201UValue().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.N201_U_GTPC: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.N201_U_GTPC"); } } void N201__U__GTPC::encode_text(Text_Buf& text_buf) const { field_spare.encode_text(text_buf); field_n201UValue.encode_text(text_buf); } void N201__U__GTPC::decode_text(Text_Buf& text_buf) { field_spare.decode_text(text_buf); field_n201UValue.decode_text(text_buf); } void N201__U__GTPC::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 N201__U__GTPC::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 N201__U__GTPC::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, N201__U__GTPC_spare_descr_.raw->forceomit); decoded_field_length = field_spare.RAW_decode(N201__U__GTPC_spare_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); RAW_Force_Omit field_1_force_omit(1, force_omit, N201__U__GTPC_n201UValue_descr_.raw->forceomit); decoded_field_length = field_n201UValue.RAW_decode(N201__U__GTPC_n201UValue_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 N201__U__GTPC::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, N201__U__GTPC_spare_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, N201__U__GTPC_n201UValue_descr_.raw); encoded_length += field_spare.RAW_encode(N201__U__GTPC_spare_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_n201UValue.RAW_encode(N201__U__GTPC_n201UValue_descr_, *myleaf.body.node.nodes[1]); return myleaf.length = encoded_length; } struct N201__U__GTPC_template::single_value_struct { BITSTRING_template field_spare; INTEGER_template field_n201UValue; }; void N201__U__GTPC_template::set_specific() { if (template_selection != SPECIFIC_VALUE) { template_sel old_selection = template_selection; clean_up(); single_value = new single_value_struct; set_selection(SPECIFIC_VALUE); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) { single_value->field_spare = ANY_VALUE; single_value->field_n201UValue = ANY_VALUE; } } } void N201__U__GTPC_template::copy_value(const N201__U__GTPC& other_value) { single_value = new single_value_struct; if (other_value.spare().is_bound()) { single_value->field_spare = other_value.spare(); } else { single_value->field_spare.clean_up(); } if (other_value.n201UValue().is_bound()) { single_value->field_n201UValue = other_value.n201UValue(); } else { single_value->field_n201UValue.clean_up(); } set_selection(SPECIFIC_VALUE); } void N201__U__GTPC_template::copy_template(const N201__U__GTPC_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.spare().get_selection()) { single_value->field_spare = other_value.spare(); } else { single_value->field_spare.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.n201UValue().get_selection()) { single_value->field_n201UValue = other_value.n201UValue(); } else { single_value->field_n201UValue.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 N201__U__GTPC_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 N201__U__GTPC_template(*other_value.implication_.precondition); implication_.implied_template = new N201__U__GTPC_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 @GTPC_Types.N201_U_GTPC."); break; } set_selection(other_value); } N201__U__GTPC_template::N201__U__GTPC_template() { } N201__U__GTPC_template::N201__U__GTPC_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } N201__U__GTPC_template::N201__U__GTPC_template(const N201__U__GTPC& other_value) { copy_value(other_value); } N201__U__GTPC_template::N201__U__GTPC_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const N201__U__GTPC&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.N201_U_GTPC from an unbound optional field."); } } N201__U__GTPC_template::N201__U__GTPC_template(N201__U__GTPC_template* p_precondition, N201__U__GTPC_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } N201__U__GTPC_template::N201__U__GTPC_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; } N201__U__GTPC_template::N201__U__GTPC_template(const N201__U__GTPC_template& other_value) : Base_Template() { copy_template(other_value); } N201__U__GTPC_template::~N201__U__GTPC_template() { clean_up(); } N201__U__GTPC_template& N201__U__GTPC_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } N201__U__GTPC_template& N201__U__GTPC_template::operator=(const N201__U__GTPC& other_value) { clean_up(); copy_value(other_value); return *this; } N201__U__GTPC_template& N201__U__GTPC_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const N201__U__GTPC&)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 @GTPC_Types.N201_U_GTPC."); } return *this; } N201__U__GTPC_template& N201__U__GTPC_template::operator=(const N201__U__GTPC_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean N201__U__GTPC_template::match(const N201__U__GTPC& other_value, boolean legacy) const { if (!other_value.is_bound()) return FALSE; switch (template_selection) { case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case OMIT_VALUE: return FALSE; case SPECIFIC_VALUE: if(!other_value.spare().is_bound()) return FALSE; if(!single_value->field_spare.match(other_value.spare(), legacy))return FALSE; if(!other_value.n201UValue().is_bound()) return FALSE; if(!single_value->field_n201UValue.match(other_value.n201UValue(), 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 @GTPC_Types.N201_U_GTPC."); } return FALSE; } boolean N201__U__GTPC_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_spare.is_bound() || single_value->field_n201UValue.is_bound(); } boolean N201__U__GTPC_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_spare.is_value() && single_value->field_n201UValue.is_value(); } void N201__U__GTPC_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; } N201__U__GTPC N201__U__GTPC_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 @GTPC_Types.N201_U_GTPC."); N201__U__GTPC ret_val; if (single_value->field_spare.is_bound()) { ret_val.spare() = single_value->field_spare.valueof(); } if (single_value->field_n201UValue.is_bound()) { ret_val.n201UValue() = single_value->field_n201UValue.valueof(); } return ret_val; } void N201__U__GTPC_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 @GTPC_Types.N201_U_GTPC."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new N201__U__GTPC_template[list_length]; } N201__U__GTPC_template& N201__U__GTPC_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 @GTPC_Types.N201_U_GTPC."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.N201_U_GTPC."); return value_list.list_value[list_index]; } BITSTRING_template& N201__U__GTPC_template::spare() { set_specific(); return single_value->field_spare; } const BITSTRING_template& N201__U__GTPC_template::spare() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field spare of a non-specific template of type @GTPC_Types.N201_U_GTPC."); return single_value->field_spare; } INTEGER_template& N201__U__GTPC_template::n201UValue() { set_specific(); return single_value->field_n201UValue; } const INTEGER_template& N201__U__GTPC_template::n201UValue() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field n201UValue of a non-specific template of type @GTPC_Types.N201_U_GTPC."); return single_value->field_n201UValue; } int N201__U__GTPC_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.N201_U_GTPC 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 @GTPC_Types.N201_U_GTPC 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 @GTPC_Types.N201_U_GTPC containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.N201_U_GTPC containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.N201_U_GTPC containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.N201_U_GTPC containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.N201_U_GTPC containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.N201_U_GTPC containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.N201_U_GTPC containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.N201_U_GTPC."); } return 0; } void N201__U__GTPC_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ spare := "); single_value->field_spare.log(); TTCN_Logger::log_event_str(", n201UValue := "); single_value->field_n201UValue.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 N201__U__GTPC_template::log_match(const N201__U__GTPC& match_value, boolean legacy) const { if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ if(match(match_value, legacy)){ TTCN_Logger::print_logmatch_buffer(); TTCN_Logger::log_event_str(" matched"); } else{ if (template_selection == SPECIFIC_VALUE) { size_t previous_size = TTCN_Logger::get_logmatch_buffer_len(); if(!single_value->field_spare.match(match_value.spare(), legacy)){ TTCN_Logger::log_logmatch_info(".spare"); single_value->field_spare.log_match(match_value.spare(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_n201UValue.match(match_value.n201UValue(), legacy)){ TTCN_Logger::log_logmatch_info(".n201UValue"); single_value->field_n201UValue.log_match(match_value.n201UValue(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } }else { TTCN_Logger::print_logmatch_buffer(); match_value.log(); TTCN_Logger::log_event_str(" with "); log(); TTCN_Logger::log_event_str(" unmatched"); } } return; } if (template_selection == SPECIFIC_VALUE) { TTCN_Logger::log_event_str("{ spare := "); single_value->field_spare.log_match(match_value.spare(), legacy); TTCN_Logger::log_event_str(", n201UValue := "); single_value->field_n201UValue.log_match(match_value.n201UValue(), 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 N201__U__GTPC_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_spare.encode_text(text_buf); single_value->field_n201UValue.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 @GTPC_Types.N201_U_GTPC."); } } void N201__U__GTPC_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; single_value->field_spare.decode_text(text_buf); single_value->field_n201UValue.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 N201__U__GTPC_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 @GTPC_Types.N201_U_GTPC."); } } void N201__U__GTPC_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: { N201__U__GTPC_template new_temp; new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size()); for (size_t p_i=0; p_i0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) n201UValue().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(), "spare")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "n201UValue")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { n201UValue().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.N201_U_GTPC: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { N201__U__GTPC_template* precondition = new N201__U__GTPC_template; precondition->set_param(*param.get_elem(0)); N201__U__GTPC_template* implied_template = new N201__U__GTPC_template; implied_template->set_param(*param.get_elem(1)); *this = N201__U__GTPC_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.N201_U_GTPC"); } is_ifpresent = param.get_ifpresent(); } void N201__U__GTPC_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_OMIT: if (template_selection==OMIT_VALUE) return; case TR_VALUE: if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break; single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.N201_U_GTPC"); single_value->field_n201UValue.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.N201_U_GTPC"); 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 : "@GTPC_Types.N201_U_GTPC"); } boolean N201__U__GTPC_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean N201__U__GTPC_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int l_idx=0; l_idx0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) n201IValue().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(), "spare")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "n201IValue")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { n201IValue().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.N201_I_GTPC: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.N201_I_GTPC"); } } void N201__I__GTPC::encode_text(Text_Buf& text_buf) const { field_spare.encode_text(text_buf); field_n201IValue.encode_text(text_buf); } void N201__I__GTPC::decode_text(Text_Buf& text_buf) { field_spare.decode_text(text_buf); field_n201IValue.decode_text(text_buf); } void N201__I__GTPC::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 N201__I__GTPC::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 N201__I__GTPC::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, N201__I__GTPC_spare_descr_.raw->forceomit); decoded_field_length = field_spare.RAW_decode(N201__I__GTPC_spare_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); RAW_Force_Omit field_1_force_omit(1, force_omit, N201__I__GTPC_n201IValue_descr_.raw->forceomit); decoded_field_length = field_n201IValue.RAW_decode(N201__I__GTPC_n201IValue_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 N201__I__GTPC::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, N201__I__GTPC_spare_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, N201__I__GTPC_n201IValue_descr_.raw); encoded_length += field_spare.RAW_encode(N201__I__GTPC_spare_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_n201IValue.RAW_encode(N201__I__GTPC_n201IValue_descr_, *myleaf.body.node.nodes[1]); return myleaf.length = encoded_length; } struct N201__I__GTPC_template::single_value_struct { BITSTRING_template field_spare; INTEGER_template field_n201IValue; }; void N201__I__GTPC_template::set_specific() { if (template_selection != SPECIFIC_VALUE) { template_sel old_selection = template_selection; clean_up(); single_value = new single_value_struct; set_selection(SPECIFIC_VALUE); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) { single_value->field_spare = ANY_VALUE; single_value->field_n201IValue = ANY_VALUE; } } } void N201__I__GTPC_template::copy_value(const N201__I__GTPC& other_value) { single_value = new single_value_struct; if (other_value.spare().is_bound()) { single_value->field_spare = other_value.spare(); } else { single_value->field_spare.clean_up(); } if (other_value.n201IValue().is_bound()) { single_value->field_n201IValue = other_value.n201IValue(); } else { single_value->field_n201IValue.clean_up(); } set_selection(SPECIFIC_VALUE); } void N201__I__GTPC_template::copy_template(const N201__I__GTPC_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.spare().get_selection()) { single_value->field_spare = other_value.spare(); } else { single_value->field_spare.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.n201IValue().get_selection()) { single_value->field_n201IValue = other_value.n201IValue(); } else { single_value->field_n201IValue.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 N201__I__GTPC_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 N201__I__GTPC_template(*other_value.implication_.precondition); implication_.implied_template = new N201__I__GTPC_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 @GTPC_Types.N201_I_GTPC."); break; } set_selection(other_value); } N201__I__GTPC_template::N201__I__GTPC_template() { } N201__I__GTPC_template::N201__I__GTPC_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } N201__I__GTPC_template::N201__I__GTPC_template(const N201__I__GTPC& other_value) { copy_value(other_value); } N201__I__GTPC_template::N201__I__GTPC_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const N201__I__GTPC&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.N201_I_GTPC from an unbound optional field."); } } N201__I__GTPC_template::N201__I__GTPC_template(N201__I__GTPC_template* p_precondition, N201__I__GTPC_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } N201__I__GTPC_template::N201__I__GTPC_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; } N201__I__GTPC_template::N201__I__GTPC_template(const N201__I__GTPC_template& other_value) : Base_Template() { copy_template(other_value); } N201__I__GTPC_template::~N201__I__GTPC_template() { clean_up(); } N201__I__GTPC_template& N201__I__GTPC_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } N201__I__GTPC_template& N201__I__GTPC_template::operator=(const N201__I__GTPC& other_value) { clean_up(); copy_value(other_value); return *this; } N201__I__GTPC_template& N201__I__GTPC_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const N201__I__GTPC&)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 @GTPC_Types.N201_I_GTPC."); } return *this; } N201__I__GTPC_template& N201__I__GTPC_template::operator=(const N201__I__GTPC_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean N201__I__GTPC_template::match(const N201__I__GTPC& other_value, boolean legacy) const { if (!other_value.is_bound()) return FALSE; switch (template_selection) { case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case OMIT_VALUE: return FALSE; case SPECIFIC_VALUE: if(!other_value.spare().is_bound()) return FALSE; if(!single_value->field_spare.match(other_value.spare(), legacy))return FALSE; if(!other_value.n201IValue().is_bound()) return FALSE; if(!single_value->field_n201IValue.match(other_value.n201IValue(), 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 @GTPC_Types.N201_I_GTPC."); } return FALSE; } boolean N201__I__GTPC_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_spare.is_bound() || single_value->field_n201IValue.is_bound(); } boolean N201__I__GTPC_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_spare.is_value() && single_value->field_n201IValue.is_value(); } void N201__I__GTPC_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; } N201__I__GTPC N201__I__GTPC_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 @GTPC_Types.N201_I_GTPC."); N201__I__GTPC ret_val; if (single_value->field_spare.is_bound()) { ret_val.spare() = single_value->field_spare.valueof(); } if (single_value->field_n201IValue.is_bound()) { ret_val.n201IValue() = single_value->field_n201IValue.valueof(); } return ret_val; } void N201__I__GTPC_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 @GTPC_Types.N201_I_GTPC."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new N201__I__GTPC_template[list_length]; } N201__I__GTPC_template& N201__I__GTPC_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 @GTPC_Types.N201_I_GTPC."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.N201_I_GTPC."); return value_list.list_value[list_index]; } BITSTRING_template& N201__I__GTPC_template::spare() { set_specific(); return single_value->field_spare; } const BITSTRING_template& N201__I__GTPC_template::spare() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field spare of a non-specific template of type @GTPC_Types.N201_I_GTPC."); return single_value->field_spare; } INTEGER_template& N201__I__GTPC_template::n201IValue() { set_specific(); return single_value->field_n201IValue; } const INTEGER_template& N201__I__GTPC_template::n201IValue() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field n201IValue of a non-specific template of type @GTPC_Types.N201_I_GTPC."); return single_value->field_n201IValue; } int N201__I__GTPC_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.N201_I_GTPC 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 @GTPC_Types.N201_I_GTPC 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 @GTPC_Types.N201_I_GTPC containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.N201_I_GTPC containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.N201_I_GTPC containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.N201_I_GTPC containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.N201_I_GTPC containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.N201_I_GTPC containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.N201_I_GTPC containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.N201_I_GTPC."); } return 0; } void N201__I__GTPC_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ spare := "); single_value->field_spare.log(); TTCN_Logger::log_event_str(", n201IValue := "); single_value->field_n201IValue.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 N201__I__GTPC_template::log_match(const N201__I__GTPC& match_value, boolean legacy) const { if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ if(match(match_value, legacy)){ TTCN_Logger::print_logmatch_buffer(); TTCN_Logger::log_event_str(" matched"); } else{ if (template_selection == SPECIFIC_VALUE) { size_t previous_size = TTCN_Logger::get_logmatch_buffer_len(); if(!single_value->field_spare.match(match_value.spare(), legacy)){ TTCN_Logger::log_logmatch_info(".spare"); single_value->field_spare.log_match(match_value.spare(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_n201IValue.match(match_value.n201IValue(), legacy)){ TTCN_Logger::log_logmatch_info(".n201IValue"); single_value->field_n201IValue.log_match(match_value.n201IValue(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } }else { TTCN_Logger::print_logmatch_buffer(); match_value.log(); TTCN_Logger::log_event_str(" with "); log(); TTCN_Logger::log_event_str(" unmatched"); } } return; } if (template_selection == SPECIFIC_VALUE) { TTCN_Logger::log_event_str("{ spare := "); single_value->field_spare.log_match(match_value.spare(), legacy); TTCN_Logger::log_event_str(", n201IValue := "); single_value->field_n201IValue.log_match(match_value.n201IValue(), 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 N201__I__GTPC_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_spare.encode_text(text_buf); single_value->field_n201IValue.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 @GTPC_Types.N201_I_GTPC."); } } void N201__I__GTPC_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; single_value->field_spare.decode_text(text_buf); single_value->field_n201IValue.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 N201__I__GTPC_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 @GTPC_Types.N201_I_GTPC."); } } void N201__I__GTPC_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: { N201__I__GTPC_template new_temp; new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size()); for (size_t p_i=0; p_i0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) n201IValue().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(), "spare")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "n201IValue")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { n201IValue().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.N201_I_GTPC: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { N201__I__GTPC_template* precondition = new N201__I__GTPC_template; precondition->set_param(*param.get_elem(0)); N201__I__GTPC_template* implied_template = new N201__I__GTPC_template; implied_template->set_param(*param.get_elem(1)); *this = N201__I__GTPC_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.N201_I_GTPC"); } is_ifpresent = param.get_ifpresent(); } void N201__I__GTPC_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_OMIT: if (template_selection==OMIT_VALUE) return; case TR_VALUE: if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break; single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.N201_I_GTPC"); single_value->field_n201IValue.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.N201_I_GTPC"); 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 : "@GTPC_Types.N201_I_GTPC"); } boolean N201__I__GTPC_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean N201__I__GTPC_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int l_idx=0; l_idx0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) mDValue().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(), "spare")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mDValue")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mDValue().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.MD_GTPC: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.MD_GTPC"); } } void MD__GTPC::encode_text(Text_Buf& text_buf) const { field_spare.encode_text(text_buf); field_mDValue.encode_text(text_buf); } void MD__GTPC::decode_text(Text_Buf& text_buf) { field_spare.decode_text(text_buf); field_mDValue.decode_text(text_buf); } void MD__GTPC::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 MD__GTPC::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 MD__GTPC::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, MD__GTPC_spare_descr_.raw->forceomit); decoded_field_length = field_spare.RAW_decode(MD__GTPC_spare_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); RAW_Force_Omit field_1_force_omit(1, force_omit, MD__GTPC_mDValue_descr_.raw->forceomit); decoded_field_length = field_mDValue.RAW_decode(MD__GTPC_mDValue_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 MD__GTPC::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, MD__GTPC_spare_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, MD__GTPC_mDValue_descr_.raw); encoded_length += field_spare.RAW_encode(MD__GTPC_spare_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_mDValue.RAW_encode(MD__GTPC_mDValue_descr_, *myleaf.body.node.nodes[1]); return myleaf.length = encoded_length; } struct MD__GTPC_template::single_value_struct { BITSTRING_template field_spare; INTEGER_template field_mDValue; }; void MD__GTPC_template::set_specific() { if (template_selection != SPECIFIC_VALUE) { template_sel old_selection = template_selection; clean_up(); single_value = new single_value_struct; set_selection(SPECIFIC_VALUE); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) { single_value->field_spare = ANY_VALUE; single_value->field_mDValue = ANY_VALUE; } } } void MD__GTPC_template::copy_value(const MD__GTPC& other_value) { single_value = new single_value_struct; if (other_value.spare().is_bound()) { single_value->field_spare = other_value.spare(); } else { single_value->field_spare.clean_up(); } if (other_value.mDValue().is_bound()) { single_value->field_mDValue = other_value.mDValue(); } else { single_value->field_mDValue.clean_up(); } set_selection(SPECIFIC_VALUE); } void MD__GTPC_template::copy_template(const MD__GTPC_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.spare().get_selection()) { single_value->field_spare = other_value.spare(); } else { single_value->field_spare.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.mDValue().get_selection()) { single_value->field_mDValue = other_value.mDValue(); } else { single_value->field_mDValue.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 MD__GTPC_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 MD__GTPC_template(*other_value.implication_.precondition); implication_.implied_template = new MD__GTPC_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 @GTPC_Types.MD_GTPC."); break; } set_selection(other_value); } MD__GTPC_template::MD__GTPC_template() { } MD__GTPC_template::MD__GTPC_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } MD__GTPC_template::MD__GTPC_template(const MD__GTPC& other_value) { copy_value(other_value); } MD__GTPC_template::MD__GTPC_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const MD__GTPC&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.MD_GTPC from an unbound optional field."); } } MD__GTPC_template::MD__GTPC_template(MD__GTPC_template* p_precondition, MD__GTPC_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } MD__GTPC_template::MD__GTPC_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; } MD__GTPC_template::MD__GTPC_template(const MD__GTPC_template& other_value) : Base_Template() { copy_template(other_value); } MD__GTPC_template::~MD__GTPC_template() { clean_up(); } MD__GTPC_template& MD__GTPC_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } MD__GTPC_template& MD__GTPC_template::operator=(const MD__GTPC& other_value) { clean_up(); copy_value(other_value); return *this; } MD__GTPC_template& MD__GTPC_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const MD__GTPC&)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 @GTPC_Types.MD_GTPC."); } return *this; } MD__GTPC_template& MD__GTPC_template::operator=(const MD__GTPC_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean MD__GTPC_template::match(const MD__GTPC& other_value, boolean legacy) const { if (!other_value.is_bound()) return FALSE; switch (template_selection) { case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case OMIT_VALUE: return FALSE; case SPECIFIC_VALUE: if(!other_value.spare().is_bound()) return FALSE; if(!single_value->field_spare.match(other_value.spare(), legacy))return FALSE; if(!other_value.mDValue().is_bound()) return FALSE; if(!single_value->field_mDValue.match(other_value.mDValue(), 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 @GTPC_Types.MD_GTPC."); } return FALSE; } boolean MD__GTPC_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_spare.is_bound() || single_value->field_mDValue.is_bound(); } boolean MD__GTPC_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_spare.is_value() && single_value->field_mDValue.is_value(); } void MD__GTPC_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; } MD__GTPC MD__GTPC_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 @GTPC_Types.MD_GTPC."); MD__GTPC ret_val; if (single_value->field_spare.is_bound()) { ret_val.spare() = single_value->field_spare.valueof(); } if (single_value->field_mDValue.is_bound()) { ret_val.mDValue() = single_value->field_mDValue.valueof(); } return ret_val; } void MD__GTPC_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 @GTPC_Types.MD_GTPC."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new MD__GTPC_template[list_length]; } MD__GTPC_template& MD__GTPC_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 @GTPC_Types.MD_GTPC."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.MD_GTPC."); return value_list.list_value[list_index]; } BITSTRING_template& MD__GTPC_template::spare() { set_specific(); return single_value->field_spare; } const BITSTRING_template& MD__GTPC_template::spare() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field spare of a non-specific template of type @GTPC_Types.MD_GTPC."); return single_value->field_spare; } INTEGER_template& MD__GTPC_template::mDValue() { set_specific(); return single_value->field_mDValue; } const INTEGER_template& MD__GTPC_template::mDValue() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field mDValue of a non-specific template of type @GTPC_Types.MD_GTPC."); return single_value->field_mDValue; } int MD__GTPC_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MD_GTPC 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 @GTPC_Types.MD_GTPC 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 @GTPC_Types.MD_GTPC containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MD_GTPC containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MD_GTPC containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MD_GTPC containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MD_GTPC containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MD_GTPC containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MD_GTPC containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.MD_GTPC."); } return 0; } void MD__GTPC_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ spare := "); single_value->field_spare.log(); TTCN_Logger::log_event_str(", mDValue := "); single_value->field_mDValue.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 MD__GTPC_template::log_match(const MD__GTPC& match_value, boolean legacy) const { if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ if(match(match_value, legacy)){ TTCN_Logger::print_logmatch_buffer(); TTCN_Logger::log_event_str(" matched"); } else{ if (template_selection == SPECIFIC_VALUE) { size_t previous_size = TTCN_Logger::get_logmatch_buffer_len(); if(!single_value->field_spare.match(match_value.spare(), legacy)){ TTCN_Logger::log_logmatch_info(".spare"); single_value->field_spare.log_match(match_value.spare(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_mDValue.match(match_value.mDValue(), legacy)){ TTCN_Logger::log_logmatch_info(".mDValue"); single_value->field_mDValue.log_match(match_value.mDValue(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } }else { TTCN_Logger::print_logmatch_buffer(); match_value.log(); TTCN_Logger::log_event_str(" with "); log(); TTCN_Logger::log_event_str(" unmatched"); } } return; } if (template_selection == SPECIFIC_VALUE) { TTCN_Logger::log_event_str("{ spare := "); single_value->field_spare.log_match(match_value.spare(), legacy); TTCN_Logger::log_event_str(", mDValue := "); single_value->field_mDValue.log_match(match_value.mDValue(), 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 MD__GTPC_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_spare.encode_text(text_buf); single_value->field_mDValue.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 @GTPC_Types.MD_GTPC."); } } void MD__GTPC_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; single_value->field_spare.decode_text(text_buf); single_value->field_mDValue.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 MD__GTPC_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 @GTPC_Types.MD_GTPC."); } } void MD__GTPC_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: { MD__GTPC_template new_temp; new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size()); for (size_t p_i=0; p_i0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) mDValue().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(), "spare")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mDValue")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mDValue().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.MD_GTPC: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { MD__GTPC_template* precondition = new MD__GTPC_template; precondition->set_param(*param.get_elem(0)); MD__GTPC_template* implied_template = new MD__GTPC_template; implied_template->set_param(*param.get_elem(1)); *this = MD__GTPC_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.MD_GTPC"); } is_ifpresent = param.get_ifpresent(); } void MD__GTPC_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_OMIT: if (template_selection==OMIT_VALUE) return; case TR_VALUE: if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break; single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.MD_GTPC"); single_value->field_mDValue.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.MD_GTPC"); 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 : "@GTPC_Types.MD_GTPC"); } boolean MD__GTPC_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean MD__GTPC_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int l_idx=0; l_idx0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) mUValue().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(), "spare")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mUValue")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mUValue().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.MU_GTPC: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.MU_GTPC"); } } void MU__GTPC::encode_text(Text_Buf& text_buf) const { field_spare.encode_text(text_buf); field_mUValue.encode_text(text_buf); } void MU__GTPC::decode_text(Text_Buf& text_buf) { field_spare.decode_text(text_buf); field_mUValue.decode_text(text_buf); } void MU__GTPC::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 MU__GTPC::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 MU__GTPC::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, MU__GTPC_spare_descr_.raw->forceomit); decoded_field_length = field_spare.RAW_decode(MU__GTPC_spare_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); RAW_Force_Omit field_1_force_omit(1, force_omit, MU__GTPC_mUValue_descr_.raw->forceomit); decoded_field_length = field_mUValue.RAW_decode(MU__GTPC_mUValue_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 MU__GTPC::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, MU__GTPC_spare_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, MU__GTPC_mUValue_descr_.raw); encoded_length += field_spare.RAW_encode(MU__GTPC_spare_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_mUValue.RAW_encode(MU__GTPC_mUValue_descr_, *myleaf.body.node.nodes[1]); return myleaf.length = encoded_length; } struct MU__GTPC_template::single_value_struct { BITSTRING_template field_spare; INTEGER_template field_mUValue; }; void MU__GTPC_template::set_specific() { if (template_selection != SPECIFIC_VALUE) { template_sel old_selection = template_selection; clean_up(); single_value = new single_value_struct; set_selection(SPECIFIC_VALUE); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) { single_value->field_spare = ANY_VALUE; single_value->field_mUValue = ANY_VALUE; } } } void MU__GTPC_template::copy_value(const MU__GTPC& other_value) { single_value = new single_value_struct; if (other_value.spare().is_bound()) { single_value->field_spare = other_value.spare(); } else { single_value->field_spare.clean_up(); } if (other_value.mUValue().is_bound()) { single_value->field_mUValue = other_value.mUValue(); } else { single_value->field_mUValue.clean_up(); } set_selection(SPECIFIC_VALUE); } void MU__GTPC_template::copy_template(const MU__GTPC_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.spare().get_selection()) { single_value->field_spare = other_value.spare(); } else { single_value->field_spare.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.mUValue().get_selection()) { single_value->field_mUValue = other_value.mUValue(); } else { single_value->field_mUValue.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 MU__GTPC_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 MU__GTPC_template(*other_value.implication_.precondition); implication_.implied_template = new MU__GTPC_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 @GTPC_Types.MU_GTPC."); break; } set_selection(other_value); } MU__GTPC_template::MU__GTPC_template() { } MU__GTPC_template::MU__GTPC_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } MU__GTPC_template::MU__GTPC_template(const MU__GTPC& other_value) { copy_value(other_value); } MU__GTPC_template::MU__GTPC_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const MU__GTPC&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.MU_GTPC from an unbound optional field."); } } MU__GTPC_template::MU__GTPC_template(MU__GTPC_template* p_precondition, MU__GTPC_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } MU__GTPC_template::MU__GTPC_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; } MU__GTPC_template::MU__GTPC_template(const MU__GTPC_template& other_value) : Base_Template() { copy_template(other_value); } MU__GTPC_template::~MU__GTPC_template() { clean_up(); } MU__GTPC_template& MU__GTPC_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } MU__GTPC_template& MU__GTPC_template::operator=(const MU__GTPC& other_value) { clean_up(); copy_value(other_value); return *this; } MU__GTPC_template& MU__GTPC_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const MU__GTPC&)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 @GTPC_Types.MU_GTPC."); } return *this; } MU__GTPC_template& MU__GTPC_template::operator=(const MU__GTPC_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean MU__GTPC_template::match(const MU__GTPC& other_value, boolean legacy) const { if (!other_value.is_bound()) return FALSE; switch (template_selection) { case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case OMIT_VALUE: return FALSE; case SPECIFIC_VALUE: if(!other_value.spare().is_bound()) return FALSE; if(!single_value->field_spare.match(other_value.spare(), legacy))return FALSE; if(!other_value.mUValue().is_bound()) return FALSE; if(!single_value->field_mUValue.match(other_value.mUValue(), 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 @GTPC_Types.MU_GTPC."); } return FALSE; } boolean MU__GTPC_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_spare.is_bound() || single_value->field_mUValue.is_bound(); } boolean MU__GTPC_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_spare.is_value() && single_value->field_mUValue.is_value(); } void MU__GTPC_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; } MU__GTPC MU__GTPC_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 @GTPC_Types.MU_GTPC."); MU__GTPC ret_val; if (single_value->field_spare.is_bound()) { ret_val.spare() = single_value->field_spare.valueof(); } if (single_value->field_mUValue.is_bound()) { ret_val.mUValue() = single_value->field_mUValue.valueof(); } return ret_val; } void MU__GTPC_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 @GTPC_Types.MU_GTPC."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new MU__GTPC_template[list_length]; } MU__GTPC_template& MU__GTPC_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 @GTPC_Types.MU_GTPC."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.MU_GTPC."); return value_list.list_value[list_index]; } BITSTRING_template& MU__GTPC_template::spare() { set_specific(); return single_value->field_spare; } const BITSTRING_template& MU__GTPC_template::spare() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field spare of a non-specific template of type @GTPC_Types.MU_GTPC."); return single_value->field_spare; } INTEGER_template& MU__GTPC_template::mUValue() { set_specific(); return single_value->field_mUValue; } const INTEGER_template& MU__GTPC_template::mUValue() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field mUValue of a non-specific template of type @GTPC_Types.MU_GTPC."); return single_value->field_mUValue; } int MU__GTPC_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MU_GTPC 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 @GTPC_Types.MU_GTPC 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 @GTPC_Types.MU_GTPC containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MU_GTPC containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MU_GTPC containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MU_GTPC containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MU_GTPC containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MU_GTPC containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MU_GTPC containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.MU_GTPC."); } return 0; } void MU__GTPC_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ spare := "); single_value->field_spare.log(); TTCN_Logger::log_event_str(", mUValue := "); single_value->field_mUValue.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 MU__GTPC_template::log_match(const MU__GTPC& match_value, boolean legacy) const { if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ if(match(match_value, legacy)){ TTCN_Logger::print_logmatch_buffer(); TTCN_Logger::log_event_str(" matched"); } else{ if (template_selection == SPECIFIC_VALUE) { size_t previous_size = TTCN_Logger::get_logmatch_buffer_len(); if(!single_value->field_spare.match(match_value.spare(), legacy)){ TTCN_Logger::log_logmatch_info(".spare"); single_value->field_spare.log_match(match_value.spare(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_mUValue.match(match_value.mUValue(), legacy)){ TTCN_Logger::log_logmatch_info(".mUValue"); single_value->field_mUValue.log_match(match_value.mUValue(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } }else { TTCN_Logger::print_logmatch_buffer(); match_value.log(); TTCN_Logger::log_event_str(" with "); log(); TTCN_Logger::log_event_str(" unmatched"); } } return; } if (template_selection == SPECIFIC_VALUE) { TTCN_Logger::log_event_str("{ spare := "); single_value->field_spare.log_match(match_value.spare(), legacy); TTCN_Logger::log_event_str(", mUValue := "); single_value->field_mUValue.log_match(match_value.mUValue(), 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 MU__GTPC_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_spare.encode_text(text_buf); single_value->field_mUValue.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 @GTPC_Types.MU_GTPC."); } } void MU__GTPC_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; single_value->field_spare.decode_text(text_buf); single_value->field_mUValue.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 MU__GTPC_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 @GTPC_Types.MU_GTPC."); } } void MU__GTPC_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: { MU__GTPC_template new_temp; new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size()); for (size_t p_i=0; p_i0 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) mUValue().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(), "spare")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mUValue")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mUValue().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.MU_GTPC: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { MU__GTPC_template* precondition = new MU__GTPC_template; precondition->set_param(*param.get_elem(0)); MU__GTPC_template* implied_template = new MU__GTPC_template; implied_template->set_param(*param.get_elem(1)); *this = MU__GTPC_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.MU_GTPC"); } is_ifpresent = param.get_ifpresent(); } void MU__GTPC_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_OMIT: if (template_selection==OMIT_VALUE) return; case TR_VALUE: if (template_selection!=SPECIFIC_VALUE || is_ifpresent) break; single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.MU_GTPC"); single_value->field_mUValue.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.MU_GTPC"); 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 : "@GTPC_Types.MU_GTPC"); } boolean MU__GTPC_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean MU__GTPC_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) xl().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) typefield().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) xID__length().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) xID__Data().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(), "xl")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { xl().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "typefield")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { typefield().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "xID_length")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { xID__length().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "xID_Data")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { xID__Data().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.XID_GTPC: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.XID_GTPC"); } } void XID__GTPC::encode_text(Text_Buf& text_buf) const { field_xl.encode_text(text_buf); field_typefield.encode_text(text_buf); field_xID__length.encode_text(text_buf); field_xID__Data.encode_text(text_buf); } void XID__GTPC::decode_text(Text_Buf& text_buf) { field_xl.decode_text(text_buf); field_typefield.decode_text(text_buf); field_xID__length.decode_text(text_buf); field_xID__Data.decode_text(text_buf); } void XID__GTPC::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 XID__GTPC::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 XID__GTPC::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, XID__GTPC_xl_descr_.raw->forceomit); decoded_field_length = field_xl.RAW_decode(XID__GTPC_xl_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, XID__GTPC_typefield_descr_.raw->forceomit); decoded_field_length = field_typefield.RAW_decode(XID__GTPC_typefield_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_xl == bs_24) selected_field = 0; else if (field_xl == bs_3) selected_field = 1; else selected_field = -1; RAW_Force_Omit field_2_force_omit(2, force_omit, XID__GTPC_xID__length_descr_.raw->forceomit); decoded_field_length = field_xID__length.RAW_decode(XID__GTPC_xID__length_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_xID__length.get_selection()) { case XID__length__GTPC::ALT_short__len: { INTEGER tmp1 = field_xID__length.short__len().convert_to_Integer(XID__length__GTPC_short__len_descr_); field_xID__length.short__len() = tmp1; value_of_length_field2 += tmp1.get_long_long_val() * 8; break; } case XID__length__GTPC::ALT_long__len: { INTEGER tmp2 = field_xID__length.long__len().convert_to_Integer(XID__length__GTPC_long__len_descr_); field_xID__length.long__len() = tmp2; value_of_length_field2 += tmp2.get_long_long_val() * 8; break; } default: value_of_length_field2 = 0; } if (field_typefield == bs_11) selected_field = 0; else if (field_typefield == bs_12) selected_field = 1; else if (field_typefield == bs_13) selected_field = 2; else if (field_typefield == bs_14) selected_field = 3; else if (field_typefield == bs_15) selected_field = 4; else if (field_typefield == bs_16) selected_field = 5; else if (field_typefield == bs_17) selected_field = 6; else if (field_typefield == bs_18) selected_field = 7; else if (field_typefield == bs_19) selected_field = 8; else if (field_typefield == bs_20) selected_field = 9; else if (field_typefield == bs_21) selected_field = 10; else if (field_typefield == bs_22) selected_field = 11; else if (field_typefield == bs_23) selected_field = 12; else selected_field = -1; RAW_Force_Omit field_3_force_omit(3, force_omit, XID__GTPC_xID__Data_descr_.raw->forceomit); decoded_field_length = field_xID__Data.RAW_decode(XID__GTPC_xID__Data_descr_, p_buf, min_of_ints(2, limit, value_of_length_field2), local_top_order, no_err, selected_field, 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 XID__GTPC::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, XID__GTPC_xl_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, XID__GTPC_typefield_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, XID__GTPC_xID__length_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, XID__GTPC_xID__Data_descr_.raw); encoded_length += field_xl.RAW_encode(XID__GTPC_xl_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_typefield.RAW_encode(XID__GTPC_typefield_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_xID__length.RAW_encode(XID__GTPC_xID__length_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_xID__Data.RAW_encode(XID__GTPC_xID__Data_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_xID__length.get_selection()) { case XID__length__GTPC::ALT_short__len: if (field_xl != bs_24) { RAW_enc_tr_pos pr_pos; pr_pos.level = myleaf.curr_pos.level + 1; int new_pos[] = { 0 }; pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos); RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos); if (temp_leaf != NULL) bs_24.RAW_encode(XID__GTPC_xl_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 XID__length__GTPC::ALT_long__len: if (field_xl != bs_3) { RAW_enc_tr_pos pr_pos; pr_pos.level = myleaf.curr_pos.level + 1; int new_pos[] = { 0 }; pr_pos.pos = init_new_tree_pos(myleaf.curr_pos, 1, new_pos); RAW_enc_tree* temp_leaf = myleaf.get_node(pr_pos); if (temp_leaf != NULL) bs_3.RAW_encode(XID__GTPC_xl_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:; } switch (field_xID__Data.get_selection()) { case XID__Data__GTPC::ALT_version: if (field_typefield != bs_11) { 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_11.RAW_encode(XID__GTPC_typefield_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 XID__Data__GTPC::ALT_iOV__UI: if (field_typefield != bs_12) { 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_12.RAW_encode(XID__GTPC_typefield_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 XID__Data__GTPC::ALT_iOV__I: if (field_typefield != bs_13) { 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_13.RAW_encode(XID__GTPC_typefield_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 XID__Data__GTPC::ALT_t200: if (field_typefield != bs_14) { 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_14.RAW_encode(XID__GTPC_typefield_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 XID__Data__GTPC::ALT_n200: if (field_typefield != bs_15) { 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_15.RAW_encode(XID__GTPC_typefield_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 XID__Data__GTPC::ALT_n201__U: if (field_typefield != bs_16) { 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_16.RAW_encode(XID__GTPC_typefield_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 XID__Data__GTPC::ALT_n201__I: if (field_typefield != bs_17) { 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_17.RAW_encode(XID__GTPC_typefield_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 XID__Data__GTPC::ALT_mD: if (field_typefield != bs_18) { 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_18.RAW_encode(XID__GTPC_typefield_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 XID__Data__GTPC::ALT_mU: if (field_typefield != bs_19) { 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_19.RAW_encode(XID__GTPC_typefield_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 XID__Data__GTPC::ALT_kD: if (field_typefield != bs_20) { 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_20.RAW_encode(XID__GTPC_typefield_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 XID__Data__GTPC::ALT_kU: if (field_typefield != bs_21) { 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_21.RAW_encode(XID__GTPC_typefield_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 XID__Data__GTPC::ALT_l3param: if (field_typefield != bs_22) { 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_22.RAW_encode(XID__GTPC_typefield_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 XID__Data__GTPC::ALT_reset: if (field_typefield != bs_23) { 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_23.RAW_encode(XID__GTPC_typefield_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 XID__GTPC_template::single_value_struct { BITSTRING_template field_xl; BITSTRING_template field_typefield; XID__length__GTPC_template field_xID__length; XID__Data__GTPC_template field_xID__Data; }; void XID__GTPC_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_xl = ANY_VALUE; single_value->field_typefield = ANY_VALUE; single_value->field_xID__length = ANY_VALUE; single_value->field_xID__Data = ANY_VALUE; } } } void XID__GTPC_template::copy_value(const XID__GTPC& other_value) { single_value = new single_value_struct; if (other_value.xl().is_bound()) { single_value->field_xl = other_value.xl(); } else { single_value->field_xl.clean_up(); } if (other_value.typefield().is_bound()) { single_value->field_typefield = other_value.typefield(); } else { single_value->field_typefield.clean_up(); } if (other_value.xID__length().is_bound()) { single_value->field_xID__length = other_value.xID__length(); } else { single_value->field_xID__length.clean_up(); } if (other_value.xID__Data().is_bound()) { single_value->field_xID__Data = other_value.xID__Data(); } else { single_value->field_xID__Data.clean_up(); } set_selection(SPECIFIC_VALUE); } void XID__GTPC_template::copy_template(const XID__GTPC_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.xl().get_selection()) { single_value->field_xl = other_value.xl(); } else { single_value->field_xl.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.typefield().get_selection()) { single_value->field_typefield = other_value.typefield(); } else { single_value->field_typefield.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.xID__length().get_selection()) { single_value->field_xID__length = other_value.xID__length(); } else { single_value->field_xID__length.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.xID__Data().get_selection()) { single_value->field_xID__Data = other_value.xID__Data(); } else { single_value->field_xID__Data.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 XID__GTPC_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 XID__GTPC_template(*other_value.implication_.precondition); implication_.implied_template = new XID__GTPC_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 @GTPC_Types.XID_GTPC."); break; } set_selection(other_value); } XID__GTPC_template::XID__GTPC_template() { } XID__GTPC_template::XID__GTPC_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } XID__GTPC_template::XID__GTPC_template(const XID__GTPC& other_value) { copy_value(other_value); } XID__GTPC_template::XID__GTPC_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const XID__GTPC&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.XID_GTPC from an unbound optional field."); } } XID__GTPC_template::XID__GTPC_template(XID__GTPC_template* p_precondition, XID__GTPC_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } XID__GTPC_template::XID__GTPC_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; } XID__GTPC_template::XID__GTPC_template(const XID__GTPC_template& other_value) : Base_Template() { copy_template(other_value); } XID__GTPC_template::~XID__GTPC_template() { clean_up(); } XID__GTPC_template& XID__GTPC_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } XID__GTPC_template& XID__GTPC_template::operator=(const XID__GTPC& other_value) { clean_up(); copy_value(other_value); return *this; } XID__GTPC_template& XID__GTPC_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const XID__GTPC&)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 @GTPC_Types.XID_GTPC."); } return *this; } XID__GTPC_template& XID__GTPC_template::operator=(const XID__GTPC_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean XID__GTPC_template::match(const XID__GTPC& 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.xl().is_bound()) return FALSE; if(!single_value->field_xl.match(other_value.xl(), legacy))return FALSE; if(!other_value.typefield().is_bound()) return FALSE; if(!single_value->field_typefield.match(other_value.typefield(), legacy))return FALSE; if(!other_value.xID__length().is_bound()) return FALSE; if(!single_value->field_xID__length.match(other_value.xID__length(), legacy))return FALSE; if(!other_value.xID__Data().is_bound()) return FALSE; if(!single_value->field_xID__Data.match(other_value.xID__Data(), 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 @GTPC_Types.XID_GTPC."); } return FALSE; } boolean XID__GTPC_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_xl.is_bound() || single_value->field_typefield.is_bound() || single_value->field_xID__length.is_bound() || single_value->field_xID__Data.is_bound(); } boolean XID__GTPC_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_xl.is_value() && single_value->field_typefield.is_value() && single_value->field_xID__length.is_value() && single_value->field_xID__Data.is_value(); } void XID__GTPC_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; } XID__GTPC XID__GTPC_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 @GTPC_Types.XID_GTPC."); XID__GTPC ret_val; if (single_value->field_xl.is_bound()) { ret_val.xl() = single_value->field_xl.valueof(); } if (single_value->field_typefield.is_bound()) { ret_val.typefield() = single_value->field_typefield.valueof(); } if (single_value->field_xID__length.is_bound()) { ret_val.xID__length() = single_value->field_xID__length.valueof(); } if (single_value->field_xID__Data.is_bound()) { ret_val.xID__Data() = single_value->field_xID__Data.valueof(); } return ret_val; } void XID__GTPC_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 @GTPC_Types.XID_GTPC."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new XID__GTPC_template[list_length]; } XID__GTPC_template& XID__GTPC_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 @GTPC_Types.XID_GTPC."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.XID_GTPC."); return value_list.list_value[list_index]; } BITSTRING_template& XID__GTPC_template::xl() { set_specific(); return single_value->field_xl; } const BITSTRING_template& XID__GTPC_template::xl() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field xl of a non-specific template of type @GTPC_Types.XID_GTPC."); return single_value->field_xl; } BITSTRING_template& XID__GTPC_template::typefield() { set_specific(); return single_value->field_typefield; } const BITSTRING_template& XID__GTPC_template::typefield() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field typefield of a non-specific template of type @GTPC_Types.XID_GTPC."); return single_value->field_typefield; } XID__length__GTPC_template& XID__GTPC_template::xID__length() { set_specific(); return single_value->field_xID__length; } const XID__length__GTPC_template& XID__GTPC_template::xID__length() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field xID_length of a non-specific template of type @GTPC_Types.XID_GTPC."); return single_value->field_xID__length; } XID__Data__GTPC_template& XID__GTPC_template::xID__Data() { set_specific(); return single_value->field_xID__Data; } const XID__Data__GTPC_template& XID__GTPC_template::xID__Data() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field xID_Data of a non-specific template of type @GTPC_Types.XID_GTPC."); return single_value->field_xID__Data; } int XID__GTPC_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.XID_GTPC 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 @GTPC_Types.XID_GTPC 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 @GTPC_Types.XID_GTPC containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.XID_GTPC containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.XID_GTPC containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.XID_GTPC containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.XID_GTPC containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.XID_GTPC containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.XID_GTPC containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.XID_GTPC."); } return 0; } void XID__GTPC_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ xl := "); single_value->field_xl.log(); TTCN_Logger::log_event_str(", typefield := "); single_value->field_typefield.log(); TTCN_Logger::log_event_str(", xID_length := "); single_value->field_xID__length.log(); TTCN_Logger::log_event_str(", xID_Data := "); single_value->field_xID__Data.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 XID__GTPC_template::log_match(const XID__GTPC& 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_xl.match(match_value.xl(), legacy)){ TTCN_Logger::log_logmatch_info(".xl"); single_value->field_xl.log_match(match_value.xl(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_typefield.match(match_value.typefield(), legacy)){ TTCN_Logger::log_logmatch_info(".typefield"); single_value->field_typefield.log_match(match_value.typefield(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_xID__length.match(match_value.xID__length(), legacy)){ TTCN_Logger::log_logmatch_info(".xID_length"); single_value->field_xID__length.log_match(match_value.xID__length(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_xID__Data.match(match_value.xID__Data(), legacy)){ TTCN_Logger::log_logmatch_info(".xID_Data"); single_value->field_xID__Data.log_match(match_value.xID__Data(), 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("{ xl := "); single_value->field_xl.log_match(match_value.xl(), legacy); TTCN_Logger::log_event_str(", typefield := "); single_value->field_typefield.log_match(match_value.typefield(), legacy); TTCN_Logger::log_event_str(", xID_length := "); single_value->field_xID__length.log_match(match_value.xID__length(), legacy); TTCN_Logger::log_event_str(", xID_Data := "); single_value->field_xID__Data.log_match(match_value.xID__Data(), 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 XID__GTPC_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_xl.encode_text(text_buf); single_value->field_typefield.encode_text(text_buf); single_value->field_xID__length.encode_text(text_buf); single_value->field_xID__Data.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 @GTPC_Types.XID_GTPC."); } } void XID__GTPC_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_xl.decode_text(text_buf); single_value->field_typefield.decode_text(text_buf); single_value->field_xID__length.decode_text(text_buf); single_value->field_xID__Data.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 XID__GTPC_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 @GTPC_Types.XID_GTPC."); } } void XID__GTPC_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: { XID__GTPC_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) xl().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) typefield().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) xID__length().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) xID__Data().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(), "xl")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { xl().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "typefield")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { typefield().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "xID_length")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { xID__length().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "xID_Data")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { xID__Data().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.XID_GTPC: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { XID__GTPC_template* precondition = new XID__GTPC_template; precondition->set_param(*param.get_elem(0)); XID__GTPC_template* implied_template = new XID__GTPC_template; implied_template->set_param(*param.get_elem(1)); *this = XID__GTPC_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.XID_GTPC"); } is_ifpresent = param.get_ifpresent(); } void XID__GTPC_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_xl.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.XID_GTPC"); single_value->field_typefield.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.XID_GTPC"); single_value->field_xID__length.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.XID_GTPC"); single_value->field_xID__Data.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.XID_GTPC"); 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 : "@GTPC_Types.XID_GTPC"); } boolean XID__GTPC_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean XID__GTPC_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) actionfield().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "actionfield")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { actionfield().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.MS_InfoChangeReportingAction: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.MS_InfoChangeReportingAction"); } } void MS__InfoChangeReportingAction::encode_text(Text_Buf& text_buf) const { field_type__gtpc.encode_text(text_buf); field_lengthf.encode_text(text_buf); field_actionfield.encode_text(text_buf); } void MS__InfoChangeReportingAction::decode_text(Text_Buf& text_buf) { field_type__gtpc.decode_text(text_buf); field_lengthf.decode_text(text_buf); field_actionfield.decode_text(text_buf); } void MS__InfoChangeReportingAction::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 MS__InfoChangeReportingAction::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 MS__InfoChangeReportingAction::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; int value_of_length_field1 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_type__gtpc.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, MS__InfoChangeReportingAction_lengthf_descr_.raw->forceomit); decoded_field_length = field_lengthf.RAW_decode(MS__InfoChangeReportingAction_lengthf_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()); INTEGER tmp1 = field_lengthf.convert_to_Integer(MS__InfoChangeReportingAction_lengthf_descr_); field_lengthf = tmp1; value_of_length_field1 += tmp1.get_long_long_val() * 8; RAW_Force_Omit field_2_force_omit(2, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_actionfield.RAW_decode(General__Types::OCT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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()); value_of_length_field1 -= decoded_field_length; if (field_type__gtpc != os_42) return -1; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int MS__InfoChangeReportingAction::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, MS__InfoChangeReportingAction_lengthf_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, General__Types::OCT1_descr_.raw); encoded_length += field_type__gtpc.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += 16; myleaf.body.node.nodes[1]->calc = CALC_LENGTH; myleaf.body.node.nodes[1]->coding_descr = &MS__InfoChangeReportingAction_lengthf_descr_; myleaf.body.node.nodes[1]->calcof.lengthto.num_of_fields = 1; myleaf.body.node.nodes[1]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[1]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields = init_lengthto_fields_list(1); myleaf.body.node.nodes[1]->length = 16; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[2]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[2]->curr_pos.pos; encoded_length += field_actionfield.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[2]); if (field_type__gtpc != os_42) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={0}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ os_42.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 MS__InfoChangeReportingAction_template::single_value_struct { OCTETSTRING_template field_type__gtpc; INTEGER_template field_lengthf; OCTETSTRING_template field_actionfield; }; void MS__InfoChangeReportingAction_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_type__gtpc = ANY_VALUE; single_value->field_lengthf = ANY_VALUE; single_value->field_actionfield = ANY_VALUE; } } } void MS__InfoChangeReportingAction_template::copy_value(const MS__InfoChangeReportingAction& other_value) { single_value = new single_value_struct; if (other_value.type__gtpc().is_bound()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (other_value.lengthf().is_bound()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (other_value.actionfield().is_bound()) { single_value->field_actionfield = other_value.actionfield(); } else { single_value->field_actionfield.clean_up(); } set_selection(SPECIFIC_VALUE); } void MS__InfoChangeReportingAction_template::copy_template(const MS__InfoChangeReportingAction_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.type__gtpc().get_selection()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lengthf().get_selection()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.actionfield().get_selection()) { single_value->field_actionfield = other_value.actionfield(); } else { single_value->field_actionfield.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 MS__InfoChangeReportingAction_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 MS__InfoChangeReportingAction_template(*other_value.implication_.precondition); implication_.implied_template = new MS__InfoChangeReportingAction_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 @GTPC_Types.MS_InfoChangeReportingAction."); break; } set_selection(other_value); } MS__InfoChangeReportingAction_template::MS__InfoChangeReportingAction_template() { } MS__InfoChangeReportingAction_template::MS__InfoChangeReportingAction_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } MS__InfoChangeReportingAction_template::MS__InfoChangeReportingAction_template(const MS__InfoChangeReportingAction& other_value) { copy_value(other_value); } MS__InfoChangeReportingAction_template::MS__InfoChangeReportingAction_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const MS__InfoChangeReportingAction&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.MS_InfoChangeReportingAction from an unbound optional field."); } } MS__InfoChangeReportingAction_template::MS__InfoChangeReportingAction_template(MS__InfoChangeReportingAction_template* p_precondition, MS__InfoChangeReportingAction_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } MS__InfoChangeReportingAction_template::MS__InfoChangeReportingAction_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; } MS__InfoChangeReportingAction_template::MS__InfoChangeReportingAction_template(const MS__InfoChangeReportingAction_template& other_value) : Base_Template() { copy_template(other_value); } MS__InfoChangeReportingAction_template::~MS__InfoChangeReportingAction_template() { clean_up(); } MS__InfoChangeReportingAction_template& MS__InfoChangeReportingAction_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } MS__InfoChangeReportingAction_template& MS__InfoChangeReportingAction_template::operator=(const MS__InfoChangeReportingAction& other_value) { clean_up(); copy_value(other_value); return *this; } MS__InfoChangeReportingAction_template& MS__InfoChangeReportingAction_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const MS__InfoChangeReportingAction&)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 @GTPC_Types.MS_InfoChangeReportingAction."); } return *this; } MS__InfoChangeReportingAction_template& MS__InfoChangeReportingAction_template::operator=(const MS__InfoChangeReportingAction_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean MS__InfoChangeReportingAction_template::match(const MS__InfoChangeReportingAction& 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.type__gtpc().is_bound()) return FALSE; if(!single_value->field_type__gtpc.match(other_value.type__gtpc(), legacy))return FALSE; if(!other_value.lengthf().is_bound()) return FALSE; if(!single_value->field_lengthf.match(other_value.lengthf(), legacy))return FALSE; if(!other_value.actionfield().is_bound()) return FALSE; if(!single_value->field_actionfield.match(other_value.actionfield(), 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 @GTPC_Types.MS_InfoChangeReportingAction."); } return FALSE; } boolean MS__InfoChangeReportingAction_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_type__gtpc.is_bound() || single_value->field_lengthf.is_bound() || single_value->field_actionfield.is_bound(); } boolean MS__InfoChangeReportingAction_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_type__gtpc.is_value() && single_value->field_lengthf.is_value() && single_value->field_actionfield.is_value(); } void MS__InfoChangeReportingAction_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; } MS__InfoChangeReportingAction MS__InfoChangeReportingAction_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 @GTPC_Types.MS_InfoChangeReportingAction."); MS__InfoChangeReportingAction ret_val; if (single_value->field_type__gtpc.is_bound()) { ret_val.type__gtpc() = single_value->field_type__gtpc.valueof(); } if (single_value->field_lengthf.is_bound()) { ret_val.lengthf() = single_value->field_lengthf.valueof(); } if (single_value->field_actionfield.is_bound()) { ret_val.actionfield() = single_value->field_actionfield.valueof(); } return ret_val; } void MS__InfoChangeReportingAction_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 @GTPC_Types.MS_InfoChangeReportingAction."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new MS__InfoChangeReportingAction_template[list_length]; } MS__InfoChangeReportingAction_template& MS__InfoChangeReportingAction_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 @GTPC_Types.MS_InfoChangeReportingAction."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.MS_InfoChangeReportingAction."); return value_list.list_value[list_index]; } OCTETSTRING_template& MS__InfoChangeReportingAction_template::type__gtpc() { set_specific(); return single_value->field_type__gtpc; } const OCTETSTRING_template& MS__InfoChangeReportingAction_template::type__gtpc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field type_gtpc of a non-specific template of type @GTPC_Types.MS_InfoChangeReportingAction."); return single_value->field_type__gtpc; } INTEGER_template& MS__InfoChangeReportingAction_template::lengthf() { set_specific(); return single_value->field_lengthf; } const INTEGER_template& MS__InfoChangeReportingAction_template::lengthf() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthf of a non-specific template of type @GTPC_Types.MS_InfoChangeReportingAction."); return single_value->field_lengthf; } OCTETSTRING_template& MS__InfoChangeReportingAction_template::actionfield() { set_specific(); return single_value->field_actionfield; } const OCTETSTRING_template& MS__InfoChangeReportingAction_template::actionfield() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field actionfield of a non-specific template of type @GTPC_Types.MS_InfoChangeReportingAction."); return single_value->field_actionfield; } int MS__InfoChangeReportingAction_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MS_InfoChangeReportingAction 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 @GTPC_Types.MS_InfoChangeReportingAction 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 @GTPC_Types.MS_InfoChangeReportingAction containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MS_InfoChangeReportingAction containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MS_InfoChangeReportingAction containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MS_InfoChangeReportingAction containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MS_InfoChangeReportingAction containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MS_InfoChangeReportingAction containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MS_InfoChangeReportingAction containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.MS_InfoChangeReportingAction."); } return 0; } void MS__InfoChangeReportingAction_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ type_gtpc := "); single_value->field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log(); TTCN_Logger::log_event_str(", actionfield := "); single_value->field_actionfield.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 MS__InfoChangeReportingAction_template::log_match(const MS__InfoChangeReportingAction& 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_type__gtpc.match(match_value.type__gtpc(), legacy)){ TTCN_Logger::log_logmatch_info(".type_gtpc"); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lengthf.match(match_value.lengthf(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthf"); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_actionfield.match(match_value.actionfield(), legacy)){ TTCN_Logger::log_logmatch_info(".actionfield"); single_value->field_actionfield.log_match(match_value.actionfield(), 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("{ type_gtpc := "); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::log_event_str(", actionfield := "); single_value->field_actionfield.log_match(match_value.actionfield(), 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 MS__InfoChangeReportingAction_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_type__gtpc.encode_text(text_buf); single_value->field_lengthf.encode_text(text_buf); single_value->field_actionfield.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 @GTPC_Types.MS_InfoChangeReportingAction."); } } void MS__InfoChangeReportingAction_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_type__gtpc.decode_text(text_buf); single_value->field_lengthf.decode_text(text_buf); single_value->field_actionfield.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 MS__InfoChangeReportingAction_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 @GTPC_Types.MS_InfoChangeReportingAction."); } } void MS__InfoChangeReportingAction_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: { MS__InfoChangeReportingAction_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) actionfield().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "actionfield")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { actionfield().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.MS_InfoChangeReportingAction: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { MS__InfoChangeReportingAction_template* precondition = new MS__InfoChangeReportingAction_template; precondition->set_param(*param.get_elem(0)); MS__InfoChangeReportingAction_template* implied_template = new MS__InfoChangeReportingAction_template; implied_template->set_param(*param.get_elem(1)); *this = MS__InfoChangeReportingAction_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.MS_InfoChangeReportingAction"); } is_ifpresent = param.get_ifpresent(); } void MS__InfoChangeReportingAction_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_type__gtpc.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.MS_InfoChangeReportingAction"); single_value->field_lengthf.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.MS_InfoChangeReportingAction"); single_value->field_actionfield.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.MS_InfoChangeReportingAction"); 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 : "@GTPC_Types.MS_InfoChangeReportingAction"); } boolean MS__InfoChangeReportingAction_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean MS__InfoChangeReportingAction_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) dTI().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) gCSI().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) eI().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) spare().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "dTI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { dTI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "gCSI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { gCSI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "eI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { eI().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 @GTPC_Types.DirectTunnelFlags: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.DirectTunnelFlags"); } } void DirectTunnelFlags::encode_text(Text_Buf& text_buf) const { field_type__gtpc.encode_text(text_buf); field_lengthf.encode_text(text_buf); field_dTI.encode_text(text_buf); field_gCSI.encode_text(text_buf); field_eI.encode_text(text_buf); field_spare.encode_text(text_buf); } void DirectTunnelFlags::decode_text(Text_Buf& text_buf) { field_type__gtpc.decode_text(text_buf); field_lengthf.decode_text(text_buf); field_dTI.decode_text(text_buf); field_gCSI.decode_text(text_buf); field_eI.decode_text(text_buf); field_spare.decode_text(text_buf); } void DirectTunnelFlags::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 DirectTunnelFlags::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 DirectTunnelFlags::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; int value_of_length_field1 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_type__gtpc.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, DirectTunnelFlags_lengthf_descr_.raw->forceomit); decoded_field_length = field_lengthf.RAW_decode(DirectTunnelFlags_lengthf_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()); INTEGER tmp1 = field_lengthf.convert_to_Integer(DirectTunnelFlags_lengthf_descr_); field_lengthf = tmp1; value_of_length_field1 += tmp1.get_long_long_val() * 8; RAW_Force_Omit field_2_force_omit(2, force_omit, General__Types::BIT1_descr_.raw->forceomit); decoded_field_length = field_dTI.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::BIT1_descr_.raw->forceomit); decoded_field_length = field_gCSI.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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_field1 -= decoded_field_length; RAW_Force_Omit field_4_force_omit(4, force_omit, General__Types::BIT1_descr_.raw->forceomit); decoded_field_length = field_eI.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, no_err, -1, TRUE, &field_4_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_5_force_omit(5, force_omit, General__Types::BIT5_descr_.raw->forceomit); decoded_field_length = field_spare.RAW_decode(General__Types::BIT5_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, no_err, -1, TRUE, &field_5_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); value_of_length_field1 -= decoded_field_length; if (field_type__gtpc != os_46) return -1; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int DirectTunnelFlags::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, DirectTunnelFlags_lengthf_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, General__Types::BIT1_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::BIT1_descr_.raw); myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, General__Types::BIT1_descr_.raw); myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, General__Types::BIT5_descr_.raw); encoded_length += field_type__gtpc.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += 16; myleaf.body.node.nodes[1]->calc = CALC_LENGTH; myleaf.body.node.nodes[1]->coding_descr = &DirectTunnelFlags_lengthf_descr_; myleaf.body.node.nodes[1]->calcof.lengthto.num_of_fields = 4; myleaf.body.node.nodes[1]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[1]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields = init_lengthto_fields_list(4); myleaf.body.node.nodes[1]->length = 16; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[2]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[2]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].level = myleaf.body.node.nodes[3]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].pos = myleaf.body.node.nodes[3]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].level = myleaf.body.node.nodes[4]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].pos = myleaf.body.node.nodes[4]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[3].level = myleaf.body.node.nodes[5]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[3].pos = myleaf.body.node.nodes[5]->curr_pos.pos; encoded_length += field_dTI.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_gCSI.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[3]); encoded_length += field_eI.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[4]); encoded_length += field_spare.RAW_encode(General__Types::BIT5_descr_, *myleaf.body.node.nodes[5]); if (field_type__gtpc != os_46) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={0}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ os_46.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 DirectTunnelFlags_template::single_value_struct { OCTETSTRING_template field_type__gtpc; INTEGER_template field_lengthf; BITSTRING_template field_dTI; BITSTRING_template field_gCSI; BITSTRING_template field_eI; BITSTRING_template field_spare; }; void DirectTunnelFlags_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_type__gtpc = ANY_VALUE; single_value->field_lengthf = ANY_VALUE; single_value->field_dTI = ANY_VALUE; single_value->field_gCSI = ANY_VALUE; single_value->field_eI = ANY_VALUE; single_value->field_spare = ANY_VALUE; } } } void DirectTunnelFlags_template::copy_value(const DirectTunnelFlags& other_value) { single_value = new single_value_struct; if (other_value.type__gtpc().is_bound()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (other_value.lengthf().is_bound()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (other_value.dTI().is_bound()) { single_value->field_dTI = other_value.dTI(); } else { single_value->field_dTI.clean_up(); } if (other_value.gCSI().is_bound()) { single_value->field_gCSI = other_value.gCSI(); } else { single_value->field_gCSI.clean_up(); } if (other_value.eI().is_bound()) { single_value->field_eI = other_value.eI(); } else { single_value->field_eI.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 DirectTunnelFlags_template::copy_template(const DirectTunnelFlags_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.type__gtpc().get_selection()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lengthf().get_selection()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.dTI().get_selection()) { single_value->field_dTI = other_value.dTI(); } else { single_value->field_dTI.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.gCSI().get_selection()) { single_value->field_gCSI = other_value.gCSI(); } else { single_value->field_gCSI.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.eI().get_selection()) { single_value->field_eI = other_value.eI(); } else { single_value->field_eI.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 DirectTunnelFlags_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 DirectTunnelFlags_template(*other_value.implication_.precondition); implication_.implied_template = new DirectTunnelFlags_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 @GTPC_Types.DirectTunnelFlags."); break; } set_selection(other_value); } DirectTunnelFlags_template::DirectTunnelFlags_template() { } DirectTunnelFlags_template::DirectTunnelFlags_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } DirectTunnelFlags_template::DirectTunnelFlags_template(const DirectTunnelFlags& other_value) { copy_value(other_value); } DirectTunnelFlags_template::DirectTunnelFlags_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const DirectTunnelFlags&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.DirectTunnelFlags from an unbound optional field."); } } DirectTunnelFlags_template::DirectTunnelFlags_template(DirectTunnelFlags_template* p_precondition, DirectTunnelFlags_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } DirectTunnelFlags_template::DirectTunnelFlags_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; } DirectTunnelFlags_template::DirectTunnelFlags_template(const DirectTunnelFlags_template& other_value) : Base_Template() { copy_template(other_value); } DirectTunnelFlags_template::~DirectTunnelFlags_template() { clean_up(); } DirectTunnelFlags_template& DirectTunnelFlags_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } DirectTunnelFlags_template& DirectTunnelFlags_template::operator=(const DirectTunnelFlags& other_value) { clean_up(); copy_value(other_value); return *this; } DirectTunnelFlags_template& DirectTunnelFlags_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const DirectTunnelFlags&)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 @GTPC_Types.DirectTunnelFlags."); } return *this; } DirectTunnelFlags_template& DirectTunnelFlags_template::operator=(const DirectTunnelFlags_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean DirectTunnelFlags_template::match(const DirectTunnelFlags& 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.type__gtpc().is_bound()) return FALSE; if(!single_value->field_type__gtpc.match(other_value.type__gtpc(), legacy))return FALSE; if(!other_value.lengthf().is_bound()) return FALSE; if(!single_value->field_lengthf.match(other_value.lengthf(), legacy))return FALSE; if(!other_value.dTI().is_bound()) return FALSE; if(!single_value->field_dTI.match(other_value.dTI(), legacy))return FALSE; if(!other_value.gCSI().is_bound()) return FALSE; if(!single_value->field_gCSI.match(other_value.gCSI(), legacy))return FALSE; if(!other_value.eI().is_bound()) return FALSE; if(!single_value->field_eI.match(other_value.eI(), 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 @GTPC_Types.DirectTunnelFlags."); } return FALSE; } boolean DirectTunnelFlags_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_type__gtpc.is_bound() || single_value->field_lengthf.is_bound() || single_value->field_dTI.is_bound() || single_value->field_gCSI.is_bound() || single_value->field_eI.is_bound() || single_value->field_spare.is_bound(); } boolean DirectTunnelFlags_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_type__gtpc.is_value() && single_value->field_lengthf.is_value() && single_value->field_dTI.is_value() && single_value->field_gCSI.is_value() && single_value->field_eI.is_value() && single_value->field_spare.is_value(); } void DirectTunnelFlags_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; } DirectTunnelFlags DirectTunnelFlags_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 @GTPC_Types.DirectTunnelFlags."); DirectTunnelFlags ret_val; if (single_value->field_type__gtpc.is_bound()) { ret_val.type__gtpc() = single_value->field_type__gtpc.valueof(); } if (single_value->field_lengthf.is_bound()) { ret_val.lengthf() = single_value->field_lengthf.valueof(); } if (single_value->field_dTI.is_bound()) { ret_val.dTI() = single_value->field_dTI.valueof(); } if (single_value->field_gCSI.is_bound()) { ret_val.gCSI() = single_value->field_gCSI.valueof(); } if (single_value->field_eI.is_bound()) { ret_val.eI() = single_value->field_eI.valueof(); } if (single_value->field_spare.is_bound()) { ret_val.spare() = single_value->field_spare.valueof(); } return ret_val; } void DirectTunnelFlags_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 @GTPC_Types.DirectTunnelFlags."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new DirectTunnelFlags_template[list_length]; } DirectTunnelFlags_template& DirectTunnelFlags_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 @GTPC_Types.DirectTunnelFlags."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.DirectTunnelFlags."); return value_list.list_value[list_index]; } OCTETSTRING_template& DirectTunnelFlags_template::type__gtpc() { set_specific(); return single_value->field_type__gtpc; } const OCTETSTRING_template& DirectTunnelFlags_template::type__gtpc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field type_gtpc of a non-specific template of type @GTPC_Types.DirectTunnelFlags."); return single_value->field_type__gtpc; } INTEGER_template& DirectTunnelFlags_template::lengthf() { set_specific(); return single_value->field_lengthf; } const INTEGER_template& DirectTunnelFlags_template::lengthf() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthf of a non-specific template of type @GTPC_Types.DirectTunnelFlags."); return single_value->field_lengthf; } BITSTRING_template& DirectTunnelFlags_template::dTI() { set_specific(); return single_value->field_dTI; } const BITSTRING_template& DirectTunnelFlags_template::dTI() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field dTI of a non-specific template of type @GTPC_Types.DirectTunnelFlags."); return single_value->field_dTI; } BITSTRING_template& DirectTunnelFlags_template::gCSI() { set_specific(); return single_value->field_gCSI; } const BITSTRING_template& DirectTunnelFlags_template::gCSI() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field gCSI of a non-specific template of type @GTPC_Types.DirectTunnelFlags."); return single_value->field_gCSI; } BITSTRING_template& DirectTunnelFlags_template::eI() { set_specific(); return single_value->field_eI; } const BITSTRING_template& DirectTunnelFlags_template::eI() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field eI of a non-specific template of type @GTPC_Types.DirectTunnelFlags."); return single_value->field_eI; } BITSTRING_template& DirectTunnelFlags_template::spare() { set_specific(); return single_value->field_spare; } const BITSTRING_template& DirectTunnelFlags_template::spare() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field spare of a non-specific template of type @GTPC_Types.DirectTunnelFlags."); return single_value->field_spare; } int DirectTunnelFlags_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.DirectTunnelFlags which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 6; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @GTPC_Types.DirectTunnelFlags 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 @GTPC_Types.DirectTunnelFlags containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.DirectTunnelFlags containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.DirectTunnelFlags containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.DirectTunnelFlags containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.DirectTunnelFlags containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.DirectTunnelFlags containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.DirectTunnelFlags containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.DirectTunnelFlags."); } return 0; } void DirectTunnelFlags_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ type_gtpc := "); single_value->field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log(); TTCN_Logger::log_event_str(", dTI := "); single_value->field_dTI.log(); TTCN_Logger::log_event_str(", gCSI := "); single_value->field_gCSI.log(); TTCN_Logger::log_event_str(", eI := "); single_value->field_eI.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 DirectTunnelFlags_template::log_match(const DirectTunnelFlags& 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_type__gtpc.match(match_value.type__gtpc(), legacy)){ TTCN_Logger::log_logmatch_info(".type_gtpc"); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lengthf.match(match_value.lengthf(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthf"); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_dTI.match(match_value.dTI(), legacy)){ TTCN_Logger::log_logmatch_info(".dTI"); single_value->field_dTI.log_match(match_value.dTI(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_gCSI.match(match_value.gCSI(), legacy)){ TTCN_Logger::log_logmatch_info(".gCSI"); single_value->field_gCSI.log_match(match_value.gCSI(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_eI.match(match_value.eI(), legacy)){ TTCN_Logger::log_logmatch_info(".eI"); single_value->field_eI.log_match(match_value.eI(), 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("{ type_gtpc := "); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::log_event_str(", dTI := "); single_value->field_dTI.log_match(match_value.dTI(), legacy); TTCN_Logger::log_event_str(", gCSI := "); single_value->field_gCSI.log_match(match_value.gCSI(), legacy); TTCN_Logger::log_event_str(", eI := "); single_value->field_eI.log_match(match_value.eI(), 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 DirectTunnelFlags_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_type__gtpc.encode_text(text_buf); single_value->field_lengthf.encode_text(text_buf); single_value->field_dTI.encode_text(text_buf); single_value->field_gCSI.encode_text(text_buf); single_value->field_eI.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 @GTPC_Types.DirectTunnelFlags."); } } void DirectTunnelFlags_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_type__gtpc.decode_text(text_buf); single_value->field_lengthf.decode_text(text_buf); single_value->field_dTI.decode_text(text_buf); single_value->field_gCSI.decode_text(text_buf); single_value->field_eI.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 DirectTunnelFlags_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 @GTPC_Types.DirectTunnelFlags."); } } void DirectTunnelFlags_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: { DirectTunnelFlags_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) dTI().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) gCSI().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) eI().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) spare().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "dTI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { dTI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "gCSI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { gCSI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "eI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { eI().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 @GTPC_Types.DirectTunnelFlags: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { DirectTunnelFlags_template* precondition = new DirectTunnelFlags_template; precondition->set_param(*param.get_elem(0)); DirectTunnelFlags_template* implied_template = new DirectTunnelFlags_template; implied_template->set_param(*param.get_elem(1)); *this = DirectTunnelFlags_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.DirectTunnelFlags"); } is_ifpresent = param.get_ifpresent(); } void DirectTunnelFlags_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_type__gtpc.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.DirectTunnelFlags"); single_value->field_lengthf.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.DirectTunnelFlags"); single_value->field_dTI.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.DirectTunnelFlags"); single_value->field_gCSI.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.DirectTunnelFlags"); single_value->field_eI.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.DirectTunnelFlags"); single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.DirectTunnelFlags"); 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 : "@GTPC_Types.DirectTunnelFlags"); } boolean DirectTunnelFlags_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean DirectTunnelFlags_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) correlationIDValue().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "correlationIDValue")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { correlationIDValue().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.CorrelationID: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.CorrelationID"); } } void CorrelationID::encode_text(Text_Buf& text_buf) const { field_type__gtpc.encode_text(text_buf); field_lengthf.encode_text(text_buf); field_correlationIDValue.encode_text(text_buf); } void CorrelationID::decode_text(Text_Buf& text_buf) { field_type__gtpc.decode_text(text_buf); field_lengthf.decode_text(text_buf); field_correlationIDValue.decode_text(text_buf); } void CorrelationID::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 CorrelationID::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 CorrelationID::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; int value_of_length_field1 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_type__gtpc.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, CorrelationID_lengthf_descr_.raw->forceomit); decoded_field_length = field_lengthf.RAW_decode(CorrelationID_lengthf_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()); INTEGER tmp1 = field_lengthf.convert_to_Integer(CorrelationID_lengthf_descr_); field_lengthf = tmp1; value_of_length_field1 += tmp1.get_long_long_val() * 8; RAW_Force_Omit field_2_force_omit(2, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_correlationIDValue.RAW_decode(General__Types::OCT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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()); value_of_length_field1 -= decoded_field_length; if (field_type__gtpc != os_33) return -1; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int CorrelationID::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, CorrelationID_lengthf_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, General__Types::OCT1_descr_.raw); encoded_length += field_type__gtpc.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += 16; myleaf.body.node.nodes[1]->calc = CALC_LENGTH; myleaf.body.node.nodes[1]->coding_descr = &CorrelationID_lengthf_descr_; myleaf.body.node.nodes[1]->calcof.lengthto.num_of_fields = 1; myleaf.body.node.nodes[1]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[1]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields = init_lengthto_fields_list(1); myleaf.body.node.nodes[1]->length = 16; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[2]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[2]->curr_pos.pos; encoded_length += field_correlationIDValue.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[2]); if (field_type__gtpc != os_33) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={0}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ os_33.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 CorrelationID_template::single_value_struct { OCTETSTRING_template field_type__gtpc; INTEGER_template field_lengthf; OCTETSTRING_template field_correlationIDValue; }; void CorrelationID_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_type__gtpc = ANY_VALUE; single_value->field_lengthf = ANY_VALUE; single_value->field_correlationIDValue = ANY_VALUE; } } } void CorrelationID_template::copy_value(const CorrelationID& other_value) { single_value = new single_value_struct; if (other_value.type__gtpc().is_bound()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (other_value.lengthf().is_bound()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (other_value.correlationIDValue().is_bound()) { single_value->field_correlationIDValue = other_value.correlationIDValue(); } else { single_value->field_correlationIDValue.clean_up(); } set_selection(SPECIFIC_VALUE); } void CorrelationID_template::copy_template(const CorrelationID_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.type__gtpc().get_selection()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lengthf().get_selection()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.correlationIDValue().get_selection()) { single_value->field_correlationIDValue = other_value.correlationIDValue(); } else { single_value->field_correlationIDValue.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 CorrelationID_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 CorrelationID_template(*other_value.implication_.precondition); implication_.implied_template = new CorrelationID_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 @GTPC_Types.CorrelationID."); break; } set_selection(other_value); } CorrelationID_template::CorrelationID_template() { } CorrelationID_template::CorrelationID_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } CorrelationID_template::CorrelationID_template(const CorrelationID& other_value) { copy_value(other_value); } CorrelationID_template::CorrelationID_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const CorrelationID&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.CorrelationID from an unbound optional field."); } } CorrelationID_template::CorrelationID_template(CorrelationID_template* p_precondition, CorrelationID_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } CorrelationID_template::CorrelationID_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; } CorrelationID_template::CorrelationID_template(const CorrelationID_template& other_value) : Base_Template() { copy_template(other_value); } CorrelationID_template::~CorrelationID_template() { clean_up(); } CorrelationID_template& CorrelationID_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } CorrelationID_template& CorrelationID_template::operator=(const CorrelationID& other_value) { clean_up(); copy_value(other_value); return *this; } CorrelationID_template& CorrelationID_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const CorrelationID&)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 @GTPC_Types.CorrelationID."); } return *this; } CorrelationID_template& CorrelationID_template::operator=(const CorrelationID_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean CorrelationID_template::match(const CorrelationID& 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.type__gtpc().is_bound()) return FALSE; if(!single_value->field_type__gtpc.match(other_value.type__gtpc(), legacy))return FALSE; if(!other_value.lengthf().is_bound()) return FALSE; if(!single_value->field_lengthf.match(other_value.lengthf(), legacy))return FALSE; if(!other_value.correlationIDValue().is_bound()) return FALSE; if(!single_value->field_correlationIDValue.match(other_value.correlationIDValue(), 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 @GTPC_Types.CorrelationID."); } return FALSE; } boolean CorrelationID_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_type__gtpc.is_bound() || single_value->field_lengthf.is_bound() || single_value->field_correlationIDValue.is_bound(); } boolean CorrelationID_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_type__gtpc.is_value() && single_value->field_lengthf.is_value() && single_value->field_correlationIDValue.is_value(); } void CorrelationID_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; } CorrelationID CorrelationID_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 @GTPC_Types.CorrelationID."); CorrelationID ret_val; if (single_value->field_type__gtpc.is_bound()) { ret_val.type__gtpc() = single_value->field_type__gtpc.valueof(); } if (single_value->field_lengthf.is_bound()) { ret_val.lengthf() = single_value->field_lengthf.valueof(); } if (single_value->field_correlationIDValue.is_bound()) { ret_val.correlationIDValue() = single_value->field_correlationIDValue.valueof(); } return ret_val; } void CorrelationID_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 @GTPC_Types.CorrelationID."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new CorrelationID_template[list_length]; } CorrelationID_template& CorrelationID_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 @GTPC_Types.CorrelationID."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.CorrelationID."); return value_list.list_value[list_index]; } OCTETSTRING_template& CorrelationID_template::type__gtpc() { set_specific(); return single_value->field_type__gtpc; } const OCTETSTRING_template& CorrelationID_template::type__gtpc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field type_gtpc of a non-specific template of type @GTPC_Types.CorrelationID."); return single_value->field_type__gtpc; } INTEGER_template& CorrelationID_template::lengthf() { set_specific(); return single_value->field_lengthf; } const INTEGER_template& CorrelationID_template::lengthf() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthf of a non-specific template of type @GTPC_Types.CorrelationID."); return single_value->field_lengthf; } OCTETSTRING_template& CorrelationID_template::correlationIDValue() { set_specific(); return single_value->field_correlationIDValue; } const OCTETSTRING_template& CorrelationID_template::correlationIDValue() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field correlationIDValue of a non-specific template of type @GTPC_Types.CorrelationID."); return single_value->field_correlationIDValue; } int CorrelationID_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.CorrelationID 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 @GTPC_Types.CorrelationID 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 @GTPC_Types.CorrelationID containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.CorrelationID containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.CorrelationID containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.CorrelationID containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.CorrelationID containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.CorrelationID containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.CorrelationID containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.CorrelationID."); } return 0; } void CorrelationID_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ type_gtpc := "); single_value->field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log(); TTCN_Logger::log_event_str(", correlationIDValue := "); single_value->field_correlationIDValue.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 CorrelationID_template::log_match(const CorrelationID& 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_type__gtpc.match(match_value.type__gtpc(), legacy)){ TTCN_Logger::log_logmatch_info(".type_gtpc"); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lengthf.match(match_value.lengthf(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthf"); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_correlationIDValue.match(match_value.correlationIDValue(), legacy)){ TTCN_Logger::log_logmatch_info(".correlationIDValue"); single_value->field_correlationIDValue.log_match(match_value.correlationIDValue(), 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("{ type_gtpc := "); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::log_event_str(", correlationIDValue := "); single_value->field_correlationIDValue.log_match(match_value.correlationIDValue(), 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 CorrelationID_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_type__gtpc.encode_text(text_buf); single_value->field_lengthf.encode_text(text_buf); single_value->field_correlationIDValue.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 @GTPC_Types.CorrelationID."); } } void CorrelationID_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_type__gtpc.decode_text(text_buf); single_value->field_lengthf.decode_text(text_buf); single_value->field_correlationIDValue.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 CorrelationID_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 @GTPC_Types.CorrelationID."); } } void CorrelationID_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: { CorrelationID_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) correlationIDValue().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "correlationIDValue")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { correlationIDValue().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.CorrelationID: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { CorrelationID_template* precondition = new CorrelationID_template; precondition->set_param(*param.get_elem(0)); CorrelationID_template* implied_template = new CorrelationID_template; implied_template->set_param(*param.get_elem(1)); *this = CorrelationID_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.CorrelationID"); } is_ifpresent = param.get_ifpresent(); } void CorrelationID_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_type__gtpc.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.CorrelationID"); single_value->field_lengthf.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.CorrelationID"); single_value->field_correlationIDValue.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.CorrelationID"); 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 : "@GTPC_Types.CorrelationID"); } boolean CorrelationID_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean CorrelationID_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) bearerControlModeValue().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "bearerControlModeValue")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { bearerControlModeValue().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.BearerControlMode: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.BearerControlMode"); } } void BearerControlMode::encode_text(Text_Buf& text_buf) const { field_type__gtpc.encode_text(text_buf); field_lengthf.encode_text(text_buf); field_bearerControlModeValue.encode_text(text_buf); } void BearerControlMode::decode_text(Text_Buf& text_buf) { field_type__gtpc.decode_text(text_buf); field_lengthf.decode_text(text_buf); field_bearerControlModeValue.decode_text(text_buf); } void BearerControlMode::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 BearerControlMode::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 BearerControlMode::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; int value_of_length_field1 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_type__gtpc.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, BearerControlMode_lengthf_descr_.raw->forceomit); decoded_field_length = field_lengthf.RAW_decode(BearerControlMode_lengthf_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()); INTEGER tmp1 = field_lengthf.convert_to_Integer(BearerControlMode_lengthf_descr_); field_lengthf = tmp1; value_of_length_field1 += tmp1.get_long_long_val() * 8; RAW_Force_Omit field_2_force_omit(2, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_bearerControlModeValue.RAW_decode(General__Types::OCT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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()); value_of_length_field1 -= decoded_field_length; if (field_type__gtpc != os_43) return -1; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int BearerControlMode::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, BearerControlMode_lengthf_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, General__Types::OCT1_descr_.raw); encoded_length += field_type__gtpc.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += 16; myleaf.body.node.nodes[1]->calc = CALC_LENGTH; myleaf.body.node.nodes[1]->coding_descr = &BearerControlMode_lengthf_descr_; myleaf.body.node.nodes[1]->calcof.lengthto.num_of_fields = 1; myleaf.body.node.nodes[1]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[1]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields = init_lengthto_fields_list(1); myleaf.body.node.nodes[1]->length = 16; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[2]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[2]->curr_pos.pos; encoded_length += field_bearerControlModeValue.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[2]); if (field_type__gtpc != os_43) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={0}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ os_43.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 BearerControlMode_template::single_value_struct { OCTETSTRING_template field_type__gtpc; INTEGER_template field_lengthf; OCTETSTRING_template field_bearerControlModeValue; }; void BearerControlMode_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_type__gtpc = ANY_VALUE; single_value->field_lengthf = ANY_VALUE; single_value->field_bearerControlModeValue = ANY_VALUE; } } } void BearerControlMode_template::copy_value(const BearerControlMode& other_value) { single_value = new single_value_struct; if (other_value.type__gtpc().is_bound()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (other_value.lengthf().is_bound()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (other_value.bearerControlModeValue().is_bound()) { single_value->field_bearerControlModeValue = other_value.bearerControlModeValue(); } else { single_value->field_bearerControlModeValue.clean_up(); } set_selection(SPECIFIC_VALUE); } void BearerControlMode_template::copy_template(const BearerControlMode_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.type__gtpc().get_selection()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lengthf().get_selection()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.bearerControlModeValue().get_selection()) { single_value->field_bearerControlModeValue = other_value.bearerControlModeValue(); } else { single_value->field_bearerControlModeValue.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 BearerControlMode_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 BearerControlMode_template(*other_value.implication_.precondition); implication_.implied_template = new BearerControlMode_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 @GTPC_Types.BearerControlMode."); break; } set_selection(other_value); } BearerControlMode_template::BearerControlMode_template() { } BearerControlMode_template::BearerControlMode_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } BearerControlMode_template::BearerControlMode_template(const BearerControlMode& other_value) { copy_value(other_value); } BearerControlMode_template::BearerControlMode_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const BearerControlMode&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.BearerControlMode from an unbound optional field."); } } BearerControlMode_template::BearerControlMode_template(BearerControlMode_template* p_precondition, BearerControlMode_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } BearerControlMode_template::BearerControlMode_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; } BearerControlMode_template::BearerControlMode_template(const BearerControlMode_template& other_value) : Base_Template() { copy_template(other_value); } BearerControlMode_template::~BearerControlMode_template() { clean_up(); } BearerControlMode_template& BearerControlMode_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } BearerControlMode_template& BearerControlMode_template::operator=(const BearerControlMode& other_value) { clean_up(); copy_value(other_value); return *this; } BearerControlMode_template& BearerControlMode_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const BearerControlMode&)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 @GTPC_Types.BearerControlMode."); } return *this; } BearerControlMode_template& BearerControlMode_template::operator=(const BearerControlMode_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean BearerControlMode_template::match(const BearerControlMode& 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.type__gtpc().is_bound()) return FALSE; if(!single_value->field_type__gtpc.match(other_value.type__gtpc(), legacy))return FALSE; if(!other_value.lengthf().is_bound()) return FALSE; if(!single_value->field_lengthf.match(other_value.lengthf(), legacy))return FALSE; if(!other_value.bearerControlModeValue().is_bound()) return FALSE; if(!single_value->field_bearerControlModeValue.match(other_value.bearerControlModeValue(), 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 @GTPC_Types.BearerControlMode."); } return FALSE; } boolean BearerControlMode_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_type__gtpc.is_bound() || single_value->field_lengthf.is_bound() || single_value->field_bearerControlModeValue.is_bound(); } boolean BearerControlMode_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_type__gtpc.is_value() && single_value->field_lengthf.is_value() && single_value->field_bearerControlModeValue.is_value(); } void BearerControlMode_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; } BearerControlMode BearerControlMode_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 @GTPC_Types.BearerControlMode."); BearerControlMode ret_val; if (single_value->field_type__gtpc.is_bound()) { ret_val.type__gtpc() = single_value->field_type__gtpc.valueof(); } if (single_value->field_lengthf.is_bound()) { ret_val.lengthf() = single_value->field_lengthf.valueof(); } if (single_value->field_bearerControlModeValue.is_bound()) { ret_val.bearerControlModeValue() = single_value->field_bearerControlModeValue.valueof(); } return ret_val; } void BearerControlMode_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 @GTPC_Types.BearerControlMode."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new BearerControlMode_template[list_length]; } BearerControlMode_template& BearerControlMode_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 @GTPC_Types.BearerControlMode."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.BearerControlMode."); return value_list.list_value[list_index]; } OCTETSTRING_template& BearerControlMode_template::type__gtpc() { set_specific(); return single_value->field_type__gtpc; } const OCTETSTRING_template& BearerControlMode_template::type__gtpc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field type_gtpc of a non-specific template of type @GTPC_Types.BearerControlMode."); return single_value->field_type__gtpc; } INTEGER_template& BearerControlMode_template::lengthf() { set_specific(); return single_value->field_lengthf; } const INTEGER_template& BearerControlMode_template::lengthf() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthf of a non-specific template of type @GTPC_Types.BearerControlMode."); return single_value->field_lengthf; } OCTETSTRING_template& BearerControlMode_template::bearerControlModeValue() { set_specific(); return single_value->field_bearerControlModeValue; } const OCTETSTRING_template& BearerControlMode_template::bearerControlModeValue() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field bearerControlModeValue of a non-specific template of type @GTPC_Types.BearerControlMode."); return single_value->field_bearerControlModeValue; } int BearerControlMode_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.BearerControlMode 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 @GTPC_Types.BearerControlMode 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 @GTPC_Types.BearerControlMode containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.BearerControlMode containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.BearerControlMode containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.BearerControlMode containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.BearerControlMode containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.BearerControlMode containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.BearerControlMode containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.BearerControlMode."); } return 0; } void BearerControlMode_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ type_gtpc := "); single_value->field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log(); TTCN_Logger::log_event_str(", bearerControlModeValue := "); single_value->field_bearerControlModeValue.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 BearerControlMode_template::log_match(const BearerControlMode& 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_type__gtpc.match(match_value.type__gtpc(), legacy)){ TTCN_Logger::log_logmatch_info(".type_gtpc"); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lengthf.match(match_value.lengthf(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthf"); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_bearerControlModeValue.match(match_value.bearerControlModeValue(), legacy)){ TTCN_Logger::log_logmatch_info(".bearerControlModeValue"); single_value->field_bearerControlModeValue.log_match(match_value.bearerControlModeValue(), 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("{ type_gtpc := "); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::log_event_str(", bearerControlModeValue := "); single_value->field_bearerControlModeValue.log_match(match_value.bearerControlModeValue(), 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 BearerControlMode_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_type__gtpc.encode_text(text_buf); single_value->field_lengthf.encode_text(text_buf); single_value->field_bearerControlModeValue.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 @GTPC_Types.BearerControlMode."); } } void BearerControlMode_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_type__gtpc.decode_text(text_buf); single_value->field_lengthf.decode_text(text_buf); single_value->field_bearerControlModeValue.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 BearerControlMode_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 @GTPC_Types.BearerControlMode."); } } void BearerControlMode_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: { BearerControlMode_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) bearerControlModeValue().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "bearerControlModeValue")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { bearerControlModeValue().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.BearerControlMode: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { BearerControlMode_template* precondition = new BearerControlMode_template; precondition->set_param(*param.get_elem(0)); BearerControlMode_template* implied_template = new BearerControlMode_template; implied_template->set_param(*param.get_elem(1)); *this = BearerControlMode_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.BearerControlMode"); } is_ifpresent = param.get_ifpresent(); } void BearerControlMode_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_type__gtpc.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.BearerControlMode"); single_value->field_lengthf.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.BearerControlMode"); single_value->field_bearerControlModeValue.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.BearerControlMode"); 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 : "@GTPC_Types.BearerControlMode"); } boolean BearerControlMode_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean BearerControlMode_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) mBMS__FlowIDValue().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mBMS_FlowIDValue")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mBMS__FlowIDValue().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.MBMS_FlowID: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.MBMS_FlowID"); } } void MBMS__FlowID::encode_text(Text_Buf& text_buf) const { field_type__gtpc.encode_text(text_buf); field_lengthf.encode_text(text_buf); field_mBMS__FlowIDValue.encode_text(text_buf); } void MBMS__FlowID::decode_text(Text_Buf& text_buf) { field_type__gtpc.decode_text(text_buf); field_lengthf.decode_text(text_buf); field_mBMS__FlowIDValue.decode_text(text_buf); } void MBMS__FlowID::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 MBMS__FlowID::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 MBMS__FlowID::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; int value_of_length_field1 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_type__gtpc.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, MBMS__FlowID_lengthf_descr_.raw->forceomit); decoded_field_length = field_lengthf.RAW_decode(MBMS__FlowID_lengthf_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()); INTEGER tmp1 = field_lengthf.convert_to_Integer(MBMS__FlowID_lengthf_descr_); field_lengthf = tmp1; value_of_length_field1 += tmp1.get_long_long_val() * 8; RAW_Force_Omit field_2_force_omit(2, force_omit, OCTETSTRING_descr_.raw->forceomit); decoded_field_length = field_mBMS__FlowIDValue.RAW_decode(OCTETSTRING_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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()); value_of_length_field1 -= decoded_field_length; if (field_type__gtpc != os_128) return -1; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int MBMS__FlowID::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, MBMS__FlowID_lengthf_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, OCTETSTRING_descr_.raw); encoded_length += field_type__gtpc.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += 16; myleaf.body.node.nodes[1]->calc = CALC_LENGTH; myleaf.body.node.nodes[1]->coding_descr = &MBMS__FlowID_lengthf_descr_; myleaf.body.node.nodes[1]->calcof.lengthto.num_of_fields = 1; myleaf.body.node.nodes[1]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[1]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields = init_lengthto_fields_list(1); myleaf.body.node.nodes[1]->length = 16; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[2]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[2]->curr_pos.pos; encoded_length += field_mBMS__FlowIDValue.RAW_encode(OCTETSTRING_descr_, *myleaf.body.node.nodes[2]); if (field_type__gtpc != os_128) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={0}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ os_128.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 MBMS__FlowID_template::single_value_struct { OCTETSTRING_template field_type__gtpc; INTEGER_template field_lengthf; OCTETSTRING_template field_mBMS__FlowIDValue; }; void MBMS__FlowID_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_type__gtpc = ANY_VALUE; single_value->field_lengthf = ANY_VALUE; single_value->field_mBMS__FlowIDValue = ANY_VALUE; } } } void MBMS__FlowID_template::copy_value(const MBMS__FlowID& other_value) { single_value = new single_value_struct; if (other_value.type__gtpc().is_bound()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (other_value.lengthf().is_bound()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (other_value.mBMS__FlowIDValue().is_bound()) { single_value->field_mBMS__FlowIDValue = other_value.mBMS__FlowIDValue(); } else { single_value->field_mBMS__FlowIDValue.clean_up(); } set_selection(SPECIFIC_VALUE); } void MBMS__FlowID_template::copy_template(const MBMS__FlowID_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.type__gtpc().get_selection()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lengthf().get_selection()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.mBMS__FlowIDValue().get_selection()) { single_value->field_mBMS__FlowIDValue = other_value.mBMS__FlowIDValue(); } else { single_value->field_mBMS__FlowIDValue.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 MBMS__FlowID_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 MBMS__FlowID_template(*other_value.implication_.precondition); implication_.implied_template = new MBMS__FlowID_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 @GTPC_Types.MBMS_FlowID."); break; } set_selection(other_value); } MBMS__FlowID_template::MBMS__FlowID_template() { } MBMS__FlowID_template::MBMS__FlowID_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } MBMS__FlowID_template::MBMS__FlowID_template(const MBMS__FlowID& other_value) { copy_value(other_value); } MBMS__FlowID_template::MBMS__FlowID_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const MBMS__FlowID&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.MBMS_FlowID from an unbound optional field."); } } MBMS__FlowID_template::MBMS__FlowID_template(MBMS__FlowID_template* p_precondition, MBMS__FlowID_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } MBMS__FlowID_template::MBMS__FlowID_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; } MBMS__FlowID_template::MBMS__FlowID_template(const MBMS__FlowID_template& other_value) : Base_Template() { copy_template(other_value); } MBMS__FlowID_template::~MBMS__FlowID_template() { clean_up(); } MBMS__FlowID_template& MBMS__FlowID_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } MBMS__FlowID_template& MBMS__FlowID_template::operator=(const MBMS__FlowID& other_value) { clean_up(); copy_value(other_value); return *this; } MBMS__FlowID_template& MBMS__FlowID_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const MBMS__FlowID&)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 @GTPC_Types.MBMS_FlowID."); } return *this; } MBMS__FlowID_template& MBMS__FlowID_template::operator=(const MBMS__FlowID_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean MBMS__FlowID_template::match(const MBMS__FlowID& 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.type__gtpc().is_bound()) return FALSE; if(!single_value->field_type__gtpc.match(other_value.type__gtpc(), legacy))return FALSE; if(!other_value.lengthf().is_bound()) return FALSE; if(!single_value->field_lengthf.match(other_value.lengthf(), legacy))return FALSE; if(!other_value.mBMS__FlowIDValue().is_bound()) return FALSE; if(!single_value->field_mBMS__FlowIDValue.match(other_value.mBMS__FlowIDValue(), 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 @GTPC_Types.MBMS_FlowID."); } return FALSE; } boolean MBMS__FlowID_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_type__gtpc.is_bound() || single_value->field_lengthf.is_bound() || single_value->field_mBMS__FlowIDValue.is_bound(); } boolean MBMS__FlowID_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_type__gtpc.is_value() && single_value->field_lengthf.is_value() && single_value->field_mBMS__FlowIDValue.is_value(); } void MBMS__FlowID_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; } MBMS__FlowID MBMS__FlowID_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 @GTPC_Types.MBMS_FlowID."); MBMS__FlowID ret_val; if (single_value->field_type__gtpc.is_bound()) { ret_val.type__gtpc() = single_value->field_type__gtpc.valueof(); } if (single_value->field_lengthf.is_bound()) { ret_val.lengthf() = single_value->field_lengthf.valueof(); } if (single_value->field_mBMS__FlowIDValue.is_bound()) { ret_val.mBMS__FlowIDValue() = single_value->field_mBMS__FlowIDValue.valueof(); } return ret_val; } void MBMS__FlowID_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 @GTPC_Types.MBMS_FlowID."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new MBMS__FlowID_template[list_length]; } MBMS__FlowID_template& MBMS__FlowID_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 @GTPC_Types.MBMS_FlowID."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.MBMS_FlowID."); return value_list.list_value[list_index]; } OCTETSTRING_template& MBMS__FlowID_template::type__gtpc() { set_specific(); return single_value->field_type__gtpc; } const OCTETSTRING_template& MBMS__FlowID_template::type__gtpc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field type_gtpc of a non-specific template of type @GTPC_Types.MBMS_FlowID."); return single_value->field_type__gtpc; } INTEGER_template& MBMS__FlowID_template::lengthf() { set_specific(); return single_value->field_lengthf; } const INTEGER_template& MBMS__FlowID_template::lengthf() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthf of a non-specific template of type @GTPC_Types.MBMS_FlowID."); return single_value->field_lengthf; } OCTETSTRING_template& MBMS__FlowID_template::mBMS__FlowIDValue() { set_specific(); return single_value->field_mBMS__FlowIDValue; } const OCTETSTRING_template& MBMS__FlowID_template::mBMS__FlowIDValue() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field mBMS_FlowIDValue of a non-specific template of type @GTPC_Types.MBMS_FlowID."); return single_value->field_mBMS__FlowIDValue; } int MBMS__FlowID_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MBMS_FlowID 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 @GTPC_Types.MBMS_FlowID 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 @GTPC_Types.MBMS_FlowID containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MBMS_FlowID containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MBMS_FlowID containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MBMS_FlowID containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MBMS_FlowID containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MBMS_FlowID containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MBMS_FlowID containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.MBMS_FlowID."); } return 0; } void MBMS__FlowID_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ type_gtpc := "); single_value->field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log(); TTCN_Logger::log_event_str(", mBMS_FlowIDValue := "); single_value->field_mBMS__FlowIDValue.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 MBMS__FlowID_template::log_match(const MBMS__FlowID& 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_type__gtpc.match(match_value.type__gtpc(), legacy)){ TTCN_Logger::log_logmatch_info(".type_gtpc"); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lengthf.match(match_value.lengthf(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthf"); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_mBMS__FlowIDValue.match(match_value.mBMS__FlowIDValue(), legacy)){ TTCN_Logger::log_logmatch_info(".mBMS_FlowIDValue"); single_value->field_mBMS__FlowIDValue.log_match(match_value.mBMS__FlowIDValue(), 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("{ type_gtpc := "); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::log_event_str(", mBMS_FlowIDValue := "); single_value->field_mBMS__FlowIDValue.log_match(match_value.mBMS__FlowIDValue(), 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 MBMS__FlowID_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_type__gtpc.encode_text(text_buf); single_value->field_lengthf.encode_text(text_buf); single_value->field_mBMS__FlowIDValue.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 @GTPC_Types.MBMS_FlowID."); } } void MBMS__FlowID_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_type__gtpc.decode_text(text_buf); single_value->field_lengthf.decode_text(text_buf); single_value->field_mBMS__FlowIDValue.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 MBMS__FlowID_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 @GTPC_Types.MBMS_FlowID."); } } void MBMS__FlowID_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: { MBMS__FlowID_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) mBMS__FlowIDValue().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mBMS_FlowIDValue")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mBMS__FlowIDValue().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.MBMS_FlowID: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { MBMS__FlowID_template* precondition = new MBMS__FlowID_template; precondition->set_param(*param.get_elem(0)); MBMS__FlowID_template* implied_template = new MBMS__FlowID_template; implied_template->set_param(*param.get_elem(1)); *this = MBMS__FlowID_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.MBMS_FlowID"); } is_ifpresent = param.get_ifpresent(); } void MBMS__FlowID_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_type__gtpc.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.MBMS_FlowID"); single_value->field_lengthf.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.MBMS_FlowID"); single_value->field_mBMS__FlowIDValue.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.MBMS_FlowID"); 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 : "@GTPC_Types.MBMS_FlowID"); } boolean MBMS__FlowID_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean MBMS__FlowID_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) lengthf().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) address__type().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) ipv__address().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(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "address_type")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { address__type().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ipv_address")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ipv__address().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.GSNAddress: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.GSNAddress"); } } void GSNAddress::encode_text(Text_Buf& text_buf) const { field_lengthf.encode_text(text_buf); field_address__type.encode_text(text_buf); field_ipv__address.encode_text(text_buf); } void GSNAddress::decode_text(Text_Buf& text_buf) { field_lengthf.decode_text(text_buf); field_address__type.decode_text(text_buf); field_ipv__address.decode_text(text_buf); } void GSNAddress::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 GSNAddress::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 GSNAddress::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; int value_of_length_field0 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, GSNAddress_lengthf_descr_.raw->forceomit); decoded_field_length = field_lengthf.RAW_decode(GSNAddress_lengthf_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()); INTEGER tmp0 = field_lengthf.convert_to_Integer(GSNAddress_lengthf_descr_); field_lengthf = tmp0; value_of_length_field0 += tmp0.get_long_long_val() * 8; RAW_Force_Omit field_1_force_omit(1, force_omit, General__Types::BIT2_descr_.raw->forceomit); decoded_field_length = field_address__type.RAW_decode(General__Types::BIT2_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, iPv4__iPv6__Address_descr_.raw->forceomit); decoded_field_length = field_ipv__address.RAW_decode(iPv4__iPv6__Address_descr_, p_buf, min_of_ints(2, limit, value_of_length_field0), 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()); value_of_length_field0 -= 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 GSNAddress::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, GSNAddress_lengthf_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, General__Types::BIT2_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, iPv4__iPv6__Address_descr_.raw); encoded_length += 6; myleaf.body.node.nodes[0]->calc = CALC_LENGTH; myleaf.body.node.nodes[0]->coding_descr = &GSNAddress_lengthf_descr_; myleaf.body.node.nodes[0]->calcof.lengthto.num_of_fields = 1; myleaf.body.node.nodes[0]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[0]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[0]->calcof.lengthto.fields = init_lengthto_fields_list(1); myleaf.body.node.nodes[0]->length = 6; myleaf.body.node.nodes[0]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[2]->curr_pos.level; myleaf.body.node.nodes[0]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[2]->curr_pos.pos; encoded_length += field_address__type.RAW_encode(General__Types::BIT2_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_ipv__address.RAW_encode(iPv4__iPv6__Address_descr_, *myleaf.body.node.nodes[2]); return myleaf.length = encoded_length; } struct GSNAddress_template::single_value_struct { INTEGER_template field_lengthf; BITSTRING_template field_address__type; iPv4__iPv6__Address_template field_ipv__address; }; void GSNAddress_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_lengthf = ANY_VALUE; single_value->field_address__type = ANY_VALUE; single_value->field_ipv__address = ANY_VALUE; } } } void GSNAddress_template::copy_value(const GSNAddress& other_value) { single_value = new single_value_struct; if (other_value.lengthf().is_bound()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (other_value.address__type().is_bound()) { single_value->field_address__type = other_value.address__type(); } else { single_value->field_address__type.clean_up(); } if (other_value.ipv__address().is_bound()) { single_value->field_ipv__address = other_value.ipv__address(); } else { single_value->field_ipv__address.clean_up(); } set_selection(SPECIFIC_VALUE); } void GSNAddress_template::copy_template(const GSNAddress_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.lengthf().get_selection()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.address__type().get_selection()) { single_value->field_address__type = other_value.address__type(); } else { single_value->field_address__type.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.ipv__address().get_selection()) { single_value->field_ipv__address = other_value.ipv__address(); } else { single_value->field_ipv__address.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 GSNAddress_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 GSNAddress_template(*other_value.implication_.precondition); implication_.implied_template = new GSNAddress_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 @GTPC_Types.GSNAddress."); break; } set_selection(other_value); } GSNAddress_template::GSNAddress_template() { } GSNAddress_template::GSNAddress_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } GSNAddress_template::GSNAddress_template(const GSNAddress& other_value) { copy_value(other_value); } GSNAddress_template::GSNAddress_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const GSNAddress&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.GSNAddress from an unbound optional field."); } } GSNAddress_template::GSNAddress_template(GSNAddress_template* p_precondition, GSNAddress_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } GSNAddress_template::GSNAddress_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; } GSNAddress_template::GSNAddress_template(const GSNAddress_template& other_value) : Base_Template() { copy_template(other_value); } GSNAddress_template::~GSNAddress_template() { clean_up(); } GSNAddress_template& GSNAddress_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } GSNAddress_template& GSNAddress_template::operator=(const GSNAddress& other_value) { clean_up(); copy_value(other_value); return *this; } GSNAddress_template& GSNAddress_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const GSNAddress&)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 @GTPC_Types.GSNAddress."); } return *this; } GSNAddress_template& GSNAddress_template::operator=(const GSNAddress_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean GSNAddress_template::match(const GSNAddress& 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.lengthf().is_bound()) return FALSE; if(!single_value->field_lengthf.match(other_value.lengthf(), legacy))return FALSE; if(!other_value.address__type().is_bound()) return FALSE; if(!single_value->field_address__type.match(other_value.address__type(), legacy))return FALSE; if(!other_value.ipv__address().is_bound()) return FALSE; if(!single_value->field_ipv__address.match(other_value.ipv__address(), 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 @GTPC_Types.GSNAddress."); } return FALSE; } boolean GSNAddress_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_lengthf.is_bound() || single_value->field_address__type.is_bound() || single_value->field_ipv__address.is_bound(); } boolean GSNAddress_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_lengthf.is_value() && single_value->field_address__type.is_value() && single_value->field_ipv__address.is_value(); } void GSNAddress_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; } GSNAddress GSNAddress_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 @GTPC_Types.GSNAddress."); GSNAddress ret_val; if (single_value->field_lengthf.is_bound()) { ret_val.lengthf() = single_value->field_lengthf.valueof(); } if (single_value->field_address__type.is_bound()) { ret_val.address__type() = single_value->field_address__type.valueof(); } if (single_value->field_ipv__address.is_bound()) { ret_val.ipv__address() = single_value->field_ipv__address.valueof(); } return ret_val; } void GSNAddress_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 @GTPC_Types.GSNAddress."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new GSNAddress_template[list_length]; } GSNAddress_template& GSNAddress_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 @GTPC_Types.GSNAddress."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.GSNAddress."); return value_list.list_value[list_index]; } INTEGER_template& GSNAddress_template::lengthf() { set_specific(); return single_value->field_lengthf; } const INTEGER_template& GSNAddress_template::lengthf() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthf of a non-specific template of type @GTPC_Types.GSNAddress."); return single_value->field_lengthf; } BITSTRING_template& GSNAddress_template::address__type() { set_specific(); return single_value->field_address__type; } const BITSTRING_template& GSNAddress_template::address__type() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field address_type of a non-specific template of type @GTPC_Types.GSNAddress."); return single_value->field_address__type; } iPv4__iPv6__Address_template& GSNAddress_template::ipv__address() { set_specific(); return single_value->field_ipv__address; } const iPv4__iPv6__Address_template& GSNAddress_template::ipv__address() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ipv_address of a non-specific template of type @GTPC_Types.GSNAddress."); return single_value->field_ipv__address; } int GSNAddress_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.GSNAddress 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 @GTPC_Types.GSNAddress 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 @GTPC_Types.GSNAddress containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.GSNAddress containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.GSNAddress containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.GSNAddress containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.GSNAddress containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.GSNAddress containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.GSNAddress containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.GSNAddress."); } return 0; } void GSNAddress_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ lengthf := "); single_value->field_lengthf.log(); TTCN_Logger::log_event_str(", address_type := "); single_value->field_address__type.log(); TTCN_Logger::log_event_str(", ipv_address := "); single_value->field_ipv__address.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 GSNAddress_template::log_match(const GSNAddress& 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_lengthf.match(match_value.lengthf(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthf"); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_address__type.match(match_value.address__type(), legacy)){ TTCN_Logger::log_logmatch_info(".address_type"); single_value->field_address__type.log_match(match_value.address__type(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_ipv__address.match(match_value.ipv__address(), legacy)){ TTCN_Logger::log_logmatch_info(".ipv_address"); single_value->field_ipv__address.log_match(match_value.ipv__address(), 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("{ lengthf := "); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::log_event_str(", address_type := "); single_value->field_address__type.log_match(match_value.address__type(), legacy); TTCN_Logger::log_event_str(", ipv_address := "); single_value->field_ipv__address.log_match(match_value.ipv__address(), 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 GSNAddress_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_lengthf.encode_text(text_buf); single_value->field_address__type.encode_text(text_buf); single_value->field_ipv__address.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 @GTPC_Types.GSNAddress."); } } void GSNAddress_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_lengthf.decode_text(text_buf); single_value->field_address__type.decode_text(text_buf); single_value->field_ipv__address.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 GSNAddress_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 @GTPC_Types.GSNAddress."); } } void GSNAddress_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: { GSNAddress_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) lengthf().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) address__type().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) ipv__address().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(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "address_type")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { address__type().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ipv_address")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ipv__address().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.GSNAddress: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { GSNAddress_template* precondition = new GSNAddress_template; precondition->set_param(*param.get_elem(0)); GSNAddress_template* implied_template = new GSNAddress_template; implied_template->set_param(*param.get_elem(1)); *this = GSNAddress_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.GSNAddress"); } is_ifpresent = param.get_ifpresent(); } void GSNAddress_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_lengthf.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.GSNAddress"); single_value->field_address__type.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.GSNAddress"); single_value->field_ipv__address.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.GSNAddress"); 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 : "@GTPC_Types.GSNAddress"); } boolean GSNAddress_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean GSNAddress_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) commonTEID().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) iPmulticastDistributionAddress().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) iPmulticastSourceAddress().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) mBMS__HCIndicator().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "commonTEID")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { commonTEID().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "iPmulticastDistributionAddress")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { iPmulticastDistributionAddress().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "iPmulticastSourceAddress")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { iPmulticastSourceAddress().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mBMS_HCIndicator")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mBMS__HCIndicator().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.MBMS_IPMulticastDistribution: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.MBMS_IPMulticastDistribution"); } } void MBMS__IPMulticastDistribution::encode_text(Text_Buf& text_buf) const { field_type__gtpc.encode_text(text_buf); field_lengthf.encode_text(text_buf); field_commonTEID.encode_text(text_buf); field_iPmulticastDistributionAddress.encode_text(text_buf); field_iPmulticastSourceAddress.encode_text(text_buf); field_mBMS__HCIndicator.encode_text(text_buf); } void MBMS__IPMulticastDistribution::decode_text(Text_Buf& text_buf) { field_type__gtpc.decode_text(text_buf); field_lengthf.decode_text(text_buf); field_commonTEID.decode_text(text_buf); field_iPmulticastDistributionAddress.decode_text(text_buf); field_iPmulticastSourceAddress.decode_text(text_buf); field_mBMS__HCIndicator.decode_text(text_buf); } void MBMS__IPMulticastDistribution::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 MBMS__IPMulticastDistribution::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 MBMS__IPMulticastDistribution::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; int value_of_length_field1 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_type__gtpc.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, MBMS__IPMulticastDistribution_lengthf_descr_.raw->forceomit); decoded_field_length = field_lengthf.RAW_decode(MBMS__IPMulticastDistribution_lengthf_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()); INTEGER tmp1 = field_lengthf.convert_to_Integer(MBMS__IPMulticastDistribution_lengthf_descr_); field_lengthf = tmp1; value_of_length_field1 += tmp1.get_long_long_val() * 8; RAW_Force_Omit field_2_force_omit(2, force_omit, General__Types::OCT4_descr_.raw->forceomit); decoded_field_length = field_commonTEID.RAW_decode(General__Types::OCT4_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_3_force_omit(3, force_omit, GSNAddress_descr_.raw->forceomit); decoded_field_length = field_iPmulticastDistributionAddress.RAW_decode(GSNAddress_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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_field1 -= decoded_field_length; RAW_Force_Omit field_4_force_omit(4, force_omit, GSNAddress_descr_.raw->forceomit); decoded_field_length = field_iPmulticastSourceAddress.RAW_decode(GSNAddress_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, no_err, -1, TRUE, &field_4_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_5_force_omit(5, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_mBMS__HCIndicator.RAW_decode(General__Types::OCT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, no_err, -1, TRUE, &field_5_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); value_of_length_field1 -= decoded_field_length; if (field_type__gtpc != os_129) return -1; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int MBMS__IPMulticastDistribution::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, MBMS__IPMulticastDistribution_lengthf_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, General__Types::OCT4_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, GSNAddress_descr_.raw); myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, GSNAddress_descr_.raw); myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, General__Types::OCT1_descr_.raw); encoded_length += field_type__gtpc.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += 16; myleaf.body.node.nodes[1]->calc = CALC_LENGTH; myleaf.body.node.nodes[1]->coding_descr = &MBMS__IPMulticastDistribution_lengthf_descr_; myleaf.body.node.nodes[1]->calcof.lengthto.num_of_fields = 4; myleaf.body.node.nodes[1]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[1]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields = init_lengthto_fields_list(4); myleaf.body.node.nodes[1]->length = 16; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[2]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[2]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].level = myleaf.body.node.nodes[3]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].pos = myleaf.body.node.nodes[3]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].level = myleaf.body.node.nodes[4]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].pos = myleaf.body.node.nodes[4]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[3].level = myleaf.body.node.nodes[5]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[3].pos = myleaf.body.node.nodes[5]->curr_pos.pos; encoded_length += field_commonTEID.RAW_encode(General__Types::OCT4_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_iPmulticastDistributionAddress.RAW_encode(GSNAddress_descr_, *myleaf.body.node.nodes[3]); encoded_length += field_iPmulticastSourceAddress.RAW_encode(GSNAddress_descr_, *myleaf.body.node.nodes[4]); encoded_length += field_mBMS__HCIndicator.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[5]); if (field_type__gtpc != os_129) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={0}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ os_129.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 MBMS__IPMulticastDistribution_template::single_value_struct { OCTETSTRING_template field_type__gtpc; INTEGER_template field_lengthf; OCTETSTRING_template field_commonTEID; GSNAddress_template field_iPmulticastDistributionAddress; GSNAddress_template field_iPmulticastSourceAddress; OCTETSTRING_template field_mBMS__HCIndicator; }; void MBMS__IPMulticastDistribution_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_type__gtpc = ANY_VALUE; single_value->field_lengthf = ANY_VALUE; single_value->field_commonTEID = ANY_VALUE; single_value->field_iPmulticastDistributionAddress = ANY_VALUE; single_value->field_iPmulticastSourceAddress = ANY_VALUE; single_value->field_mBMS__HCIndicator = ANY_VALUE; } } } void MBMS__IPMulticastDistribution_template::copy_value(const MBMS__IPMulticastDistribution& other_value) { single_value = new single_value_struct; if (other_value.type__gtpc().is_bound()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (other_value.lengthf().is_bound()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (other_value.commonTEID().is_bound()) { single_value->field_commonTEID = other_value.commonTEID(); } else { single_value->field_commonTEID.clean_up(); } if (other_value.iPmulticastDistributionAddress().is_bound()) { single_value->field_iPmulticastDistributionAddress = other_value.iPmulticastDistributionAddress(); } else { single_value->field_iPmulticastDistributionAddress.clean_up(); } if (other_value.iPmulticastSourceAddress().is_bound()) { single_value->field_iPmulticastSourceAddress = other_value.iPmulticastSourceAddress(); } else { single_value->field_iPmulticastSourceAddress.clean_up(); } if (other_value.mBMS__HCIndicator().is_bound()) { single_value->field_mBMS__HCIndicator = other_value.mBMS__HCIndicator(); } else { single_value->field_mBMS__HCIndicator.clean_up(); } set_selection(SPECIFIC_VALUE); } void MBMS__IPMulticastDistribution_template::copy_template(const MBMS__IPMulticastDistribution_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.type__gtpc().get_selection()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lengthf().get_selection()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.commonTEID().get_selection()) { single_value->field_commonTEID = other_value.commonTEID(); } else { single_value->field_commonTEID.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.iPmulticastDistributionAddress().get_selection()) { single_value->field_iPmulticastDistributionAddress = other_value.iPmulticastDistributionAddress(); } else { single_value->field_iPmulticastDistributionAddress.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.iPmulticastSourceAddress().get_selection()) { single_value->field_iPmulticastSourceAddress = other_value.iPmulticastSourceAddress(); } else { single_value->field_iPmulticastSourceAddress.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.mBMS__HCIndicator().get_selection()) { single_value->field_mBMS__HCIndicator = other_value.mBMS__HCIndicator(); } else { single_value->field_mBMS__HCIndicator.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 MBMS__IPMulticastDistribution_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 MBMS__IPMulticastDistribution_template(*other_value.implication_.precondition); implication_.implied_template = new MBMS__IPMulticastDistribution_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 @GTPC_Types.MBMS_IPMulticastDistribution."); break; } set_selection(other_value); } MBMS__IPMulticastDistribution_template::MBMS__IPMulticastDistribution_template() { } MBMS__IPMulticastDistribution_template::MBMS__IPMulticastDistribution_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } MBMS__IPMulticastDistribution_template::MBMS__IPMulticastDistribution_template(const MBMS__IPMulticastDistribution& other_value) { copy_value(other_value); } MBMS__IPMulticastDistribution_template::MBMS__IPMulticastDistribution_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const MBMS__IPMulticastDistribution&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.MBMS_IPMulticastDistribution from an unbound optional field."); } } MBMS__IPMulticastDistribution_template::MBMS__IPMulticastDistribution_template(MBMS__IPMulticastDistribution_template* p_precondition, MBMS__IPMulticastDistribution_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } MBMS__IPMulticastDistribution_template::MBMS__IPMulticastDistribution_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; } MBMS__IPMulticastDistribution_template::MBMS__IPMulticastDistribution_template(const MBMS__IPMulticastDistribution_template& other_value) : Base_Template() { copy_template(other_value); } MBMS__IPMulticastDistribution_template::~MBMS__IPMulticastDistribution_template() { clean_up(); } MBMS__IPMulticastDistribution_template& MBMS__IPMulticastDistribution_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } MBMS__IPMulticastDistribution_template& MBMS__IPMulticastDistribution_template::operator=(const MBMS__IPMulticastDistribution& other_value) { clean_up(); copy_value(other_value); return *this; } MBMS__IPMulticastDistribution_template& MBMS__IPMulticastDistribution_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const MBMS__IPMulticastDistribution&)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 @GTPC_Types.MBMS_IPMulticastDistribution."); } return *this; } MBMS__IPMulticastDistribution_template& MBMS__IPMulticastDistribution_template::operator=(const MBMS__IPMulticastDistribution_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean MBMS__IPMulticastDistribution_template::match(const MBMS__IPMulticastDistribution& 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.type__gtpc().is_bound()) return FALSE; if(!single_value->field_type__gtpc.match(other_value.type__gtpc(), legacy))return FALSE; if(!other_value.lengthf().is_bound()) return FALSE; if(!single_value->field_lengthf.match(other_value.lengthf(), legacy))return FALSE; if(!other_value.commonTEID().is_bound()) return FALSE; if(!single_value->field_commonTEID.match(other_value.commonTEID(), legacy))return FALSE; if(!other_value.iPmulticastDistributionAddress().is_bound()) return FALSE; if(!single_value->field_iPmulticastDistributionAddress.match(other_value.iPmulticastDistributionAddress(), legacy))return FALSE; if(!other_value.iPmulticastSourceAddress().is_bound()) return FALSE; if(!single_value->field_iPmulticastSourceAddress.match(other_value.iPmulticastSourceAddress(), legacy))return FALSE; if(!other_value.mBMS__HCIndicator().is_bound()) return FALSE; if(!single_value->field_mBMS__HCIndicator.match(other_value.mBMS__HCIndicator(), 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 @GTPC_Types.MBMS_IPMulticastDistribution."); } return FALSE; } boolean MBMS__IPMulticastDistribution_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_type__gtpc.is_bound() || single_value->field_lengthf.is_bound() || single_value->field_commonTEID.is_bound() || single_value->field_iPmulticastDistributionAddress.is_bound() || single_value->field_iPmulticastSourceAddress.is_bound() || single_value->field_mBMS__HCIndicator.is_bound(); } boolean MBMS__IPMulticastDistribution_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_type__gtpc.is_value() && single_value->field_lengthf.is_value() && single_value->field_commonTEID.is_value() && single_value->field_iPmulticastDistributionAddress.is_value() && single_value->field_iPmulticastSourceAddress.is_value() && single_value->field_mBMS__HCIndicator.is_value(); } void MBMS__IPMulticastDistribution_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; } MBMS__IPMulticastDistribution MBMS__IPMulticastDistribution_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 @GTPC_Types.MBMS_IPMulticastDistribution."); MBMS__IPMulticastDistribution ret_val; if (single_value->field_type__gtpc.is_bound()) { ret_val.type__gtpc() = single_value->field_type__gtpc.valueof(); } if (single_value->field_lengthf.is_bound()) { ret_val.lengthf() = single_value->field_lengthf.valueof(); } if (single_value->field_commonTEID.is_bound()) { ret_val.commonTEID() = single_value->field_commonTEID.valueof(); } if (single_value->field_iPmulticastDistributionAddress.is_bound()) { ret_val.iPmulticastDistributionAddress() = single_value->field_iPmulticastDistributionAddress.valueof(); } if (single_value->field_iPmulticastSourceAddress.is_bound()) { ret_val.iPmulticastSourceAddress() = single_value->field_iPmulticastSourceAddress.valueof(); } if (single_value->field_mBMS__HCIndicator.is_bound()) { ret_val.mBMS__HCIndicator() = single_value->field_mBMS__HCIndicator.valueof(); } return ret_val; } void MBMS__IPMulticastDistribution_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 @GTPC_Types.MBMS_IPMulticastDistribution."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new MBMS__IPMulticastDistribution_template[list_length]; } MBMS__IPMulticastDistribution_template& MBMS__IPMulticastDistribution_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 @GTPC_Types.MBMS_IPMulticastDistribution."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.MBMS_IPMulticastDistribution."); return value_list.list_value[list_index]; } OCTETSTRING_template& MBMS__IPMulticastDistribution_template::type__gtpc() { set_specific(); return single_value->field_type__gtpc; } const OCTETSTRING_template& MBMS__IPMulticastDistribution_template::type__gtpc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field type_gtpc of a non-specific template of type @GTPC_Types.MBMS_IPMulticastDistribution."); return single_value->field_type__gtpc; } INTEGER_template& MBMS__IPMulticastDistribution_template::lengthf() { set_specific(); return single_value->field_lengthf; } const INTEGER_template& MBMS__IPMulticastDistribution_template::lengthf() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthf of a non-specific template of type @GTPC_Types.MBMS_IPMulticastDistribution."); return single_value->field_lengthf; } OCTETSTRING_template& MBMS__IPMulticastDistribution_template::commonTEID() { set_specific(); return single_value->field_commonTEID; } const OCTETSTRING_template& MBMS__IPMulticastDistribution_template::commonTEID() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field commonTEID of a non-specific template of type @GTPC_Types.MBMS_IPMulticastDistribution."); return single_value->field_commonTEID; } GSNAddress_template& MBMS__IPMulticastDistribution_template::iPmulticastDistributionAddress() { set_specific(); return single_value->field_iPmulticastDistributionAddress; } const GSNAddress_template& MBMS__IPMulticastDistribution_template::iPmulticastDistributionAddress() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field iPmulticastDistributionAddress of a non-specific template of type @GTPC_Types.MBMS_IPMulticastDistribution."); return single_value->field_iPmulticastDistributionAddress; } GSNAddress_template& MBMS__IPMulticastDistribution_template::iPmulticastSourceAddress() { set_specific(); return single_value->field_iPmulticastSourceAddress; } const GSNAddress_template& MBMS__IPMulticastDistribution_template::iPmulticastSourceAddress() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field iPmulticastSourceAddress of a non-specific template of type @GTPC_Types.MBMS_IPMulticastDistribution."); return single_value->field_iPmulticastSourceAddress; } OCTETSTRING_template& MBMS__IPMulticastDistribution_template::mBMS__HCIndicator() { set_specific(); return single_value->field_mBMS__HCIndicator; } const OCTETSTRING_template& MBMS__IPMulticastDistribution_template::mBMS__HCIndicator() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field mBMS_HCIndicator of a non-specific template of type @GTPC_Types.MBMS_IPMulticastDistribution."); return single_value->field_mBMS__HCIndicator; } int MBMS__IPMulticastDistribution_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MBMS_IPMulticastDistribution which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 6; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @GTPC_Types.MBMS_IPMulticastDistribution 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 @GTPC_Types.MBMS_IPMulticastDistribution containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MBMS_IPMulticastDistribution containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MBMS_IPMulticastDistribution containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MBMS_IPMulticastDistribution containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MBMS_IPMulticastDistribution containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MBMS_IPMulticastDistribution containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MBMS_IPMulticastDistribution containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.MBMS_IPMulticastDistribution."); } return 0; } void MBMS__IPMulticastDistribution_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ type_gtpc := "); single_value->field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log(); TTCN_Logger::log_event_str(", commonTEID := "); single_value->field_commonTEID.log(); TTCN_Logger::log_event_str(", iPmulticastDistributionAddress := "); single_value->field_iPmulticastDistributionAddress.log(); TTCN_Logger::log_event_str(", iPmulticastSourceAddress := "); single_value->field_iPmulticastSourceAddress.log(); TTCN_Logger::log_event_str(", mBMS_HCIndicator := "); single_value->field_mBMS__HCIndicator.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 MBMS__IPMulticastDistribution_template::log_match(const MBMS__IPMulticastDistribution& 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_type__gtpc.match(match_value.type__gtpc(), legacy)){ TTCN_Logger::log_logmatch_info(".type_gtpc"); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lengthf.match(match_value.lengthf(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthf"); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_commonTEID.match(match_value.commonTEID(), legacy)){ TTCN_Logger::log_logmatch_info(".commonTEID"); single_value->field_commonTEID.log_match(match_value.commonTEID(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_iPmulticastDistributionAddress.match(match_value.iPmulticastDistributionAddress(), legacy)){ TTCN_Logger::log_logmatch_info(".iPmulticastDistributionAddress"); single_value->field_iPmulticastDistributionAddress.log_match(match_value.iPmulticastDistributionAddress(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_iPmulticastSourceAddress.match(match_value.iPmulticastSourceAddress(), legacy)){ TTCN_Logger::log_logmatch_info(".iPmulticastSourceAddress"); single_value->field_iPmulticastSourceAddress.log_match(match_value.iPmulticastSourceAddress(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_mBMS__HCIndicator.match(match_value.mBMS__HCIndicator(), legacy)){ TTCN_Logger::log_logmatch_info(".mBMS_HCIndicator"); single_value->field_mBMS__HCIndicator.log_match(match_value.mBMS__HCIndicator(), 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("{ type_gtpc := "); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::log_event_str(", commonTEID := "); single_value->field_commonTEID.log_match(match_value.commonTEID(), legacy); TTCN_Logger::log_event_str(", iPmulticastDistributionAddress := "); single_value->field_iPmulticastDistributionAddress.log_match(match_value.iPmulticastDistributionAddress(), legacy); TTCN_Logger::log_event_str(", iPmulticastSourceAddress := "); single_value->field_iPmulticastSourceAddress.log_match(match_value.iPmulticastSourceAddress(), legacy); TTCN_Logger::log_event_str(", mBMS_HCIndicator := "); single_value->field_mBMS__HCIndicator.log_match(match_value.mBMS__HCIndicator(), 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 MBMS__IPMulticastDistribution_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_type__gtpc.encode_text(text_buf); single_value->field_lengthf.encode_text(text_buf); single_value->field_commonTEID.encode_text(text_buf); single_value->field_iPmulticastDistributionAddress.encode_text(text_buf); single_value->field_iPmulticastSourceAddress.encode_text(text_buf); single_value->field_mBMS__HCIndicator.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 @GTPC_Types.MBMS_IPMulticastDistribution."); } } void MBMS__IPMulticastDistribution_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_type__gtpc.decode_text(text_buf); single_value->field_lengthf.decode_text(text_buf); single_value->field_commonTEID.decode_text(text_buf); single_value->field_iPmulticastDistributionAddress.decode_text(text_buf); single_value->field_iPmulticastSourceAddress.decode_text(text_buf); single_value->field_mBMS__HCIndicator.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 MBMS__IPMulticastDistribution_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 @GTPC_Types.MBMS_IPMulticastDistribution."); } } void MBMS__IPMulticastDistribution_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: { MBMS__IPMulticastDistribution_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) commonTEID().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) iPmulticastDistributionAddress().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) iPmulticastSourceAddress().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) mBMS__HCIndicator().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "commonTEID")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { commonTEID().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "iPmulticastDistributionAddress")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { iPmulticastDistributionAddress().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "iPmulticastSourceAddress")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { iPmulticastSourceAddress().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mBMS_HCIndicator")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mBMS__HCIndicator().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.MBMS_IPMulticastDistribution: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { MBMS__IPMulticastDistribution_template* precondition = new MBMS__IPMulticastDistribution_template; precondition->set_param(*param.get_elem(0)); MBMS__IPMulticastDistribution_template* implied_template = new MBMS__IPMulticastDistribution_template; implied_template->set_param(*param.get_elem(1)); *this = MBMS__IPMulticastDistribution_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.MBMS_IPMulticastDistribution"); } is_ifpresent = param.get_ifpresent(); } void MBMS__IPMulticastDistribution_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_type__gtpc.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.MBMS_IPMulticastDistribution"); single_value->field_lengthf.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.MBMS_IPMulticastDistribution"); single_value->field_commonTEID.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.MBMS_IPMulticastDistribution"); single_value->field_iPmulticastDistributionAddress.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.MBMS_IPMulticastDistribution"); single_value->field_iPmulticastSourceAddress.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.MBMS_IPMulticastDistribution"); single_value->field_mBMS__HCIndicator.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.MBMS_IPMulticastDistribution"); 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 : "@GTPC_Types.MBMS_IPMulticastDistribution"); } boolean MBMS__IPMulticastDistribution_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean MBMS__IPMulticastDistribution_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) distributionIndication().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) spare().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "distributionIndication")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { distributionIndication().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 @GTPC_Types.MBMS_DistributionAcknowledgement: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.MBMS_DistributionAcknowledgement"); } } void MBMS__DistributionAcknowledgement::encode_text(Text_Buf& text_buf) const { field_type__gtpc.encode_text(text_buf); field_lengthf.encode_text(text_buf); field_distributionIndication.encode_text(text_buf); field_spare.encode_text(text_buf); } void MBMS__DistributionAcknowledgement::decode_text(Text_Buf& text_buf) { field_type__gtpc.decode_text(text_buf); field_lengthf.decode_text(text_buf); field_distributionIndication.decode_text(text_buf); field_spare.decode_text(text_buf); } void MBMS__DistributionAcknowledgement::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 MBMS__DistributionAcknowledgement::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 MBMS__DistributionAcknowledgement::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; int value_of_length_field1 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_type__gtpc.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, MBMS__DistributionAcknowledgement_lengthf_descr_.raw->forceomit); decoded_field_length = field_lengthf.RAW_decode(MBMS__DistributionAcknowledgement_lengthf_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()); INTEGER tmp1 = field_lengthf.convert_to_Integer(MBMS__DistributionAcknowledgement_lengthf_descr_); field_lengthf = tmp1; value_of_length_field1 += tmp1.get_long_long_val() * 8; RAW_Force_Omit field_2_force_omit(2, force_omit, General__Types::BIT2_descr_.raw->forceomit); decoded_field_length = field_distributionIndication.RAW_decode(General__Types::BIT2_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::BIT6_descr_.raw->forceomit); decoded_field_length = field_spare.RAW_decode(General__Types::BIT6_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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_field1 -= decoded_field_length; if (field_type__gtpc != os_130) return -1; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int MBMS__DistributionAcknowledgement::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, MBMS__DistributionAcknowledgement_lengthf_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, General__Types::BIT2_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::BIT6_descr_.raw); encoded_length += field_type__gtpc.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += 16; myleaf.body.node.nodes[1]->calc = CALC_LENGTH; myleaf.body.node.nodes[1]->coding_descr = &MBMS__DistributionAcknowledgement_lengthf_descr_; myleaf.body.node.nodes[1]->calcof.lengthto.num_of_fields = 2; myleaf.body.node.nodes[1]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[1]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields = init_lengthto_fields_list(2); myleaf.body.node.nodes[1]->length = 16; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[2]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[2]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].level = myleaf.body.node.nodes[3]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].pos = myleaf.body.node.nodes[3]->curr_pos.pos; encoded_length += field_distributionIndication.RAW_encode(General__Types::BIT2_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_spare.RAW_encode(General__Types::BIT6_descr_, *myleaf.body.node.nodes[3]); if (field_type__gtpc != os_130) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={0}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ os_130.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 MBMS__DistributionAcknowledgement_template::single_value_struct { OCTETSTRING_template field_type__gtpc; INTEGER_template field_lengthf; BITSTRING_template field_distributionIndication; BITSTRING_template field_spare; }; void MBMS__DistributionAcknowledgement_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_type__gtpc = ANY_VALUE; single_value->field_lengthf = ANY_VALUE; single_value->field_distributionIndication = ANY_VALUE; single_value->field_spare = ANY_VALUE; } } } void MBMS__DistributionAcknowledgement_template::copy_value(const MBMS__DistributionAcknowledgement& other_value) { single_value = new single_value_struct; if (other_value.type__gtpc().is_bound()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (other_value.lengthf().is_bound()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (other_value.distributionIndication().is_bound()) { single_value->field_distributionIndication = other_value.distributionIndication(); } else { single_value->field_distributionIndication.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 MBMS__DistributionAcknowledgement_template::copy_template(const MBMS__DistributionAcknowledgement_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.type__gtpc().get_selection()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lengthf().get_selection()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.distributionIndication().get_selection()) { single_value->field_distributionIndication = other_value.distributionIndication(); } else { single_value->field_distributionIndication.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 MBMS__DistributionAcknowledgement_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 MBMS__DistributionAcknowledgement_template(*other_value.implication_.precondition); implication_.implied_template = new MBMS__DistributionAcknowledgement_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 @GTPC_Types.MBMS_DistributionAcknowledgement."); break; } set_selection(other_value); } MBMS__DistributionAcknowledgement_template::MBMS__DistributionAcknowledgement_template() { } MBMS__DistributionAcknowledgement_template::MBMS__DistributionAcknowledgement_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } MBMS__DistributionAcknowledgement_template::MBMS__DistributionAcknowledgement_template(const MBMS__DistributionAcknowledgement& other_value) { copy_value(other_value); } MBMS__DistributionAcknowledgement_template::MBMS__DistributionAcknowledgement_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const MBMS__DistributionAcknowledgement&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.MBMS_DistributionAcknowledgement from an unbound optional field."); } } MBMS__DistributionAcknowledgement_template::MBMS__DistributionAcknowledgement_template(MBMS__DistributionAcknowledgement_template* p_precondition, MBMS__DistributionAcknowledgement_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } MBMS__DistributionAcknowledgement_template::MBMS__DistributionAcknowledgement_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; } MBMS__DistributionAcknowledgement_template::MBMS__DistributionAcknowledgement_template(const MBMS__DistributionAcknowledgement_template& other_value) : Base_Template() { copy_template(other_value); } MBMS__DistributionAcknowledgement_template::~MBMS__DistributionAcknowledgement_template() { clean_up(); } MBMS__DistributionAcknowledgement_template& MBMS__DistributionAcknowledgement_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } MBMS__DistributionAcknowledgement_template& MBMS__DistributionAcknowledgement_template::operator=(const MBMS__DistributionAcknowledgement& other_value) { clean_up(); copy_value(other_value); return *this; } MBMS__DistributionAcknowledgement_template& MBMS__DistributionAcknowledgement_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const MBMS__DistributionAcknowledgement&)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 @GTPC_Types.MBMS_DistributionAcknowledgement."); } return *this; } MBMS__DistributionAcknowledgement_template& MBMS__DistributionAcknowledgement_template::operator=(const MBMS__DistributionAcknowledgement_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean MBMS__DistributionAcknowledgement_template::match(const MBMS__DistributionAcknowledgement& 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.type__gtpc().is_bound()) return FALSE; if(!single_value->field_type__gtpc.match(other_value.type__gtpc(), legacy))return FALSE; if(!other_value.lengthf().is_bound()) return FALSE; if(!single_value->field_lengthf.match(other_value.lengthf(), legacy))return FALSE; if(!other_value.distributionIndication().is_bound()) return FALSE; if(!single_value->field_distributionIndication.match(other_value.distributionIndication(), 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 @GTPC_Types.MBMS_DistributionAcknowledgement."); } return FALSE; } boolean MBMS__DistributionAcknowledgement_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_type__gtpc.is_bound() || single_value->field_lengthf.is_bound() || single_value->field_distributionIndication.is_bound() || single_value->field_spare.is_bound(); } boolean MBMS__DistributionAcknowledgement_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_type__gtpc.is_value() && single_value->field_lengthf.is_value() && single_value->field_distributionIndication.is_value() && single_value->field_spare.is_value(); } void MBMS__DistributionAcknowledgement_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; } MBMS__DistributionAcknowledgement MBMS__DistributionAcknowledgement_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 @GTPC_Types.MBMS_DistributionAcknowledgement."); MBMS__DistributionAcknowledgement ret_val; if (single_value->field_type__gtpc.is_bound()) { ret_val.type__gtpc() = single_value->field_type__gtpc.valueof(); } if (single_value->field_lengthf.is_bound()) { ret_val.lengthf() = single_value->field_lengthf.valueof(); } if (single_value->field_distributionIndication.is_bound()) { ret_val.distributionIndication() = single_value->field_distributionIndication.valueof(); } if (single_value->field_spare.is_bound()) { ret_val.spare() = single_value->field_spare.valueof(); } return ret_val; } void MBMS__DistributionAcknowledgement_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 @GTPC_Types.MBMS_DistributionAcknowledgement."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new MBMS__DistributionAcknowledgement_template[list_length]; } MBMS__DistributionAcknowledgement_template& MBMS__DistributionAcknowledgement_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 @GTPC_Types.MBMS_DistributionAcknowledgement."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.MBMS_DistributionAcknowledgement."); return value_list.list_value[list_index]; } OCTETSTRING_template& MBMS__DistributionAcknowledgement_template::type__gtpc() { set_specific(); return single_value->field_type__gtpc; } const OCTETSTRING_template& MBMS__DistributionAcknowledgement_template::type__gtpc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field type_gtpc of a non-specific template of type @GTPC_Types.MBMS_DistributionAcknowledgement."); return single_value->field_type__gtpc; } INTEGER_template& MBMS__DistributionAcknowledgement_template::lengthf() { set_specific(); return single_value->field_lengthf; } const INTEGER_template& MBMS__DistributionAcknowledgement_template::lengthf() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthf of a non-specific template of type @GTPC_Types.MBMS_DistributionAcknowledgement."); return single_value->field_lengthf; } BITSTRING_template& MBMS__DistributionAcknowledgement_template::distributionIndication() { set_specific(); return single_value->field_distributionIndication; } const BITSTRING_template& MBMS__DistributionAcknowledgement_template::distributionIndication() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field distributionIndication of a non-specific template of type @GTPC_Types.MBMS_DistributionAcknowledgement."); return single_value->field_distributionIndication; } BITSTRING_template& MBMS__DistributionAcknowledgement_template::spare() { set_specific(); return single_value->field_spare; } const BITSTRING_template& MBMS__DistributionAcknowledgement_template::spare() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field spare of a non-specific template of type @GTPC_Types.MBMS_DistributionAcknowledgement."); return single_value->field_spare; } int MBMS__DistributionAcknowledgement_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MBMS_DistributionAcknowledgement 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 @GTPC_Types.MBMS_DistributionAcknowledgement 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 @GTPC_Types.MBMS_DistributionAcknowledgement containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MBMS_DistributionAcknowledgement containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MBMS_DistributionAcknowledgement containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MBMS_DistributionAcknowledgement containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MBMS_DistributionAcknowledgement containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MBMS_DistributionAcknowledgement containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MBMS_DistributionAcknowledgement containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.MBMS_DistributionAcknowledgement."); } return 0; } void MBMS__DistributionAcknowledgement_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ type_gtpc := "); single_value->field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log(); TTCN_Logger::log_event_str(", distributionIndication := "); single_value->field_distributionIndication.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 MBMS__DistributionAcknowledgement_template::log_match(const MBMS__DistributionAcknowledgement& 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_type__gtpc.match(match_value.type__gtpc(), legacy)){ TTCN_Logger::log_logmatch_info(".type_gtpc"); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lengthf.match(match_value.lengthf(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthf"); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_distributionIndication.match(match_value.distributionIndication(), legacy)){ TTCN_Logger::log_logmatch_info(".distributionIndication"); single_value->field_distributionIndication.log_match(match_value.distributionIndication(), 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("{ type_gtpc := "); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::log_event_str(", distributionIndication := "); single_value->field_distributionIndication.log_match(match_value.distributionIndication(), 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 MBMS__DistributionAcknowledgement_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_type__gtpc.encode_text(text_buf); single_value->field_lengthf.encode_text(text_buf); single_value->field_distributionIndication.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 @GTPC_Types.MBMS_DistributionAcknowledgement."); } } void MBMS__DistributionAcknowledgement_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_type__gtpc.decode_text(text_buf); single_value->field_lengthf.decode_text(text_buf); single_value->field_distributionIndication.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 MBMS__DistributionAcknowledgement_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 @GTPC_Types.MBMS_DistributionAcknowledgement."); } } void MBMS__DistributionAcknowledgement_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: { MBMS__DistributionAcknowledgement_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) distributionIndication().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) spare().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "distributionIndication")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { distributionIndication().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 @GTPC_Types.MBMS_DistributionAcknowledgement: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { MBMS__DistributionAcknowledgement_template* precondition = new MBMS__DistributionAcknowledgement_template; precondition->set_param(*param.get_elem(0)); MBMS__DistributionAcknowledgement_template* implied_template = new MBMS__DistributionAcknowledgement_template; implied_template->set_param(*param.get_elem(1)); *this = MBMS__DistributionAcknowledgement_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.MBMS_DistributionAcknowledgement"); } is_ifpresent = param.get_ifpresent(); } void MBMS__DistributionAcknowledgement_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_type__gtpc.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.MBMS_DistributionAcknowledgement"); single_value->field_lengthf.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.MBMS_DistributionAcknowledgement"); single_value->field_distributionIndication.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.MBMS_DistributionAcknowledgement"); single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.MBMS_DistributionAcknowledgement"); 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 : "@GTPC_Types.MBMS_DistributionAcknowledgement"); } boolean MBMS__DistributionAcknowledgement_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean MBMS__DistributionAcknowledgement_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) reliableInterRATHandoverInfoIndicator().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) spare().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "reliableInterRATHandoverInfoIndicator")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { reliableInterRATHandoverInfoIndicator().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 @GTPC_Types.ReliableInterRATHandoverInfo: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.ReliableInterRATHandoverInfo"); } } void ReliableInterRATHandoverInfo::encode_text(Text_Buf& text_buf) const { field_type__gtpc.encode_text(text_buf); field_lengthf.encode_text(text_buf); field_reliableInterRATHandoverInfoIndicator.encode_text(text_buf); field_spare.encode_text(text_buf); } void ReliableInterRATHandoverInfo::decode_text(Text_Buf& text_buf) { field_type__gtpc.decode_text(text_buf); field_lengthf.decode_text(text_buf); field_reliableInterRATHandoverInfoIndicator.decode_text(text_buf); field_spare.decode_text(text_buf); } void ReliableInterRATHandoverInfo::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 ReliableInterRATHandoverInfo::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 ReliableInterRATHandoverInfo::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; int value_of_length_field1 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_type__gtpc.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, ReliableInterRATHandoverInfo_lengthf_descr_.raw->forceomit); decoded_field_length = field_lengthf.RAW_decode(ReliableInterRATHandoverInfo_lengthf_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()); INTEGER tmp1 = field_lengthf.convert_to_Integer(ReliableInterRATHandoverInfo_lengthf_descr_); field_lengthf = tmp1; value_of_length_field1 += tmp1.get_long_long_val() * 8; RAW_Force_Omit field_2_force_omit(2, force_omit, General__Types::BIT1_descr_.raw->forceomit); decoded_field_length = field_reliableInterRATHandoverInfoIndicator.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::BIT7_descr_.raw->forceomit); decoded_field_length = field_spare.RAW_decode(General__Types::BIT7_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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_field1 -= decoded_field_length; if (field_type__gtpc != os_91) return -1; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int ReliableInterRATHandoverInfo::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, ReliableInterRATHandoverInfo_lengthf_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, General__Types::BIT1_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::BIT7_descr_.raw); encoded_length += field_type__gtpc.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += 16; myleaf.body.node.nodes[1]->calc = CALC_LENGTH; myleaf.body.node.nodes[1]->coding_descr = &ReliableInterRATHandoverInfo_lengthf_descr_; myleaf.body.node.nodes[1]->calcof.lengthto.num_of_fields = 2; myleaf.body.node.nodes[1]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[1]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields = init_lengthto_fields_list(2); myleaf.body.node.nodes[1]->length = 16; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[2]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[2]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].level = myleaf.body.node.nodes[3]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].pos = myleaf.body.node.nodes[3]->curr_pos.pos; encoded_length += field_reliableInterRATHandoverInfoIndicator.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_spare.RAW_encode(General__Types::BIT7_descr_, *myleaf.body.node.nodes[3]); if (field_type__gtpc != os_91) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={0}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ os_91.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 ReliableInterRATHandoverInfo_template::single_value_struct { OCTETSTRING_template field_type__gtpc; INTEGER_template field_lengthf; BITSTRING_template field_reliableInterRATHandoverInfoIndicator; BITSTRING_template field_spare; }; void ReliableInterRATHandoverInfo_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_type__gtpc = ANY_VALUE; single_value->field_lengthf = ANY_VALUE; single_value->field_reliableInterRATHandoverInfoIndicator = ANY_VALUE; single_value->field_spare = ANY_VALUE; } } } void ReliableInterRATHandoverInfo_template::copy_value(const ReliableInterRATHandoverInfo& other_value) { single_value = new single_value_struct; if (other_value.type__gtpc().is_bound()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (other_value.lengthf().is_bound()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (other_value.reliableInterRATHandoverInfoIndicator().is_bound()) { single_value->field_reliableInterRATHandoverInfoIndicator = other_value.reliableInterRATHandoverInfoIndicator(); } else { single_value->field_reliableInterRATHandoverInfoIndicator.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 ReliableInterRATHandoverInfo_template::copy_template(const ReliableInterRATHandoverInfo_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.type__gtpc().get_selection()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lengthf().get_selection()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.reliableInterRATHandoverInfoIndicator().get_selection()) { single_value->field_reliableInterRATHandoverInfoIndicator = other_value.reliableInterRATHandoverInfoIndicator(); } else { single_value->field_reliableInterRATHandoverInfoIndicator.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 ReliableInterRATHandoverInfo_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 ReliableInterRATHandoverInfo_template(*other_value.implication_.precondition); implication_.implied_template = new ReliableInterRATHandoverInfo_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 @GTPC_Types.ReliableInterRATHandoverInfo."); break; } set_selection(other_value); } ReliableInterRATHandoverInfo_template::ReliableInterRATHandoverInfo_template() { } ReliableInterRATHandoverInfo_template::ReliableInterRATHandoverInfo_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } ReliableInterRATHandoverInfo_template::ReliableInterRATHandoverInfo_template(const ReliableInterRATHandoverInfo& other_value) { copy_value(other_value); } ReliableInterRATHandoverInfo_template::ReliableInterRATHandoverInfo_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const ReliableInterRATHandoverInfo&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.ReliableInterRATHandoverInfo from an unbound optional field."); } } ReliableInterRATHandoverInfo_template::ReliableInterRATHandoverInfo_template(ReliableInterRATHandoverInfo_template* p_precondition, ReliableInterRATHandoverInfo_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } ReliableInterRATHandoverInfo_template::ReliableInterRATHandoverInfo_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; } ReliableInterRATHandoverInfo_template::ReliableInterRATHandoverInfo_template(const ReliableInterRATHandoverInfo_template& other_value) : Base_Template() { copy_template(other_value); } ReliableInterRATHandoverInfo_template::~ReliableInterRATHandoverInfo_template() { clean_up(); } ReliableInterRATHandoverInfo_template& ReliableInterRATHandoverInfo_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } ReliableInterRATHandoverInfo_template& ReliableInterRATHandoverInfo_template::operator=(const ReliableInterRATHandoverInfo& other_value) { clean_up(); copy_value(other_value); return *this; } ReliableInterRATHandoverInfo_template& ReliableInterRATHandoverInfo_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const ReliableInterRATHandoverInfo&)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 @GTPC_Types.ReliableInterRATHandoverInfo."); } return *this; } ReliableInterRATHandoverInfo_template& ReliableInterRATHandoverInfo_template::operator=(const ReliableInterRATHandoverInfo_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean ReliableInterRATHandoverInfo_template::match(const ReliableInterRATHandoverInfo& 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.type__gtpc().is_bound()) return FALSE; if(!single_value->field_type__gtpc.match(other_value.type__gtpc(), legacy))return FALSE; if(!other_value.lengthf().is_bound()) return FALSE; if(!single_value->field_lengthf.match(other_value.lengthf(), legacy))return FALSE; if(!other_value.reliableInterRATHandoverInfoIndicator().is_bound()) return FALSE; if(!single_value->field_reliableInterRATHandoverInfoIndicator.match(other_value.reliableInterRATHandoverInfoIndicator(), 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 @GTPC_Types.ReliableInterRATHandoverInfo."); } return FALSE; } boolean ReliableInterRATHandoverInfo_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_type__gtpc.is_bound() || single_value->field_lengthf.is_bound() || single_value->field_reliableInterRATHandoverInfoIndicator.is_bound() || single_value->field_spare.is_bound(); } boolean ReliableInterRATHandoverInfo_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_type__gtpc.is_value() && single_value->field_lengthf.is_value() && single_value->field_reliableInterRATHandoverInfoIndicator.is_value() && single_value->field_spare.is_value(); } void ReliableInterRATHandoverInfo_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; } ReliableInterRATHandoverInfo ReliableInterRATHandoverInfo_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 @GTPC_Types.ReliableInterRATHandoverInfo."); ReliableInterRATHandoverInfo ret_val; if (single_value->field_type__gtpc.is_bound()) { ret_val.type__gtpc() = single_value->field_type__gtpc.valueof(); } if (single_value->field_lengthf.is_bound()) { ret_val.lengthf() = single_value->field_lengthf.valueof(); } if (single_value->field_reliableInterRATHandoverInfoIndicator.is_bound()) { ret_val.reliableInterRATHandoverInfoIndicator() = single_value->field_reliableInterRATHandoverInfoIndicator.valueof(); } if (single_value->field_spare.is_bound()) { ret_val.spare() = single_value->field_spare.valueof(); } return ret_val; } void ReliableInterRATHandoverInfo_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 @GTPC_Types.ReliableInterRATHandoverInfo."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new ReliableInterRATHandoverInfo_template[list_length]; } ReliableInterRATHandoverInfo_template& ReliableInterRATHandoverInfo_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 @GTPC_Types.ReliableInterRATHandoverInfo."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.ReliableInterRATHandoverInfo."); return value_list.list_value[list_index]; } OCTETSTRING_template& ReliableInterRATHandoverInfo_template::type__gtpc() { set_specific(); return single_value->field_type__gtpc; } const OCTETSTRING_template& ReliableInterRATHandoverInfo_template::type__gtpc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field type_gtpc of a non-specific template of type @GTPC_Types.ReliableInterRATHandoverInfo."); return single_value->field_type__gtpc; } INTEGER_template& ReliableInterRATHandoverInfo_template::lengthf() { set_specific(); return single_value->field_lengthf; } const INTEGER_template& ReliableInterRATHandoverInfo_template::lengthf() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthf of a non-specific template of type @GTPC_Types.ReliableInterRATHandoverInfo."); return single_value->field_lengthf; } BITSTRING_template& ReliableInterRATHandoverInfo_template::reliableInterRATHandoverInfoIndicator() { set_specific(); return single_value->field_reliableInterRATHandoverInfoIndicator; } const BITSTRING_template& ReliableInterRATHandoverInfo_template::reliableInterRATHandoverInfoIndicator() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field reliableInterRATHandoverInfoIndicator of a non-specific template of type @GTPC_Types.ReliableInterRATHandoverInfo."); return single_value->field_reliableInterRATHandoverInfoIndicator; } BITSTRING_template& ReliableInterRATHandoverInfo_template::spare() { set_specific(); return single_value->field_spare; } const BITSTRING_template& ReliableInterRATHandoverInfo_template::spare() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field spare of a non-specific template of type @GTPC_Types.ReliableInterRATHandoverInfo."); return single_value->field_spare; } int ReliableInterRATHandoverInfo_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.ReliableInterRATHandoverInfo 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 @GTPC_Types.ReliableInterRATHandoverInfo 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 @GTPC_Types.ReliableInterRATHandoverInfo containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.ReliableInterRATHandoverInfo containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.ReliableInterRATHandoverInfo containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.ReliableInterRATHandoverInfo containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.ReliableInterRATHandoverInfo containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.ReliableInterRATHandoverInfo containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.ReliableInterRATHandoverInfo containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.ReliableInterRATHandoverInfo."); } return 0; } void ReliableInterRATHandoverInfo_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ type_gtpc := "); single_value->field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log(); TTCN_Logger::log_event_str(", reliableInterRATHandoverInfoIndicator := "); single_value->field_reliableInterRATHandoverInfoIndicator.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 ReliableInterRATHandoverInfo_template::log_match(const ReliableInterRATHandoverInfo& 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_type__gtpc.match(match_value.type__gtpc(), legacy)){ TTCN_Logger::log_logmatch_info(".type_gtpc"); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lengthf.match(match_value.lengthf(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthf"); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_reliableInterRATHandoverInfoIndicator.match(match_value.reliableInterRATHandoverInfoIndicator(), legacy)){ TTCN_Logger::log_logmatch_info(".reliableInterRATHandoverInfoIndicator"); single_value->field_reliableInterRATHandoverInfoIndicator.log_match(match_value.reliableInterRATHandoverInfoIndicator(), 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("{ type_gtpc := "); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::log_event_str(", reliableInterRATHandoverInfoIndicator := "); single_value->field_reliableInterRATHandoverInfoIndicator.log_match(match_value.reliableInterRATHandoverInfoIndicator(), 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 ReliableInterRATHandoverInfo_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_type__gtpc.encode_text(text_buf); single_value->field_lengthf.encode_text(text_buf); single_value->field_reliableInterRATHandoverInfoIndicator.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 @GTPC_Types.ReliableInterRATHandoverInfo."); } } void ReliableInterRATHandoverInfo_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_type__gtpc.decode_text(text_buf); single_value->field_lengthf.decode_text(text_buf); single_value->field_reliableInterRATHandoverInfoIndicator.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 ReliableInterRATHandoverInfo_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 @GTPC_Types.ReliableInterRATHandoverInfo."); } } void ReliableInterRATHandoverInfo_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: { ReliableInterRATHandoverInfo_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) reliableInterRATHandoverInfoIndicator().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) spare().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "reliableInterRATHandoverInfoIndicator")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { reliableInterRATHandoverInfoIndicator().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 @GTPC_Types.ReliableInterRATHandoverInfo: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { ReliableInterRATHandoverInfo_template* precondition = new ReliableInterRATHandoverInfo_template; precondition->set_param(*param.get_elem(0)); ReliableInterRATHandoverInfo_template* implied_template = new ReliableInterRATHandoverInfo_template; implied_template->set_param(*param.get_elem(1)); *this = ReliableInterRATHandoverInfo_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.ReliableInterRATHandoverInfo"); } is_ifpresent = param.get_ifpresent(); } void ReliableInterRATHandoverInfo_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_type__gtpc.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.ReliableInterRATHandoverInfo"); single_value->field_lengthf.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.ReliableInterRATHandoverInfo"); single_value->field_reliableInterRATHandoverInfoIndicator.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.ReliableInterRATHandoverInfo"); single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.ReliableInterRATHandoverInfo"); 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 : "@GTPC_Types.ReliableInterRATHandoverInfo"); } boolean ReliableInterRATHandoverInfo_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean ReliableInterRATHandoverInfo_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) rFSPIndexValue().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "rFSPIndexValue")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rFSPIndexValue().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.RFSP_Index: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.RFSP_Index"); } } void RFSP__Index::encode_text(Text_Buf& text_buf) const { field_type__gtpc.encode_text(text_buf); field_lengthf.encode_text(text_buf); field_rFSPIndexValue.encode_text(text_buf); } void RFSP__Index::decode_text(Text_Buf& text_buf) { field_type__gtpc.decode_text(text_buf); field_lengthf.decode_text(text_buf); field_rFSPIndexValue.decode_text(text_buf); } void RFSP__Index::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 RFSP__Index::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 RFSP__Index::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; int value_of_length_field1 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_type__gtpc.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, RFSP__Index_lengthf_descr_.raw->forceomit); decoded_field_length = field_lengthf.RAW_decode(RFSP__Index_lengthf_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()); INTEGER tmp1 = field_lengthf.convert_to_Integer(RFSP__Index_lengthf_descr_); field_lengthf = tmp1; value_of_length_field1 += tmp1.get_long_long_val() * 8; RAW_Force_Omit field_2_force_omit(2, force_omit, General__Types::LIN2__BO__LAST_descr_.raw->forceomit); decoded_field_length = field_rFSPIndexValue.RAW_decode(General__Types::LIN2__BO__LAST_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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()); value_of_length_field1 -= decoded_field_length; if (field_type__gtpc != os_70) return -1; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int RFSP__Index::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, RFSP__Index_lengthf_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, General__Types::LIN2__BO__LAST_descr_.raw); encoded_length += field_type__gtpc.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += 16; myleaf.body.node.nodes[1]->calc = CALC_LENGTH; myleaf.body.node.nodes[1]->coding_descr = &RFSP__Index_lengthf_descr_; myleaf.body.node.nodes[1]->calcof.lengthto.num_of_fields = 1; myleaf.body.node.nodes[1]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[1]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields = init_lengthto_fields_list(1); myleaf.body.node.nodes[1]->length = 16; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[2]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[2]->curr_pos.pos; encoded_length += field_rFSPIndexValue.RAW_encode(General__Types::LIN2__BO__LAST_descr_, *myleaf.body.node.nodes[2]); if (field_type__gtpc != os_70) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={0}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ os_70.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 RFSP__Index_template::single_value_struct { OCTETSTRING_template field_type__gtpc; INTEGER_template field_lengthf; INTEGER_template field_rFSPIndexValue; }; void RFSP__Index_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_type__gtpc = ANY_VALUE; single_value->field_lengthf = ANY_VALUE; single_value->field_rFSPIndexValue = ANY_VALUE; } } } void RFSP__Index_template::copy_value(const RFSP__Index& other_value) { single_value = new single_value_struct; if (other_value.type__gtpc().is_bound()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (other_value.lengthf().is_bound()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (other_value.rFSPIndexValue().is_bound()) { single_value->field_rFSPIndexValue = other_value.rFSPIndexValue(); } else { single_value->field_rFSPIndexValue.clean_up(); } set_selection(SPECIFIC_VALUE); } void RFSP__Index_template::copy_template(const RFSP__Index_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.type__gtpc().get_selection()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lengthf().get_selection()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.rFSPIndexValue().get_selection()) { single_value->field_rFSPIndexValue = other_value.rFSPIndexValue(); } else { single_value->field_rFSPIndexValue.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 RFSP__Index_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 RFSP__Index_template(*other_value.implication_.precondition); implication_.implied_template = new RFSP__Index_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 @GTPC_Types.RFSP_Index."); break; } set_selection(other_value); } RFSP__Index_template::RFSP__Index_template() { } RFSP__Index_template::RFSP__Index_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } RFSP__Index_template::RFSP__Index_template(const RFSP__Index& other_value) { copy_value(other_value); } RFSP__Index_template::RFSP__Index_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const RFSP__Index&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.RFSP_Index from an unbound optional field."); } } RFSP__Index_template::RFSP__Index_template(RFSP__Index_template* p_precondition, RFSP__Index_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } RFSP__Index_template::RFSP__Index_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; } RFSP__Index_template::RFSP__Index_template(const RFSP__Index_template& other_value) : Base_Template() { copy_template(other_value); } RFSP__Index_template::~RFSP__Index_template() { clean_up(); } RFSP__Index_template& RFSP__Index_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } RFSP__Index_template& RFSP__Index_template::operator=(const RFSP__Index& other_value) { clean_up(); copy_value(other_value); return *this; } RFSP__Index_template& RFSP__Index_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const RFSP__Index&)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 @GTPC_Types.RFSP_Index."); } return *this; } RFSP__Index_template& RFSP__Index_template::operator=(const RFSP__Index_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean RFSP__Index_template::match(const RFSP__Index& 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.type__gtpc().is_bound()) return FALSE; if(!single_value->field_type__gtpc.match(other_value.type__gtpc(), legacy))return FALSE; if(!other_value.lengthf().is_bound()) return FALSE; if(!single_value->field_lengthf.match(other_value.lengthf(), legacy))return FALSE; if(!other_value.rFSPIndexValue().is_bound()) return FALSE; if(!single_value->field_rFSPIndexValue.match(other_value.rFSPIndexValue(), 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 @GTPC_Types.RFSP_Index."); } return FALSE; } boolean RFSP__Index_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_type__gtpc.is_bound() || single_value->field_lengthf.is_bound() || single_value->field_rFSPIndexValue.is_bound(); } boolean RFSP__Index_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_type__gtpc.is_value() && single_value->field_lengthf.is_value() && single_value->field_rFSPIndexValue.is_value(); } void RFSP__Index_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; } RFSP__Index RFSP__Index_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 @GTPC_Types.RFSP_Index."); RFSP__Index ret_val; if (single_value->field_type__gtpc.is_bound()) { ret_val.type__gtpc() = single_value->field_type__gtpc.valueof(); } if (single_value->field_lengthf.is_bound()) { ret_val.lengthf() = single_value->field_lengthf.valueof(); } if (single_value->field_rFSPIndexValue.is_bound()) { ret_val.rFSPIndexValue() = single_value->field_rFSPIndexValue.valueof(); } return ret_val; } void RFSP__Index_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 @GTPC_Types.RFSP_Index."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new RFSP__Index_template[list_length]; } RFSP__Index_template& RFSP__Index_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 @GTPC_Types.RFSP_Index."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.RFSP_Index."); return value_list.list_value[list_index]; } OCTETSTRING_template& RFSP__Index_template::type__gtpc() { set_specific(); return single_value->field_type__gtpc; } const OCTETSTRING_template& RFSP__Index_template::type__gtpc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field type_gtpc of a non-specific template of type @GTPC_Types.RFSP_Index."); return single_value->field_type__gtpc; } INTEGER_template& RFSP__Index_template::lengthf() { set_specific(); return single_value->field_lengthf; } const INTEGER_template& RFSP__Index_template::lengthf() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthf of a non-specific template of type @GTPC_Types.RFSP_Index."); return single_value->field_lengthf; } INTEGER_template& RFSP__Index_template::rFSPIndexValue() { set_specific(); return single_value->field_rFSPIndexValue; } const INTEGER_template& RFSP__Index_template::rFSPIndexValue() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field rFSPIndexValue of a non-specific template of type @GTPC_Types.RFSP_Index."); return single_value->field_rFSPIndexValue; } int RFSP__Index_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.RFSP_Index 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 @GTPC_Types.RFSP_Index 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 @GTPC_Types.RFSP_Index containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.RFSP_Index containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.RFSP_Index containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.RFSP_Index containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.RFSP_Index containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.RFSP_Index containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.RFSP_Index containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.RFSP_Index."); } return 0; } void RFSP__Index_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ type_gtpc := "); single_value->field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log(); TTCN_Logger::log_event_str(", rFSPIndexValue := "); single_value->field_rFSPIndexValue.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 RFSP__Index_template::log_match(const RFSP__Index& 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_type__gtpc.match(match_value.type__gtpc(), legacy)){ TTCN_Logger::log_logmatch_info(".type_gtpc"); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lengthf.match(match_value.lengthf(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthf"); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_rFSPIndexValue.match(match_value.rFSPIndexValue(), legacy)){ TTCN_Logger::log_logmatch_info(".rFSPIndexValue"); single_value->field_rFSPIndexValue.log_match(match_value.rFSPIndexValue(), 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("{ type_gtpc := "); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::log_event_str(", rFSPIndexValue := "); single_value->field_rFSPIndexValue.log_match(match_value.rFSPIndexValue(), 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 RFSP__Index_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_type__gtpc.encode_text(text_buf); single_value->field_lengthf.encode_text(text_buf); single_value->field_rFSPIndexValue.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 @GTPC_Types.RFSP_Index."); } } void RFSP__Index_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_type__gtpc.decode_text(text_buf); single_value->field_lengthf.decode_text(text_buf); single_value->field_rFSPIndexValue.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 RFSP__Index_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 @GTPC_Types.RFSP_Index."); } } void RFSP__Index_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: { RFSP__Index_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) rFSPIndexValue().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "rFSPIndexValue")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rFSPIndexValue().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.RFSP_Index: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { RFSP__Index_template* precondition = new RFSP__Index_template; precondition->set_param(*param.get_elem(0)); RFSP__Index_template* implied_template = new RFSP__Index_template; implied_template->set_param(*param.get_elem(1)); *this = RFSP__Index_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.RFSP_Index"); } is_ifpresent = param.get_ifpresent(); } void RFSP__Index_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_type__gtpc.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.RFSP_Index"); single_value->field_lengthf.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.RFSP_Index"); single_value->field_rFSPIndexValue.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.RFSP_Index"); 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 : "@GTPC_Types.RFSP_Index"); } boolean RFSP__Index_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean RFSP__Index_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; } FullyQualifiedDomainName__List::FullyQualifiedDomainName__List(const FullyQualifiedDomainName__List& other_value) { if (!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GTPC_Types.FullyQualifiedDomainName_List."); val_ptr = other_value.val_ptr; val_ptr->ref_count++; } FullyQualifiedDomainName__List::~FullyQualifiedDomainName__List() { clean_up(); if (val_ptr != NULL) val_ptr = NULL; } void FullyQualifiedDomainName__List::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."); } } FullyQualifiedDomainName__List& FullyQualifiedDomainName__List::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; } FullyQualifiedDomainName__List& FullyQualifiedDomainName__List::operator=(const FullyQualifiedDomainName__List& other_value) { if (other_value.val_ptr == NULL) TTCN_error("Assigning an unbound value of type @GTPC_Types.FullyQualifiedDomainName_List."); if (this != &other_value) { clean_up(); val_ptr = other_value.val_ptr; val_ptr->ref_count++; } return *this; } boolean FullyQualifiedDomainName__List::operator==(null_type) const { if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @GTPC_Types.FullyQualifiedDomainName_List."); return val_ptr->n_elements == 0 ; } boolean FullyQualifiedDomainName__List::operator==(const FullyQualifiedDomainName__List& other_value) const { if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @GTPC_Types.FullyQualifiedDomainName_List."); if (other_value.val_ptr == NULL) TTCN_error("The right operand of comparison is an unbound value of type @GTPC_Types.FullyQualifiedDomainName_List."); 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; } FullyQualifiedDomainName& FullyQualifiedDomainName__List::operator[](int index_value) { if (index_value < 0) TTCN_error("Accessing an element of type @GTPC_Types.FullyQualifiedDomainName_List 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 = (FullyQualifiedDomainName**)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 FullyQualifiedDomainName(*(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 FullyQualifiedDomainName; } return *val_ptr->value_elements[index_value]; } FullyQualifiedDomainName& FullyQualifiedDomainName__List::operator[](const INTEGER& index_value) { index_value.must_bound("Using an unbound integer value for indexing a value of type @GTPC_Types.FullyQualifiedDomainName_List."); return (*this)[(int)index_value]; } const FullyQualifiedDomainName& FullyQualifiedDomainName__List::operator[](int index_value) const { if (val_ptr == NULL) TTCN_error("Accessing an element in an unbound value of type @GTPC_Types.FullyQualifiedDomainName_List."); if (index_value < 0) TTCN_error("Accessing an element of type @GTPC_Types.FullyQualifiedDomainName_List using a negative index: %d.", index_value); if (index_value >= val_ptr->n_elements) TTCN_error("Index overflow in a value of type @GTPC_Types.FullyQualifiedDomainName_List: 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 FullyQualifiedDomainName& FullyQualifiedDomainName__List::operator[](const INTEGER& index_value) const { index_value.must_bound("Using an unbound integer value for indexing a value of type @GTPC_Types.FullyQualifiedDomainName_List."); return (*this)[(int)index_value]; } FullyQualifiedDomainName__List FullyQualifiedDomainName__List::operator<<=(int rotate_count) const { return *this >>= (-rotate_count); } FullyQualifiedDomainName__List FullyQualifiedDomainName__List::operator<<=(const INTEGER& rotate_count) const { rotate_count.must_bound("Unbound integer operand of rotate left operator."); return *this >>= (int)(-rotate_count); } FullyQualifiedDomainName__List FullyQualifiedDomainName__List::operator>>=(const INTEGER& rotate_count) const { rotate_count.must_bound("Unbound integer operand of rotate right operator."); return *this >>= (int)rotate_count; } FullyQualifiedDomainName__List FullyQualifiedDomainName__List::operator>>=(int rotate_count) const { if (val_ptr == NULL) TTCN_error("Performing rotation operation on an unbound value of type @GTPC_Types.FullyQualifiedDomainName_List."); 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; FullyQualifiedDomainName__List 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 FullyQualifiedDomainName(*val_ptr->value_elements[i]); } } return ret_val; } FullyQualifiedDomainName__List FullyQualifiedDomainName__List::operator+(const FullyQualifiedDomainName__List& other_value) const { if (val_ptr == NULL || other_value.val_ptr == NULL) TTCN_error("Unbound operand of @GTPC_Types.FullyQualifiedDomainName_List concatenation."); if (val_ptr->n_elements == 0) return other_value; if (other_value.val_ptr->n_elements == 0) return *this; FullyQualifiedDomainName__List 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 FullyQualifiedDomainName(*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 FullyQualifiedDomainName(*other_value.val_ptr->value_elements[i]); } } return ret_val; } FullyQualifiedDomainName__List FullyQualifiedDomainName__List::substr(int index, int returncount) const { if (val_ptr == NULL) TTCN_error("The first argument of substr() is an unbound value of type @GTPC_Types.FullyQualifiedDomainName_List."); check_substr_arguments(val_ptr->n_elements, index, returncount, "@GTPC_Types.FullyQualifiedDomainName_List","element"); FullyQualifiedDomainName__List ret_val; ret_val.set_size(returncount); for (int i=0; ivalue_elements[i+index] != NULL) { ret_val.val_ptr->value_elements[i] = new FullyQualifiedDomainName(*val_ptr->value_elements[i+index]); } } return ret_val; } FullyQualifiedDomainName__List FullyQualifiedDomainName__List::replace(int index, int len, const FullyQualifiedDomainName__List& repl) const { if (val_ptr == NULL) TTCN_error("The first argument of replace() is an unbound value of type @GTPC_Types.FullyQualifiedDomainName_List."); if (repl.val_ptr == NULL) TTCN_error("The fourth argument of replace() is an unbound value of type @GTPC_Types.FullyQualifiedDomainName_List."); check_replace_arguments(val_ptr->n_elements, index, len, "@GTPC_Types.FullyQualifiedDomainName_List","element"); FullyQualifiedDomainName__List 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 FullyQualifiedDomainName(*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 FullyQualifiedDomainName(*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 FullyQualifiedDomainName(*val_ptr->value_elements[index+i+len]); } } return ret_val; } FullyQualifiedDomainName__List FullyQualifiedDomainName__List::replace(int index, int len, const FullyQualifiedDomainName__List_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 FullyQualifiedDomainName__List::set_size(int new_size) { if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a value of type @GTPC_Types.FullyQualifiedDomainName_List."); 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 = (FullyQualifiedDomainName**)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 FullyQualifiedDomainName(*(val_ptr->value_elements[elem_count])); } } clean_up(); val_ptr = new_val_ptr; } if (new_size > val_ptr->n_elements) { val_ptr->value_elements = (FullyQualifiedDomainName**)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 @GTPC_Types.FullyQualifiedDomainName_List: %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 = (FullyQualifiedDomainName**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size); val_ptr->n_elements = new_size; } } boolean FullyQualifiedDomainName__List::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 FullyQualifiedDomainName__List::size_of() const { if (val_ptr == NULL) TTCN_error("Performing sizeof operation on an unbound value of type @GTPC_Types.FullyQualifiedDomainName_List."); return val_ptr->n_elements; } int FullyQualifiedDomainName__List::lengthof() const { if (val_ptr == NULL) TTCN_error("Performing lengthof operation on an unbound value of type @GTPC_Types.FullyQualifiedDomainName_List."); 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 FullyQualifiedDomainName__List::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 FullyQualifiedDomainName__List::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 FullyQualifiedDomainName__List::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", "@GTPC_Types.FullyQualifiedDomainName_List"); } 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", "@GTPC_Types.FullyQualifiedDomainName_List"); } break; default: TTCN_error("Internal error: Unknown operation type."); } } void FullyQualifiedDomainName__List::encode_text(Text_Buf& text_buf) const { if (val_ptr == NULL) TTCN_error("Text encoder: Encoding an unbound value of type @GTPC_Types.FullyQualifiedDomainName_List."); 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 FullyQualifiedDomainName__List::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 @GTPC_Types.FullyQualifiedDomainName_List."); val_ptr->value_elements = (FullyQualifiedDomainName**)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 FullyQualifiedDomainName; val_ptr->value_elements[elem_count]->decode_text(text_buf); } } void FullyQualifiedDomainName__List::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 FullyQualifiedDomainName__List::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 FullyQualifiedDomainName__List::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 FullyQualifiedDomainName__List::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 FullyQualifiedDomainName__List_template::copy_value(const FullyQualifiedDomainName__List& other_value) { if (!other_value.is_bound()) TTCN_error("Initialization of a template of type @GTPC_Types.FullyQualifiedDomainName_List with an unbound value."); single_value.n_elements = other_value.size_of(); single_value.value_elements = (FullyQualifiedDomainName_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 FullyQualifiedDomainName_template(other_value[elem_count]); } else { single_value.value_elements[elem_count] = new FullyQualifiedDomainName_template; } } set_selection(SPECIFIC_VALUE); } void FullyQualifiedDomainName__List_template::copy_template(const FullyQualifiedDomainName__List_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 = (FullyQualifiedDomainName_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 FullyQualifiedDomainName_template(*other_value.single_value.value_elements[elem_count]); } else { single_value.value_elements[elem_count] = new FullyQualifiedDomainName_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 FullyQualifiedDomainName__List_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 FullyQualifiedDomainName__List_template(*other_value.implication_.precondition); implication_.implied_template = new FullyQualifiedDomainName__List_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 @GTPC_Types.FullyQualifiedDomainName_List."); break; } set_selection(other_value); } boolean FullyQualifiedDomainName__List_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 FullyQualifiedDomainName__List_template*)template_ptr)->single_value.value_elements[template_index]->match((*(const FullyQualifiedDomainName__List*)value_ptr)[value_index], legacy); else return ((const FullyQualifiedDomainName__List_template*)template_ptr)->single_value.value_elements[template_index]->is_any_or_omit(); } FullyQualifiedDomainName__List_template::FullyQualifiedDomainName__List_template() { } FullyQualifiedDomainName__List_template::FullyQualifiedDomainName__List_template(template_sel other_value) : Base_Record_Of_Template(other_value) { check_single_selection(other_value); } FullyQualifiedDomainName__List_template::FullyQualifiedDomainName__List_template(null_type) : Base_Record_Of_Template(SPECIFIC_VALUE) { single_value.n_elements = 0; single_value.value_elements = NULL; } FullyQualifiedDomainName__List_template::FullyQualifiedDomainName__List_template(const FullyQualifiedDomainName__List& other_value) { copy_value(other_value); } FullyQualifiedDomainName__List_template::FullyQualifiedDomainName__List_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const FullyQualifiedDomainName__List&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.FullyQualifiedDomainName_List from an unbound optional field."); } } FullyQualifiedDomainName__List_template::FullyQualifiedDomainName__List_template(FullyQualifiedDomainName__List_template* p_precondition, FullyQualifiedDomainName__List_template* p_implied_template) : Base_Record_Of_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } FullyQualifiedDomainName__List_template::FullyQualifiedDomainName__List_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; } FullyQualifiedDomainName__List_template::FullyQualifiedDomainName__List_template(const FullyQualifiedDomainName__List_template& other_value) : Base_Record_Of_Template() { copy_template(other_value); } FullyQualifiedDomainName__List_template::~FullyQualifiedDomainName__List_template() { clean_up(); } void FullyQualifiedDomainName__List_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; } FullyQualifiedDomainName__List_template& FullyQualifiedDomainName__List_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } FullyQualifiedDomainName__List_template& FullyQualifiedDomainName__List_template::operator=(null_type) { clean_up(); set_selection(SPECIFIC_VALUE); single_value.n_elements = 0; single_value.value_elements = NULL; return *this; } FullyQualifiedDomainName__List_template& FullyQualifiedDomainName__List_template::operator=(const FullyQualifiedDomainName__List& other_value) { clean_up(); copy_value(other_value); return *this; } FullyQualifiedDomainName__List_template& FullyQualifiedDomainName__List_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const FullyQualifiedDomainName__List&)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 @GTPC_Types.FullyQualifiedDomainName_List."); } return *this; } FullyQualifiedDomainName__List_template& FullyQualifiedDomainName__List_template::operator=(const FullyQualifiedDomainName__List_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } FullyQualifiedDomainName_template& FullyQualifiedDomainName__List_template::operator[](int index_value) { if (index_value < 0) TTCN_error("Accessing an element of a template for type @GTPC_Types.FullyQualifiedDomainName_List 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 @GTPC_Types.FullyQualifiedDomainName_List."); break; } return *single_value.value_elements[index_value]; } FullyQualifiedDomainName_template& FullyQualifiedDomainName__List_template::operator[](const INTEGER& index_value) { index_value.must_bound("Using an unbound integer value for indexing a template of type @GTPC_Types.FullyQualifiedDomainName_List."); return (*this)[(int)index_value]; } const FullyQualifiedDomainName_template& FullyQualifiedDomainName__List_template::operator[](int index_value) const { if (index_value < 0) TTCN_error("Accessing an element of a template for type @GTPC_Types.FullyQualifiedDomainName_List using a negative index: %d.", index_value); if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing an element of a non-specific template for type @GTPC_Types.FullyQualifiedDomainName_List."); if (index_value >= single_value.n_elements) TTCN_error("Index overflow in a template of type @GTPC_Types.FullyQualifiedDomainName_List: 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 FullyQualifiedDomainName_template& FullyQualifiedDomainName__List_template::operator[](const INTEGER& index_value) const { index_value.must_bound("Using an unbound integer value for indexing a template of type @GTPC_Types.FullyQualifiedDomainName_List."); return (*this)[(int)index_value]; } void FullyQualifiedDomainName__List_template::set_size(int new_size) { if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a template of type @GTPC_Types.FullyQualifiedDomainName_List."); 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 = (FullyQualifiedDomainName_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 FullyQualifiedDomainName_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 FullyQualifiedDomainName_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 = (FullyQualifiedDomainName_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size); single_value.n_elements = new_size; } } int FullyQualifiedDomainName__List_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 FullyQualifiedDomainName__List_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 @GTPC_Types.FullyQualifiedDomainName_List 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 @GTPC_Types.FullyQualifiedDomainName_List 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 @GTPC_Types.FullyQualifiedDomainName_List 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 @GTPC_Types.FullyQualifiedDomainName_List 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 @GTPC_Types.FullyQualifiedDomainName_List 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 @GTPC_Types.FullyQualifiedDomainName_List containing complemented list.", op_name); default: TTCN_error("Performing %sof() operation on an uninitialized/unsupported template of type @GTPC_Types.FullyQualifiedDomainName_List.", op_name); } return check_section_is_single(min_size, has_any_or_none, op_name, "a", "template of type @GTPC_Types.FullyQualifiedDomainName_List"); } boolean FullyQualifiedDomainName__List_template::match(const FullyQualifiedDomainName__List& 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 @GTPC_Types.FullyQualifiedDomainName_List."); } return FALSE; } boolean FullyQualifiedDomainName__List_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; } FullyQualifiedDomainName__List FullyQualifiedDomainName__List_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 @GTPC_Types.FullyQualifiedDomainName_List."); FullyQualifiedDomainName__List 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; } FullyQualifiedDomainName__List FullyQualifiedDomainName__List_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); } FullyQualifiedDomainName__List FullyQualifiedDomainName__List_template::replace(int index, int len, const FullyQualifiedDomainName__List_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()); } FullyQualifiedDomainName__List FullyQualifiedDomainName__List_template::replace(int index, int len, const FullyQualifiedDomainName__List& 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 FullyQualifiedDomainName__List_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 FullyQualifiedDomainName__List_template[list_length]; break; default: TTCN_error("Internal error: Setting an invalid type for a template of type @GTPC_Types.FullyQualifiedDomainName_List."); } set_selection(template_type); } FullyQualifiedDomainName__List_template& FullyQualifiedDomainName__List_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 @GTPC_Types.FullyQualifiedDomainName_List."); if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of type @GTPC_Types.FullyQualifiedDomainName_List."); return value_list.list_value[list_index]; } void FullyQualifiedDomainName__List_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 FullyQualifiedDomainName__List_template::log_match(const FullyQualifiedDomainName__List& 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 FullyQualifiedDomainName__List_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 @GTPC_Types.FullyQualifiedDomainName_List."); } } void FullyQualifiedDomainName__List_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 @GTPC_Types.FullyQualifiedDomainName_List."); single_value.value_elements = (FullyQualifiedDomainName_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 FullyQualifiedDomainName_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 FullyQualifiedDomainName__List_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 @GTPC_Types.FullyQualifiedDomainName_List."); } } boolean FullyQualifiedDomainName__List_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean FullyQualifiedDomainName__List_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: { FullyQualifiedDomainName__List_template* precondition = new FullyQualifiedDomainName__List_template; precondition->set_param(*param.get_elem(0)); FullyQualifiedDomainName__List_template* implied_template = new FullyQualifiedDomainName__List_template; implied_template->set_param(*param.get_elem(1)); *this = FullyQualifiedDomainName__List_template(precondition, implied_template); } break; default: param.type_error("record of template", "@GTPC_Types.FullyQualifiedDomainName_List"); } is_ifpresent = param.get_ifpresent(); set_length_range(param); } void FullyQualifiedDomainName__List_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 : "@GTPC_Types.FullyQualifiedDomainName_List"); 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 : "@GTPC_Types.FullyQualifiedDomainName_List"); } boolean FullyQualifiedDomainName__List_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); } } FullyQualifiedDomainName::FullyQualifiedDomainName() { } FullyQualifiedDomainName::FullyQualifiedDomainName(const OCTETSTRING& par_type__gtpc, const INTEGER& par_lengthf, const OCTETSTRING& par_fQDN__Value) : field_type__gtpc(par_type__gtpc), field_lengthf(par_lengthf), field_fQDN__Value(par_fQDN__Value) { } FullyQualifiedDomainName::FullyQualifiedDomainName(const FullyQualifiedDomainName& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GTPC_Types.FullyQualifiedDomainName."); if (other_value.type__gtpc().is_bound()) field_type__gtpc = other_value.type__gtpc(); else field_type__gtpc.clean_up(); if (other_value.lengthf().is_bound()) field_lengthf = other_value.lengthf(); else field_lengthf.clean_up(); if (other_value.fQDN__Value().is_bound()) field_fQDN__Value = other_value.fQDN__Value(); else field_fQDN__Value.clean_up(); } void FullyQualifiedDomainName::clean_up() { field_type__gtpc.clean_up(); field_lengthf.clean_up(); field_fQDN__Value.clean_up(); } const TTCN_Typedescriptor_t* FullyQualifiedDomainName::get_descriptor() const { return &FullyQualifiedDomainName_descr_; } FullyQualifiedDomainName& FullyQualifiedDomainName::operator=(const FullyQualifiedDomainName& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GTPC_Types.FullyQualifiedDomainName."); if (other_value.type__gtpc().is_bound()) field_type__gtpc = other_value.type__gtpc(); else field_type__gtpc.clean_up(); if (other_value.lengthf().is_bound()) field_lengthf = other_value.lengthf(); else field_lengthf.clean_up(); if (other_value.fQDN__Value().is_bound()) field_fQDN__Value = other_value.fQDN__Value(); else field_fQDN__Value.clean_up(); } return *this; } boolean FullyQualifiedDomainName::operator==(const FullyQualifiedDomainName& other_value) const { return field_type__gtpc==other_value.field_type__gtpc && field_lengthf==other_value.field_lengthf && field_fQDN__Value==other_value.field_fQDN__Value; } boolean FullyQualifiedDomainName::is_bound() const { return (field_type__gtpc.is_bound()) || (field_lengthf.is_bound()) || (field_fQDN__Value.is_bound()); } boolean FullyQualifiedDomainName::is_value() const { return field_type__gtpc.is_value() && field_lengthf.is_value() && field_fQDN__Value.is_value(); } void FullyQualifiedDomainName::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ type_gtpc := "); field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); field_lengthf.log(); TTCN_Logger::log_event_str(", fQDN_Value := "); field_fQDN__Value.log(); TTCN_Logger::log_event_str(" }"); } void FullyQualifiedDomainName::set_implicit_omit() { if (type__gtpc().is_bound()) type__gtpc().set_implicit_omit(); if (lengthf().is_bound()) lengthf().set_implicit_omit(); if (fQDN__Value().is_bound()) fQDN__Value().set_implicit_omit(); } void FullyQualifiedDomainName::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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) fQDN__Value().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "fQDN_Value")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { fQDN__Value().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.FullyQualifiedDomainName: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.FullyQualifiedDomainName"); } } void FullyQualifiedDomainName::encode_text(Text_Buf& text_buf) const { field_type__gtpc.encode_text(text_buf); field_lengthf.encode_text(text_buf); field_fQDN__Value.encode_text(text_buf); } void FullyQualifiedDomainName::decode_text(Text_Buf& text_buf) { field_type__gtpc.decode_text(text_buf); field_lengthf.decode_text(text_buf); field_fQDN__Value.decode_text(text_buf); } void FullyQualifiedDomainName::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 FullyQualifiedDomainName::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 FullyQualifiedDomainName::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; int value_of_length_field1 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_type__gtpc.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, FullyQualifiedDomainName_lengthf_descr_.raw->forceomit); decoded_field_length = field_lengthf.RAW_decode(FullyQualifiedDomainName_lengthf_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()); INTEGER tmp1 = field_lengthf.convert_to_Integer(FullyQualifiedDomainName_lengthf_descr_); field_lengthf = tmp1; value_of_length_field1 += tmp1.get_long_long_val() * 8; RAW_Force_Omit field_2_force_omit(2, force_omit, OCTETSTRING_descr_.raw->forceomit); decoded_field_length = field_fQDN__Value.RAW_decode(OCTETSTRING_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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()); value_of_length_field1 -= decoded_field_length; if (field_type__gtpc != os_71) return -1; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int FullyQualifiedDomainName::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, FullyQualifiedDomainName_lengthf_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, OCTETSTRING_descr_.raw); encoded_length += field_type__gtpc.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += 16; myleaf.body.node.nodes[1]->calc = CALC_LENGTH; myleaf.body.node.nodes[1]->coding_descr = &FullyQualifiedDomainName_lengthf_descr_; myleaf.body.node.nodes[1]->calcof.lengthto.num_of_fields = 1; myleaf.body.node.nodes[1]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[1]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields = init_lengthto_fields_list(1); myleaf.body.node.nodes[1]->length = 16; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[2]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[2]->curr_pos.pos; encoded_length += field_fQDN__Value.RAW_encode(OCTETSTRING_descr_, *myleaf.body.node.nodes[2]); if (field_type__gtpc != os_71) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={0}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ os_71.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 FullyQualifiedDomainName_template::single_value_struct { OCTETSTRING_template field_type__gtpc; INTEGER_template field_lengthf; OCTETSTRING_template field_fQDN__Value; }; void FullyQualifiedDomainName_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_type__gtpc = ANY_VALUE; single_value->field_lengthf = ANY_VALUE; single_value->field_fQDN__Value = ANY_VALUE; } } } void FullyQualifiedDomainName_template::copy_value(const FullyQualifiedDomainName& other_value) { single_value = new single_value_struct; if (other_value.type__gtpc().is_bound()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (other_value.lengthf().is_bound()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (other_value.fQDN__Value().is_bound()) { single_value->field_fQDN__Value = other_value.fQDN__Value(); } else { single_value->field_fQDN__Value.clean_up(); } set_selection(SPECIFIC_VALUE); } void FullyQualifiedDomainName_template::copy_template(const FullyQualifiedDomainName_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.type__gtpc().get_selection()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lengthf().get_selection()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.fQDN__Value().get_selection()) { single_value->field_fQDN__Value = other_value.fQDN__Value(); } else { single_value->field_fQDN__Value.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 FullyQualifiedDomainName_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 FullyQualifiedDomainName_template(*other_value.implication_.precondition); implication_.implied_template = new FullyQualifiedDomainName_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 @GTPC_Types.FullyQualifiedDomainName."); break; } set_selection(other_value); } FullyQualifiedDomainName_template::FullyQualifiedDomainName_template() { } FullyQualifiedDomainName_template::FullyQualifiedDomainName_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } FullyQualifiedDomainName_template::FullyQualifiedDomainName_template(const FullyQualifiedDomainName& other_value) { copy_value(other_value); } FullyQualifiedDomainName_template::FullyQualifiedDomainName_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const FullyQualifiedDomainName&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.FullyQualifiedDomainName from an unbound optional field."); } } FullyQualifiedDomainName_template::FullyQualifiedDomainName_template(FullyQualifiedDomainName_template* p_precondition, FullyQualifiedDomainName_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } FullyQualifiedDomainName_template::FullyQualifiedDomainName_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; } FullyQualifiedDomainName_template::FullyQualifiedDomainName_template(const FullyQualifiedDomainName_template& other_value) : Base_Template() { copy_template(other_value); } FullyQualifiedDomainName_template::~FullyQualifiedDomainName_template() { clean_up(); } FullyQualifiedDomainName_template& FullyQualifiedDomainName_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } FullyQualifiedDomainName_template& FullyQualifiedDomainName_template::operator=(const FullyQualifiedDomainName& other_value) { clean_up(); copy_value(other_value); return *this; } FullyQualifiedDomainName_template& FullyQualifiedDomainName_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const FullyQualifiedDomainName&)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 @GTPC_Types.FullyQualifiedDomainName."); } return *this; } FullyQualifiedDomainName_template& FullyQualifiedDomainName_template::operator=(const FullyQualifiedDomainName_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean FullyQualifiedDomainName_template::match(const FullyQualifiedDomainName& 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.type__gtpc().is_bound()) return FALSE; if(!single_value->field_type__gtpc.match(other_value.type__gtpc(), legacy))return FALSE; if(!other_value.lengthf().is_bound()) return FALSE; if(!single_value->field_lengthf.match(other_value.lengthf(), legacy))return FALSE; if(!other_value.fQDN__Value().is_bound()) return FALSE; if(!single_value->field_fQDN__Value.match(other_value.fQDN__Value(), 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 @GTPC_Types.FullyQualifiedDomainName."); } return FALSE; } boolean FullyQualifiedDomainName_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_type__gtpc.is_bound() || single_value->field_lengthf.is_bound() || single_value->field_fQDN__Value.is_bound(); } boolean FullyQualifiedDomainName_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_type__gtpc.is_value() && single_value->field_lengthf.is_value() && single_value->field_fQDN__Value.is_value(); } void FullyQualifiedDomainName_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; } FullyQualifiedDomainName FullyQualifiedDomainName_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 @GTPC_Types.FullyQualifiedDomainName."); FullyQualifiedDomainName ret_val; if (single_value->field_type__gtpc.is_bound()) { ret_val.type__gtpc() = single_value->field_type__gtpc.valueof(); } if (single_value->field_lengthf.is_bound()) { ret_val.lengthf() = single_value->field_lengthf.valueof(); } if (single_value->field_fQDN__Value.is_bound()) { ret_val.fQDN__Value() = single_value->field_fQDN__Value.valueof(); } return ret_val; } void FullyQualifiedDomainName_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 @GTPC_Types.FullyQualifiedDomainName."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new FullyQualifiedDomainName_template[list_length]; } FullyQualifiedDomainName_template& FullyQualifiedDomainName_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 @GTPC_Types.FullyQualifiedDomainName."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.FullyQualifiedDomainName."); return value_list.list_value[list_index]; } OCTETSTRING_template& FullyQualifiedDomainName_template::type__gtpc() { set_specific(); return single_value->field_type__gtpc; } const OCTETSTRING_template& FullyQualifiedDomainName_template::type__gtpc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field type_gtpc of a non-specific template of type @GTPC_Types.FullyQualifiedDomainName."); return single_value->field_type__gtpc; } INTEGER_template& FullyQualifiedDomainName_template::lengthf() { set_specific(); return single_value->field_lengthf; } const INTEGER_template& FullyQualifiedDomainName_template::lengthf() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthf of a non-specific template of type @GTPC_Types.FullyQualifiedDomainName."); return single_value->field_lengthf; } OCTETSTRING_template& FullyQualifiedDomainName_template::fQDN__Value() { set_specific(); return single_value->field_fQDN__Value; } const OCTETSTRING_template& FullyQualifiedDomainName_template::fQDN__Value() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field fQDN_Value of a non-specific template of type @GTPC_Types.FullyQualifiedDomainName."); return single_value->field_fQDN__Value; } int FullyQualifiedDomainName_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.FullyQualifiedDomainName 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 @GTPC_Types.FullyQualifiedDomainName 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 @GTPC_Types.FullyQualifiedDomainName containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.FullyQualifiedDomainName containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.FullyQualifiedDomainName containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.FullyQualifiedDomainName containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.FullyQualifiedDomainName containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.FullyQualifiedDomainName containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.FullyQualifiedDomainName containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.FullyQualifiedDomainName."); } return 0; } void FullyQualifiedDomainName_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ type_gtpc := "); single_value->field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log(); TTCN_Logger::log_event_str(", fQDN_Value := "); single_value->field_fQDN__Value.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 FullyQualifiedDomainName_template::log_match(const FullyQualifiedDomainName& 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_type__gtpc.match(match_value.type__gtpc(), legacy)){ TTCN_Logger::log_logmatch_info(".type_gtpc"); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lengthf.match(match_value.lengthf(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthf"); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_fQDN__Value.match(match_value.fQDN__Value(), legacy)){ TTCN_Logger::log_logmatch_info(".fQDN_Value"); single_value->field_fQDN__Value.log_match(match_value.fQDN__Value(), 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("{ type_gtpc := "); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::log_event_str(", fQDN_Value := "); single_value->field_fQDN__Value.log_match(match_value.fQDN__Value(), 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 FullyQualifiedDomainName_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_type__gtpc.encode_text(text_buf); single_value->field_lengthf.encode_text(text_buf); single_value->field_fQDN__Value.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 @GTPC_Types.FullyQualifiedDomainName."); } } void FullyQualifiedDomainName_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_type__gtpc.decode_text(text_buf); single_value->field_lengthf.decode_text(text_buf); single_value->field_fQDN__Value.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 FullyQualifiedDomainName_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 @GTPC_Types.FullyQualifiedDomainName."); } } void FullyQualifiedDomainName_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: { FullyQualifiedDomainName_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) fQDN__Value().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "fQDN_Value")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { fQDN__Value().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.FullyQualifiedDomainName: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { FullyQualifiedDomainName_template* precondition = new FullyQualifiedDomainName_template; precondition->set_param(*param.get_elem(0)); FullyQualifiedDomainName_template* implied_template = new FullyQualifiedDomainName_template; implied_template->set_param(*param.get_elem(1)); *this = FullyQualifiedDomainName_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.FullyQualifiedDomainName"); } is_ifpresent = param.get_ifpresent(); } void FullyQualifiedDomainName_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_type__gtpc.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.FullyQualifiedDomainName"); single_value->field_lengthf.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.FullyQualifiedDomainName"); single_value->field_fQDN__Value.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.FullyQualifiedDomainName"); 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 : "@GTPC_Types.FullyQualifiedDomainName"); } boolean FullyQualifiedDomainName_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean FullyQualifiedDomainName_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) pVI().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) spare1().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) pL().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) pCI().set_param(*param.get_elem(5)); if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) spare2().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "pVI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { pVI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "spare1")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare1().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "pL")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { pL().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "pCI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { pCI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "spare2")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare2().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.EvolvedAllocationRetentionPriorityI: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.EvolvedAllocationRetentionPriorityI"); } } void EvolvedAllocationRetentionPriorityI::encode_text(Text_Buf& text_buf) const { field_type__gtpc.encode_text(text_buf); field_lengthf.encode_text(text_buf); field_pVI.encode_text(text_buf); field_spare1.encode_text(text_buf); field_pL.encode_text(text_buf); field_pCI.encode_text(text_buf); field_spare2.encode_text(text_buf); } void EvolvedAllocationRetentionPriorityI::decode_text(Text_Buf& text_buf) { field_type__gtpc.decode_text(text_buf); field_lengthf.decode_text(text_buf); field_pVI.decode_text(text_buf); field_spare1.decode_text(text_buf); field_pL.decode_text(text_buf); field_pCI.decode_text(text_buf); field_spare2.decode_text(text_buf); } void EvolvedAllocationRetentionPriorityI::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 EvolvedAllocationRetentionPriorityI::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 EvolvedAllocationRetentionPriorityI::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; int value_of_length_field1 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_type__gtpc.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, EvolvedAllocationRetentionPriorityI_lengthf_descr_.raw->forceomit); decoded_field_length = field_lengthf.RAW_decode(EvolvedAllocationRetentionPriorityI_lengthf_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()); INTEGER tmp1 = field_lengthf.convert_to_Integer(EvolvedAllocationRetentionPriorityI_lengthf_descr_); field_lengthf = tmp1; value_of_length_field1 += tmp1.get_long_long_val() * 8; RAW_Force_Omit field_2_force_omit(2, force_omit, General__Types::BIT1_descr_.raw->forceomit); decoded_field_length = field_pVI.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::BIT1_descr_.raw->forceomit); decoded_field_length = field_spare1.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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_field1 -= decoded_field_length; RAW_Force_Omit field_4_force_omit(4, force_omit, EvolvedAllocationRetentionPriorityI_pL_descr_.raw->forceomit); decoded_field_length = field_pL.RAW_decode(EvolvedAllocationRetentionPriorityI_pL_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, no_err, -1, TRUE, &field_4_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_5_force_omit(5, force_omit, General__Types::BIT1_descr_.raw->forceomit); decoded_field_length = field_pCI.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, no_err, -1, TRUE, &field_5_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_6_force_omit(6, force_omit, General__Types::BIT1_descr_.raw->forceomit); decoded_field_length = field_spare2.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, no_err, -1, TRUE, &field_6_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); value_of_length_field1 -= decoded_field_length; if (field_type__gtpc != os_34) return -1; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int EvolvedAllocationRetentionPriorityI::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, EvolvedAllocationRetentionPriorityI_lengthf_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, General__Types::BIT1_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::BIT1_descr_.raw); myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, EvolvedAllocationRetentionPriorityI_pL_descr_.raw); myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, General__Types::BIT1_descr_.raw); myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, General__Types::BIT1_descr_.raw); encoded_length += field_type__gtpc.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += 16; myleaf.body.node.nodes[1]->calc = CALC_LENGTH; myleaf.body.node.nodes[1]->coding_descr = &EvolvedAllocationRetentionPriorityI_lengthf_descr_; myleaf.body.node.nodes[1]->calcof.lengthto.num_of_fields = 5; myleaf.body.node.nodes[1]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[1]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields = init_lengthto_fields_list(5); myleaf.body.node.nodes[1]->length = 16; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[2]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[2]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].level = myleaf.body.node.nodes[3]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].pos = myleaf.body.node.nodes[3]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].level = myleaf.body.node.nodes[4]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].pos = myleaf.body.node.nodes[4]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[3].level = myleaf.body.node.nodes[5]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[3].pos = myleaf.body.node.nodes[5]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[4].level = myleaf.body.node.nodes[6]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[4].pos = myleaf.body.node.nodes[6]->curr_pos.pos; encoded_length += field_pVI.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_spare1.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[3]); encoded_length += field_pL.RAW_encode(EvolvedAllocationRetentionPriorityI_pL_descr_, *myleaf.body.node.nodes[4]); encoded_length += field_pCI.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[5]); encoded_length += field_spare2.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[6]); if (field_type__gtpc != os_34) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={0}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ os_34.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 EvolvedAllocationRetentionPriorityI_template::single_value_struct { OCTETSTRING_template field_type__gtpc; INTEGER_template field_lengthf; BITSTRING_template field_pVI; BITSTRING_template field_spare1; INTEGER_template field_pL; BITSTRING_template field_pCI; BITSTRING_template field_spare2; }; void EvolvedAllocationRetentionPriorityI_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_type__gtpc = ANY_VALUE; single_value->field_lengthf = ANY_VALUE; single_value->field_pVI = ANY_VALUE; single_value->field_spare1 = ANY_VALUE; single_value->field_pL = ANY_VALUE; single_value->field_pCI = ANY_VALUE; single_value->field_spare2 = ANY_VALUE; } } } void EvolvedAllocationRetentionPriorityI_template::copy_value(const EvolvedAllocationRetentionPriorityI& other_value) { single_value = new single_value_struct; if (other_value.type__gtpc().is_bound()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (other_value.lengthf().is_bound()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (other_value.pVI().is_bound()) { single_value->field_pVI = other_value.pVI(); } else { single_value->field_pVI.clean_up(); } if (other_value.spare1().is_bound()) { single_value->field_spare1 = other_value.spare1(); } else { single_value->field_spare1.clean_up(); } if (other_value.pL().is_bound()) { single_value->field_pL = other_value.pL(); } else { single_value->field_pL.clean_up(); } if (other_value.pCI().is_bound()) { single_value->field_pCI = other_value.pCI(); } else { single_value->field_pCI.clean_up(); } if (other_value.spare2().is_bound()) { single_value->field_spare2 = other_value.spare2(); } else { single_value->field_spare2.clean_up(); } set_selection(SPECIFIC_VALUE); } void EvolvedAllocationRetentionPriorityI_template::copy_template(const EvolvedAllocationRetentionPriorityI_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.type__gtpc().get_selection()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lengthf().get_selection()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.pVI().get_selection()) { single_value->field_pVI = other_value.pVI(); } else { single_value->field_pVI.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.spare1().get_selection()) { single_value->field_spare1 = other_value.spare1(); } else { single_value->field_spare1.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.pL().get_selection()) { single_value->field_pL = other_value.pL(); } else { single_value->field_pL.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.pCI().get_selection()) { single_value->field_pCI = other_value.pCI(); } else { single_value->field_pCI.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.spare2().get_selection()) { single_value->field_spare2 = other_value.spare2(); } else { single_value->field_spare2.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 EvolvedAllocationRetentionPriorityI_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 EvolvedAllocationRetentionPriorityI_template(*other_value.implication_.precondition); implication_.implied_template = new EvolvedAllocationRetentionPriorityI_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 @GTPC_Types.EvolvedAllocationRetentionPriorityI."); break; } set_selection(other_value); } EvolvedAllocationRetentionPriorityI_template::EvolvedAllocationRetentionPriorityI_template() { } EvolvedAllocationRetentionPriorityI_template::EvolvedAllocationRetentionPriorityI_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } EvolvedAllocationRetentionPriorityI_template::EvolvedAllocationRetentionPriorityI_template(const EvolvedAllocationRetentionPriorityI& other_value) { copy_value(other_value); } EvolvedAllocationRetentionPriorityI_template::EvolvedAllocationRetentionPriorityI_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const EvolvedAllocationRetentionPriorityI&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.EvolvedAllocationRetentionPriorityI from an unbound optional field."); } } EvolvedAllocationRetentionPriorityI_template::EvolvedAllocationRetentionPriorityI_template(EvolvedAllocationRetentionPriorityI_template* p_precondition, EvolvedAllocationRetentionPriorityI_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } EvolvedAllocationRetentionPriorityI_template::EvolvedAllocationRetentionPriorityI_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; } EvolvedAllocationRetentionPriorityI_template::EvolvedAllocationRetentionPriorityI_template(const EvolvedAllocationRetentionPriorityI_template& other_value) : Base_Template() { copy_template(other_value); } EvolvedAllocationRetentionPriorityI_template::~EvolvedAllocationRetentionPriorityI_template() { clean_up(); } EvolvedAllocationRetentionPriorityI_template& EvolvedAllocationRetentionPriorityI_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } EvolvedAllocationRetentionPriorityI_template& EvolvedAllocationRetentionPriorityI_template::operator=(const EvolvedAllocationRetentionPriorityI& other_value) { clean_up(); copy_value(other_value); return *this; } EvolvedAllocationRetentionPriorityI_template& EvolvedAllocationRetentionPriorityI_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const EvolvedAllocationRetentionPriorityI&)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 @GTPC_Types.EvolvedAllocationRetentionPriorityI."); } return *this; } EvolvedAllocationRetentionPriorityI_template& EvolvedAllocationRetentionPriorityI_template::operator=(const EvolvedAllocationRetentionPriorityI_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean EvolvedAllocationRetentionPriorityI_template::match(const EvolvedAllocationRetentionPriorityI& 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.type__gtpc().is_bound()) return FALSE; if(!single_value->field_type__gtpc.match(other_value.type__gtpc(), legacy))return FALSE; if(!other_value.lengthf().is_bound()) return FALSE; if(!single_value->field_lengthf.match(other_value.lengthf(), legacy))return FALSE; if(!other_value.pVI().is_bound()) return FALSE; if(!single_value->field_pVI.match(other_value.pVI(), legacy))return FALSE; if(!other_value.spare1().is_bound()) return FALSE; if(!single_value->field_spare1.match(other_value.spare1(), legacy))return FALSE; if(!other_value.pL().is_bound()) return FALSE; if(!single_value->field_pL.match(other_value.pL(), legacy))return FALSE; if(!other_value.pCI().is_bound()) return FALSE; if(!single_value->field_pCI.match(other_value.pCI(), legacy))return FALSE; if(!other_value.spare2().is_bound()) return FALSE; if(!single_value->field_spare2.match(other_value.spare2(), 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 @GTPC_Types.EvolvedAllocationRetentionPriorityI."); } return FALSE; } boolean EvolvedAllocationRetentionPriorityI_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_type__gtpc.is_bound() || single_value->field_lengthf.is_bound() || single_value->field_pVI.is_bound() || single_value->field_spare1.is_bound() || single_value->field_pL.is_bound() || single_value->field_pCI.is_bound() || single_value->field_spare2.is_bound(); } boolean EvolvedAllocationRetentionPriorityI_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_type__gtpc.is_value() && single_value->field_lengthf.is_value() && single_value->field_pVI.is_value() && single_value->field_spare1.is_value() && single_value->field_pL.is_value() && single_value->field_pCI.is_value() && single_value->field_spare2.is_value(); } void EvolvedAllocationRetentionPriorityI_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; } EvolvedAllocationRetentionPriorityI EvolvedAllocationRetentionPriorityI_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 @GTPC_Types.EvolvedAllocationRetentionPriorityI."); EvolvedAllocationRetentionPriorityI ret_val; if (single_value->field_type__gtpc.is_bound()) { ret_val.type__gtpc() = single_value->field_type__gtpc.valueof(); } if (single_value->field_lengthf.is_bound()) { ret_val.lengthf() = single_value->field_lengthf.valueof(); } if (single_value->field_pVI.is_bound()) { ret_val.pVI() = single_value->field_pVI.valueof(); } if (single_value->field_spare1.is_bound()) { ret_val.spare1() = single_value->field_spare1.valueof(); } if (single_value->field_pL.is_bound()) { ret_val.pL() = single_value->field_pL.valueof(); } if (single_value->field_pCI.is_bound()) { ret_val.pCI() = single_value->field_pCI.valueof(); } if (single_value->field_spare2.is_bound()) { ret_val.spare2() = single_value->field_spare2.valueof(); } return ret_val; } void EvolvedAllocationRetentionPriorityI_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 @GTPC_Types.EvolvedAllocationRetentionPriorityI."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new EvolvedAllocationRetentionPriorityI_template[list_length]; } EvolvedAllocationRetentionPriorityI_template& EvolvedAllocationRetentionPriorityI_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 @GTPC_Types.EvolvedAllocationRetentionPriorityI."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.EvolvedAllocationRetentionPriorityI."); return value_list.list_value[list_index]; } OCTETSTRING_template& EvolvedAllocationRetentionPriorityI_template::type__gtpc() { set_specific(); return single_value->field_type__gtpc; } const OCTETSTRING_template& EvolvedAllocationRetentionPriorityI_template::type__gtpc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field type_gtpc of a non-specific template of type @GTPC_Types.EvolvedAllocationRetentionPriorityI."); return single_value->field_type__gtpc; } INTEGER_template& EvolvedAllocationRetentionPriorityI_template::lengthf() { set_specific(); return single_value->field_lengthf; } const INTEGER_template& EvolvedAllocationRetentionPriorityI_template::lengthf() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthf of a non-specific template of type @GTPC_Types.EvolvedAllocationRetentionPriorityI."); return single_value->field_lengthf; } BITSTRING_template& EvolvedAllocationRetentionPriorityI_template::pVI() { set_specific(); return single_value->field_pVI; } const BITSTRING_template& EvolvedAllocationRetentionPriorityI_template::pVI() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field pVI of a non-specific template of type @GTPC_Types.EvolvedAllocationRetentionPriorityI."); return single_value->field_pVI; } BITSTRING_template& EvolvedAllocationRetentionPriorityI_template::spare1() { set_specific(); return single_value->field_spare1; } const BITSTRING_template& EvolvedAllocationRetentionPriorityI_template::spare1() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field spare1 of a non-specific template of type @GTPC_Types.EvolvedAllocationRetentionPriorityI."); return single_value->field_spare1; } INTEGER_template& EvolvedAllocationRetentionPriorityI_template::pL() { set_specific(); return single_value->field_pL; } const INTEGER_template& EvolvedAllocationRetentionPriorityI_template::pL() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field pL of a non-specific template of type @GTPC_Types.EvolvedAllocationRetentionPriorityI."); return single_value->field_pL; } BITSTRING_template& EvolvedAllocationRetentionPriorityI_template::pCI() { set_specific(); return single_value->field_pCI; } const BITSTRING_template& EvolvedAllocationRetentionPriorityI_template::pCI() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field pCI of a non-specific template of type @GTPC_Types.EvolvedAllocationRetentionPriorityI."); return single_value->field_pCI; } BITSTRING_template& EvolvedAllocationRetentionPriorityI_template::spare2() { set_specific(); return single_value->field_spare2; } const BITSTRING_template& EvolvedAllocationRetentionPriorityI_template::spare2() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field spare2 of a non-specific template of type @GTPC_Types.EvolvedAllocationRetentionPriorityI."); return single_value->field_spare2; } int EvolvedAllocationRetentionPriorityI_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.EvolvedAllocationRetentionPriorityI which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 7; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @GTPC_Types.EvolvedAllocationRetentionPriorityI 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 @GTPC_Types.EvolvedAllocationRetentionPriorityI containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.EvolvedAllocationRetentionPriorityI containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.EvolvedAllocationRetentionPriorityI containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.EvolvedAllocationRetentionPriorityI containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.EvolvedAllocationRetentionPriorityI containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.EvolvedAllocationRetentionPriorityI containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.EvolvedAllocationRetentionPriorityI containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.EvolvedAllocationRetentionPriorityI."); } return 0; } void EvolvedAllocationRetentionPriorityI_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ type_gtpc := "); single_value->field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log(); TTCN_Logger::log_event_str(", pVI := "); single_value->field_pVI.log(); TTCN_Logger::log_event_str(", spare1 := "); single_value->field_spare1.log(); TTCN_Logger::log_event_str(", pL := "); single_value->field_pL.log(); TTCN_Logger::log_event_str(", pCI := "); single_value->field_pCI.log(); TTCN_Logger::log_event_str(", spare2 := "); single_value->field_spare2.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 EvolvedAllocationRetentionPriorityI_template::log_match(const EvolvedAllocationRetentionPriorityI& 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_type__gtpc.match(match_value.type__gtpc(), legacy)){ TTCN_Logger::log_logmatch_info(".type_gtpc"); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lengthf.match(match_value.lengthf(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthf"); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_pVI.match(match_value.pVI(), legacy)){ TTCN_Logger::log_logmatch_info(".pVI"); single_value->field_pVI.log_match(match_value.pVI(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_spare1.match(match_value.spare1(), legacy)){ TTCN_Logger::log_logmatch_info(".spare1"); single_value->field_spare1.log_match(match_value.spare1(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_pL.match(match_value.pL(), legacy)){ TTCN_Logger::log_logmatch_info(".pL"); single_value->field_pL.log_match(match_value.pL(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_pCI.match(match_value.pCI(), legacy)){ TTCN_Logger::log_logmatch_info(".pCI"); single_value->field_pCI.log_match(match_value.pCI(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_spare2.match(match_value.spare2(), legacy)){ TTCN_Logger::log_logmatch_info(".spare2"); single_value->field_spare2.log_match(match_value.spare2(), 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("{ type_gtpc := "); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::log_event_str(", pVI := "); single_value->field_pVI.log_match(match_value.pVI(), legacy); TTCN_Logger::log_event_str(", spare1 := "); single_value->field_spare1.log_match(match_value.spare1(), legacy); TTCN_Logger::log_event_str(", pL := "); single_value->field_pL.log_match(match_value.pL(), legacy); TTCN_Logger::log_event_str(", pCI := "); single_value->field_pCI.log_match(match_value.pCI(), legacy); TTCN_Logger::log_event_str(", spare2 := "); single_value->field_spare2.log_match(match_value.spare2(), 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 EvolvedAllocationRetentionPriorityI_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_type__gtpc.encode_text(text_buf); single_value->field_lengthf.encode_text(text_buf); single_value->field_pVI.encode_text(text_buf); single_value->field_spare1.encode_text(text_buf); single_value->field_pL.encode_text(text_buf); single_value->field_pCI.encode_text(text_buf); single_value->field_spare2.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 @GTPC_Types.EvolvedAllocationRetentionPriorityI."); } } void EvolvedAllocationRetentionPriorityI_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_type__gtpc.decode_text(text_buf); single_value->field_lengthf.decode_text(text_buf); single_value->field_pVI.decode_text(text_buf); single_value->field_spare1.decode_text(text_buf); single_value->field_pL.decode_text(text_buf); single_value->field_pCI.decode_text(text_buf); single_value->field_spare2.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 EvolvedAllocationRetentionPriorityI_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 @GTPC_Types.EvolvedAllocationRetentionPriorityI."); } } void EvolvedAllocationRetentionPriorityI_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: { EvolvedAllocationRetentionPriorityI_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) pVI().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) spare1().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) pL().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) pCI().set_param(*param.get_elem(5)); if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) spare2().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "pVI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { pVI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "spare1")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare1().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "pL")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { pL().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "pCI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { pCI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "spare2")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare2().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.EvolvedAllocationRetentionPriorityI: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { EvolvedAllocationRetentionPriorityI_template* precondition = new EvolvedAllocationRetentionPriorityI_template; precondition->set_param(*param.get_elem(0)); EvolvedAllocationRetentionPriorityI_template* implied_template = new EvolvedAllocationRetentionPriorityI_template; implied_template->set_param(*param.get_elem(1)); *this = EvolvedAllocationRetentionPriorityI_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.EvolvedAllocationRetentionPriorityI"); } is_ifpresent = param.get_ifpresent(); } void EvolvedAllocationRetentionPriorityI_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_type__gtpc.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.EvolvedAllocationRetentionPriorityI"); single_value->field_lengthf.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.EvolvedAllocationRetentionPriorityI"); single_value->field_pVI.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.EvolvedAllocationRetentionPriorityI"); single_value->field_spare1.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.EvolvedAllocationRetentionPriorityI"); single_value->field_pL.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.EvolvedAllocationRetentionPriorityI"); single_value->field_pCI.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.EvolvedAllocationRetentionPriorityI"); single_value->field_spare2.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.EvolvedAllocationRetentionPriorityI"); 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 : "@GTPC_Types.EvolvedAllocationRetentionPriorityI"); } boolean EvolvedAllocationRetentionPriorityI_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean EvolvedAllocationRetentionPriorityI_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; } EvolvedAllocationRetentionPriorityII__List::EvolvedAllocationRetentionPriorityII__List(const EvolvedAllocationRetentionPriorityII__List& other_value) { if (!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GTPC_Types.EvolvedAllocationRetentionPriorityII_List."); val_ptr = other_value.val_ptr; val_ptr->ref_count++; } EvolvedAllocationRetentionPriorityII__List::~EvolvedAllocationRetentionPriorityII__List() { clean_up(); if (val_ptr != NULL) val_ptr = NULL; } void EvolvedAllocationRetentionPriorityII__List::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."); } } EvolvedAllocationRetentionPriorityII__List& EvolvedAllocationRetentionPriorityII__List::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; } EvolvedAllocationRetentionPriorityII__List& EvolvedAllocationRetentionPriorityII__List::operator=(const EvolvedAllocationRetentionPriorityII__List& other_value) { if (other_value.val_ptr == NULL) TTCN_error("Assigning an unbound value of type @GTPC_Types.EvolvedAllocationRetentionPriorityII_List."); if (this != &other_value) { clean_up(); val_ptr = other_value.val_ptr; val_ptr->ref_count++; } return *this; } boolean EvolvedAllocationRetentionPriorityII__List::operator==(null_type) const { if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @GTPC_Types.EvolvedAllocationRetentionPriorityII_List."); return val_ptr->n_elements == 0 ; } boolean EvolvedAllocationRetentionPriorityII__List::operator==(const EvolvedAllocationRetentionPriorityII__List& other_value) const { if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @GTPC_Types.EvolvedAllocationRetentionPriorityII_List."); if (other_value.val_ptr == NULL) TTCN_error("The right operand of comparison is an unbound value of type @GTPC_Types.EvolvedAllocationRetentionPriorityII_List."); 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; } EvolvedAllocationRetentionPriorityII& EvolvedAllocationRetentionPriorityII__List::operator[](int index_value) { if (index_value < 0) TTCN_error("Accessing an element of type @GTPC_Types.EvolvedAllocationRetentionPriorityII_List 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 = (EvolvedAllocationRetentionPriorityII**)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 EvolvedAllocationRetentionPriorityII(*(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 EvolvedAllocationRetentionPriorityII; } return *val_ptr->value_elements[index_value]; } EvolvedAllocationRetentionPriorityII& EvolvedAllocationRetentionPriorityII__List::operator[](const INTEGER& index_value) { index_value.must_bound("Using an unbound integer value for indexing a value of type @GTPC_Types.EvolvedAllocationRetentionPriorityII_List."); return (*this)[(int)index_value]; } const EvolvedAllocationRetentionPriorityII& EvolvedAllocationRetentionPriorityII__List::operator[](int index_value) const { if (val_ptr == NULL) TTCN_error("Accessing an element in an unbound value of type @GTPC_Types.EvolvedAllocationRetentionPriorityII_List."); if (index_value < 0) TTCN_error("Accessing an element of type @GTPC_Types.EvolvedAllocationRetentionPriorityII_List using a negative index: %d.", index_value); if (index_value >= val_ptr->n_elements) TTCN_error("Index overflow in a value of type @GTPC_Types.EvolvedAllocationRetentionPriorityII_List: 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 EvolvedAllocationRetentionPriorityII& EvolvedAllocationRetentionPriorityII__List::operator[](const INTEGER& index_value) const { index_value.must_bound("Using an unbound integer value for indexing a value of type @GTPC_Types.EvolvedAllocationRetentionPriorityII_List."); return (*this)[(int)index_value]; } EvolvedAllocationRetentionPriorityII__List EvolvedAllocationRetentionPriorityII__List::operator<<=(int rotate_count) const { return *this >>= (-rotate_count); } EvolvedAllocationRetentionPriorityII__List EvolvedAllocationRetentionPriorityII__List::operator<<=(const INTEGER& rotate_count) const { rotate_count.must_bound("Unbound integer operand of rotate left operator."); return *this >>= (int)(-rotate_count); } EvolvedAllocationRetentionPriorityII__List EvolvedAllocationRetentionPriorityII__List::operator>>=(const INTEGER& rotate_count) const { rotate_count.must_bound("Unbound integer operand of rotate right operator."); return *this >>= (int)rotate_count; } EvolvedAllocationRetentionPriorityII__List EvolvedAllocationRetentionPriorityII__List::operator>>=(int rotate_count) const { if (val_ptr == NULL) TTCN_error("Performing rotation operation on an unbound value of type @GTPC_Types.EvolvedAllocationRetentionPriorityII_List."); 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; EvolvedAllocationRetentionPriorityII__List 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 EvolvedAllocationRetentionPriorityII(*val_ptr->value_elements[i]); } } return ret_val; } EvolvedAllocationRetentionPriorityII__List EvolvedAllocationRetentionPriorityII__List::operator+(const EvolvedAllocationRetentionPriorityII__List& other_value) const { if (val_ptr == NULL || other_value.val_ptr == NULL) TTCN_error("Unbound operand of @GTPC_Types.EvolvedAllocationRetentionPriorityII_List concatenation."); if (val_ptr->n_elements == 0) return other_value; if (other_value.val_ptr->n_elements == 0) return *this; EvolvedAllocationRetentionPriorityII__List 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 EvolvedAllocationRetentionPriorityII(*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 EvolvedAllocationRetentionPriorityII(*other_value.val_ptr->value_elements[i]); } } return ret_val; } EvolvedAllocationRetentionPriorityII__List EvolvedAllocationRetentionPriorityII__List::substr(int index, int returncount) const { if (val_ptr == NULL) TTCN_error("The first argument of substr() is an unbound value of type @GTPC_Types.EvolvedAllocationRetentionPriorityII_List."); check_substr_arguments(val_ptr->n_elements, index, returncount, "@GTPC_Types.EvolvedAllocationRetentionPriorityII_List","element"); EvolvedAllocationRetentionPriorityII__List ret_val; ret_val.set_size(returncount); for (int i=0; ivalue_elements[i+index] != NULL) { ret_val.val_ptr->value_elements[i] = new EvolvedAllocationRetentionPriorityII(*val_ptr->value_elements[i+index]); } } return ret_val; } EvolvedAllocationRetentionPriorityII__List EvolvedAllocationRetentionPriorityII__List::replace(int index, int len, const EvolvedAllocationRetentionPriorityII__List& repl) const { if (val_ptr == NULL) TTCN_error("The first argument of replace() is an unbound value of type @GTPC_Types.EvolvedAllocationRetentionPriorityII_List."); if (repl.val_ptr == NULL) TTCN_error("The fourth argument of replace() is an unbound value of type @GTPC_Types.EvolvedAllocationRetentionPriorityII_List."); check_replace_arguments(val_ptr->n_elements, index, len, "@GTPC_Types.EvolvedAllocationRetentionPriorityII_List","element"); EvolvedAllocationRetentionPriorityII__List 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 EvolvedAllocationRetentionPriorityII(*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 EvolvedAllocationRetentionPriorityII(*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 EvolvedAllocationRetentionPriorityII(*val_ptr->value_elements[index+i+len]); } } return ret_val; } EvolvedAllocationRetentionPriorityII__List EvolvedAllocationRetentionPriorityII__List::replace(int index, int len, const EvolvedAllocationRetentionPriorityII__List_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 EvolvedAllocationRetentionPriorityII__List::set_size(int new_size) { if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a value of type @GTPC_Types.EvolvedAllocationRetentionPriorityII_List."); 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 = (EvolvedAllocationRetentionPriorityII**)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 EvolvedAllocationRetentionPriorityII(*(val_ptr->value_elements[elem_count])); } } clean_up(); val_ptr = new_val_ptr; } if (new_size > val_ptr->n_elements) { val_ptr->value_elements = (EvolvedAllocationRetentionPriorityII**)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 @GTPC_Types.EvolvedAllocationRetentionPriorityII_List: %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 = (EvolvedAllocationRetentionPriorityII**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size); val_ptr->n_elements = new_size; } } boolean EvolvedAllocationRetentionPriorityII__List::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 EvolvedAllocationRetentionPriorityII__List::size_of() const { if (val_ptr == NULL) TTCN_error("Performing sizeof operation on an unbound value of type @GTPC_Types.EvolvedAllocationRetentionPriorityII_List."); return val_ptr->n_elements; } int EvolvedAllocationRetentionPriorityII__List::lengthof() const { if (val_ptr == NULL) TTCN_error("Performing lengthof operation on an unbound value of type @GTPC_Types.EvolvedAllocationRetentionPriorityII_List."); 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 EvolvedAllocationRetentionPriorityII__List::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 EvolvedAllocationRetentionPriorityII__List::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 EvolvedAllocationRetentionPriorityII__List::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", "@GTPC_Types.EvolvedAllocationRetentionPriorityII_List"); } 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", "@GTPC_Types.EvolvedAllocationRetentionPriorityII_List"); } break; default: TTCN_error("Internal error: Unknown operation type."); } } void EvolvedAllocationRetentionPriorityII__List::encode_text(Text_Buf& text_buf) const { if (val_ptr == NULL) TTCN_error("Text encoder: Encoding an unbound value of type @GTPC_Types.EvolvedAllocationRetentionPriorityII_List."); 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 EvolvedAllocationRetentionPriorityII__List::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 @GTPC_Types.EvolvedAllocationRetentionPriorityII_List."); val_ptr->value_elements = (EvolvedAllocationRetentionPriorityII**)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 EvolvedAllocationRetentionPriorityII; val_ptr->value_elements[elem_count]->decode_text(text_buf); } } void EvolvedAllocationRetentionPriorityII__List::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 EvolvedAllocationRetentionPriorityII__List::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 EvolvedAllocationRetentionPriorityII__List::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 EvolvedAllocationRetentionPriorityII__List::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 EvolvedAllocationRetentionPriorityII__List_template::copy_value(const EvolvedAllocationRetentionPriorityII__List& other_value) { if (!other_value.is_bound()) TTCN_error("Initialization of a template of type @GTPC_Types.EvolvedAllocationRetentionPriorityII_List with an unbound value."); single_value.n_elements = other_value.size_of(); single_value.value_elements = (EvolvedAllocationRetentionPriorityII_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 EvolvedAllocationRetentionPriorityII_template(other_value[elem_count]); } else { single_value.value_elements[elem_count] = new EvolvedAllocationRetentionPriorityII_template; } } set_selection(SPECIFIC_VALUE); } void EvolvedAllocationRetentionPriorityII__List_template::copy_template(const EvolvedAllocationRetentionPriorityII__List_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 = (EvolvedAllocationRetentionPriorityII_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 EvolvedAllocationRetentionPriorityII_template(*other_value.single_value.value_elements[elem_count]); } else { single_value.value_elements[elem_count] = new EvolvedAllocationRetentionPriorityII_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 EvolvedAllocationRetentionPriorityII__List_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 EvolvedAllocationRetentionPriorityII__List_template(*other_value.implication_.precondition); implication_.implied_template = new EvolvedAllocationRetentionPriorityII__List_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 @GTPC_Types.EvolvedAllocationRetentionPriorityII_List."); break; } set_selection(other_value); } boolean EvolvedAllocationRetentionPriorityII__List_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 EvolvedAllocationRetentionPriorityII__List_template*)template_ptr)->single_value.value_elements[template_index]->match((*(const EvolvedAllocationRetentionPriorityII__List*)value_ptr)[value_index], legacy); else return ((const EvolvedAllocationRetentionPriorityII__List_template*)template_ptr)->single_value.value_elements[template_index]->is_any_or_omit(); } EvolvedAllocationRetentionPriorityII__List_template::EvolvedAllocationRetentionPriorityII__List_template() { } EvolvedAllocationRetentionPriorityII__List_template::EvolvedAllocationRetentionPriorityII__List_template(template_sel other_value) : Base_Record_Of_Template(other_value) { check_single_selection(other_value); } EvolvedAllocationRetentionPriorityII__List_template::EvolvedAllocationRetentionPriorityII__List_template(null_type) : Base_Record_Of_Template(SPECIFIC_VALUE) { single_value.n_elements = 0; single_value.value_elements = NULL; } EvolvedAllocationRetentionPriorityII__List_template::EvolvedAllocationRetentionPriorityII__List_template(const EvolvedAllocationRetentionPriorityII__List& other_value) { copy_value(other_value); } EvolvedAllocationRetentionPriorityII__List_template::EvolvedAllocationRetentionPriorityII__List_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const EvolvedAllocationRetentionPriorityII__List&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.EvolvedAllocationRetentionPriorityII_List from an unbound optional field."); } } EvolvedAllocationRetentionPriorityII__List_template::EvolvedAllocationRetentionPriorityII__List_template(EvolvedAllocationRetentionPriorityII__List_template* p_precondition, EvolvedAllocationRetentionPriorityII__List_template* p_implied_template) : Base_Record_Of_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } EvolvedAllocationRetentionPriorityII__List_template::EvolvedAllocationRetentionPriorityII__List_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; } EvolvedAllocationRetentionPriorityII__List_template::EvolvedAllocationRetentionPriorityII__List_template(const EvolvedAllocationRetentionPriorityII__List_template& other_value) : Base_Record_Of_Template() { copy_template(other_value); } EvolvedAllocationRetentionPriorityII__List_template::~EvolvedAllocationRetentionPriorityII__List_template() { clean_up(); } void EvolvedAllocationRetentionPriorityII__List_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; } EvolvedAllocationRetentionPriorityII__List_template& EvolvedAllocationRetentionPriorityII__List_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } EvolvedAllocationRetentionPriorityII__List_template& EvolvedAllocationRetentionPriorityII__List_template::operator=(null_type) { clean_up(); set_selection(SPECIFIC_VALUE); single_value.n_elements = 0; single_value.value_elements = NULL; return *this; } EvolvedAllocationRetentionPriorityII__List_template& EvolvedAllocationRetentionPriorityII__List_template::operator=(const EvolvedAllocationRetentionPriorityII__List& other_value) { clean_up(); copy_value(other_value); return *this; } EvolvedAllocationRetentionPriorityII__List_template& EvolvedAllocationRetentionPriorityII__List_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const EvolvedAllocationRetentionPriorityII__List&)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 @GTPC_Types.EvolvedAllocationRetentionPriorityII_List."); } return *this; } EvolvedAllocationRetentionPriorityII__List_template& EvolvedAllocationRetentionPriorityII__List_template::operator=(const EvolvedAllocationRetentionPriorityII__List_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } EvolvedAllocationRetentionPriorityII_template& EvolvedAllocationRetentionPriorityII__List_template::operator[](int index_value) { if (index_value < 0) TTCN_error("Accessing an element of a template for type @GTPC_Types.EvolvedAllocationRetentionPriorityII_List 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 @GTPC_Types.EvolvedAllocationRetentionPriorityII_List."); break; } return *single_value.value_elements[index_value]; } EvolvedAllocationRetentionPriorityII_template& EvolvedAllocationRetentionPriorityII__List_template::operator[](const INTEGER& index_value) { index_value.must_bound("Using an unbound integer value for indexing a template of type @GTPC_Types.EvolvedAllocationRetentionPriorityII_List."); return (*this)[(int)index_value]; } const EvolvedAllocationRetentionPriorityII_template& EvolvedAllocationRetentionPriorityII__List_template::operator[](int index_value) const { if (index_value < 0) TTCN_error("Accessing an element of a template for type @GTPC_Types.EvolvedAllocationRetentionPriorityII_List using a negative index: %d.", index_value); if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing an element of a non-specific template for type @GTPC_Types.EvolvedAllocationRetentionPriorityII_List."); if (index_value >= single_value.n_elements) TTCN_error("Index overflow in a template of type @GTPC_Types.EvolvedAllocationRetentionPriorityII_List: 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 EvolvedAllocationRetentionPriorityII_template& EvolvedAllocationRetentionPriorityII__List_template::operator[](const INTEGER& index_value) const { index_value.must_bound("Using an unbound integer value for indexing a template of type @GTPC_Types.EvolvedAllocationRetentionPriorityII_List."); return (*this)[(int)index_value]; } void EvolvedAllocationRetentionPriorityII__List_template::set_size(int new_size) { if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a template of type @GTPC_Types.EvolvedAllocationRetentionPriorityII_List."); 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 = (EvolvedAllocationRetentionPriorityII_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 EvolvedAllocationRetentionPriorityII_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 EvolvedAllocationRetentionPriorityII_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 = (EvolvedAllocationRetentionPriorityII_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size); single_value.n_elements = new_size; } } int EvolvedAllocationRetentionPriorityII__List_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 EvolvedAllocationRetentionPriorityII__List_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 @GTPC_Types.EvolvedAllocationRetentionPriorityII_List 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 @GTPC_Types.EvolvedAllocationRetentionPriorityII_List 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 @GTPC_Types.EvolvedAllocationRetentionPriorityII_List 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 @GTPC_Types.EvolvedAllocationRetentionPriorityII_List 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 @GTPC_Types.EvolvedAllocationRetentionPriorityII_List 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 @GTPC_Types.EvolvedAllocationRetentionPriorityII_List containing complemented list.", op_name); default: TTCN_error("Performing %sof() operation on an uninitialized/unsupported template of type @GTPC_Types.EvolvedAllocationRetentionPriorityII_List.", op_name); } return check_section_is_single(min_size, has_any_or_none, op_name, "a", "template of type @GTPC_Types.EvolvedAllocationRetentionPriorityII_List"); } boolean EvolvedAllocationRetentionPriorityII__List_template::match(const EvolvedAllocationRetentionPriorityII__List& 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 @GTPC_Types.EvolvedAllocationRetentionPriorityII_List."); } return FALSE; } boolean EvolvedAllocationRetentionPriorityII__List_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; } EvolvedAllocationRetentionPriorityII__List EvolvedAllocationRetentionPriorityII__List_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 @GTPC_Types.EvolvedAllocationRetentionPriorityII_List."); EvolvedAllocationRetentionPriorityII__List 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; } EvolvedAllocationRetentionPriorityII__List EvolvedAllocationRetentionPriorityII__List_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); } EvolvedAllocationRetentionPriorityII__List EvolvedAllocationRetentionPriorityII__List_template::replace(int index, int len, const EvolvedAllocationRetentionPriorityII__List_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()); } EvolvedAllocationRetentionPriorityII__List EvolvedAllocationRetentionPriorityII__List_template::replace(int index, int len, const EvolvedAllocationRetentionPriorityII__List& 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 EvolvedAllocationRetentionPriorityII__List_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 EvolvedAllocationRetentionPriorityII__List_template[list_length]; break; default: TTCN_error("Internal error: Setting an invalid type for a template of type @GTPC_Types.EvolvedAllocationRetentionPriorityII_List."); } set_selection(template_type); } EvolvedAllocationRetentionPriorityII__List_template& EvolvedAllocationRetentionPriorityII__List_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 @GTPC_Types.EvolvedAllocationRetentionPriorityII_List."); if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of type @GTPC_Types.EvolvedAllocationRetentionPriorityII_List."); return value_list.list_value[list_index]; } void EvolvedAllocationRetentionPriorityII__List_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 EvolvedAllocationRetentionPriorityII__List_template::log_match(const EvolvedAllocationRetentionPriorityII__List& 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 EvolvedAllocationRetentionPriorityII__List_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 @GTPC_Types.EvolvedAllocationRetentionPriorityII_List."); } } void EvolvedAllocationRetentionPriorityII__List_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 @GTPC_Types.EvolvedAllocationRetentionPriorityII_List."); single_value.value_elements = (EvolvedAllocationRetentionPriorityII_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 EvolvedAllocationRetentionPriorityII_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 EvolvedAllocationRetentionPriorityII__List_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 @GTPC_Types.EvolvedAllocationRetentionPriorityII_List."); } } boolean EvolvedAllocationRetentionPriorityII__List_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean EvolvedAllocationRetentionPriorityII__List_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: { EvolvedAllocationRetentionPriorityII__List_template* precondition = new EvolvedAllocationRetentionPriorityII__List_template; precondition->set_param(*param.get_elem(0)); EvolvedAllocationRetentionPriorityII__List_template* implied_template = new EvolvedAllocationRetentionPriorityII__List_template; implied_template->set_param(*param.get_elem(1)); *this = EvolvedAllocationRetentionPriorityII__List_template(precondition, implied_template); } break; default: param.type_error("record of template", "@GTPC_Types.EvolvedAllocationRetentionPriorityII_List"); } is_ifpresent = param.get_ifpresent(); set_length_range(param); } void EvolvedAllocationRetentionPriorityII__List_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 : "@GTPC_Types.EvolvedAllocationRetentionPriorityII_List"); 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 : "@GTPC_Types.EvolvedAllocationRetentionPriorityII_List"); } boolean EvolvedAllocationRetentionPriorityII__List_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); } } EvolvedAllocationRetentionPriorityII::EvolvedAllocationRetentionPriorityII() { } EvolvedAllocationRetentionPriorityII::EvolvedAllocationRetentionPriorityII(const OCTETSTRING& par_type__gtpc, const INTEGER& par_lengthf, const BITSTRING& par_nsapi, const BITSTRING& par_unused, const BITSTRING& par_pVI, const BITSTRING& par_spare1, const INTEGER& par_pL, const BITSTRING& par_pCI, const BITSTRING& par_spare2) : field_type__gtpc(par_type__gtpc), field_lengthf(par_lengthf), field_nsapi(par_nsapi), field_unused(par_unused), field_pVI(par_pVI), field_spare1(par_spare1), field_pL(par_pL), field_pCI(par_pCI), field_spare2(par_spare2) { } EvolvedAllocationRetentionPriorityII::EvolvedAllocationRetentionPriorityII(const EvolvedAllocationRetentionPriorityII& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GTPC_Types.EvolvedAllocationRetentionPriorityII."); if (other_value.type__gtpc().is_bound()) field_type__gtpc = other_value.type__gtpc(); else field_type__gtpc.clean_up(); if (other_value.lengthf().is_bound()) field_lengthf = other_value.lengthf(); else field_lengthf.clean_up(); if (other_value.nsapi().is_bound()) field_nsapi = other_value.nsapi(); else field_nsapi.clean_up(); if (other_value.unused().is_bound()) field_unused = other_value.unused(); else field_unused.clean_up(); if (other_value.pVI().is_bound()) field_pVI = other_value.pVI(); else field_pVI.clean_up(); if (other_value.spare1().is_bound()) field_spare1 = other_value.spare1(); else field_spare1.clean_up(); if (other_value.pL().is_bound()) field_pL = other_value.pL(); else field_pL.clean_up(); if (other_value.pCI().is_bound()) field_pCI = other_value.pCI(); else field_pCI.clean_up(); if (other_value.spare2().is_bound()) field_spare2 = other_value.spare2(); else field_spare2.clean_up(); } void EvolvedAllocationRetentionPriorityII::clean_up() { field_type__gtpc.clean_up(); field_lengthf.clean_up(); field_nsapi.clean_up(); field_unused.clean_up(); field_pVI.clean_up(); field_spare1.clean_up(); field_pL.clean_up(); field_pCI.clean_up(); field_spare2.clean_up(); } const TTCN_Typedescriptor_t* EvolvedAllocationRetentionPriorityII::get_descriptor() const { return &EvolvedAllocationRetentionPriorityII_descr_; } EvolvedAllocationRetentionPriorityII& EvolvedAllocationRetentionPriorityII::operator=(const EvolvedAllocationRetentionPriorityII& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GTPC_Types.EvolvedAllocationRetentionPriorityII."); if (other_value.type__gtpc().is_bound()) field_type__gtpc = other_value.type__gtpc(); else field_type__gtpc.clean_up(); if (other_value.lengthf().is_bound()) field_lengthf = other_value.lengthf(); else field_lengthf.clean_up(); if (other_value.nsapi().is_bound()) field_nsapi = other_value.nsapi(); else field_nsapi.clean_up(); if (other_value.unused().is_bound()) field_unused = other_value.unused(); else field_unused.clean_up(); if (other_value.pVI().is_bound()) field_pVI = other_value.pVI(); else field_pVI.clean_up(); if (other_value.spare1().is_bound()) field_spare1 = other_value.spare1(); else field_spare1.clean_up(); if (other_value.pL().is_bound()) field_pL = other_value.pL(); else field_pL.clean_up(); if (other_value.pCI().is_bound()) field_pCI = other_value.pCI(); else field_pCI.clean_up(); if (other_value.spare2().is_bound()) field_spare2 = other_value.spare2(); else field_spare2.clean_up(); } return *this; } boolean EvolvedAllocationRetentionPriorityII::operator==(const EvolvedAllocationRetentionPriorityII& other_value) const { return field_type__gtpc==other_value.field_type__gtpc && field_lengthf==other_value.field_lengthf && field_nsapi==other_value.field_nsapi && field_unused==other_value.field_unused && field_pVI==other_value.field_pVI && field_spare1==other_value.field_spare1 && field_pL==other_value.field_pL && field_pCI==other_value.field_pCI && field_spare2==other_value.field_spare2; } boolean EvolvedAllocationRetentionPriorityII::is_bound() const { return (field_type__gtpc.is_bound()) || (field_lengthf.is_bound()) || (field_nsapi.is_bound()) || (field_unused.is_bound()) || (field_pVI.is_bound()) || (field_spare1.is_bound()) || (field_pL.is_bound()) || (field_pCI.is_bound()) || (field_spare2.is_bound()); } boolean EvolvedAllocationRetentionPriorityII::is_value() const { return field_type__gtpc.is_value() && field_lengthf.is_value() && field_nsapi.is_value() && field_unused.is_value() && field_pVI.is_value() && field_spare1.is_value() && field_pL.is_value() && field_pCI.is_value() && field_spare2.is_value(); } void EvolvedAllocationRetentionPriorityII::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ type_gtpc := "); field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); field_lengthf.log(); TTCN_Logger::log_event_str(", nsapi := "); field_nsapi.log(); TTCN_Logger::log_event_str(", unused := "); field_unused.log(); TTCN_Logger::log_event_str(", pVI := "); field_pVI.log(); TTCN_Logger::log_event_str(", spare1 := "); field_spare1.log(); TTCN_Logger::log_event_str(", pL := "); field_pL.log(); TTCN_Logger::log_event_str(", pCI := "); field_pCI.log(); TTCN_Logger::log_event_str(", spare2 := "); field_spare2.log(); TTCN_Logger::log_event_str(" }"); } void EvolvedAllocationRetentionPriorityII::set_implicit_omit() { if (type__gtpc().is_bound()) type__gtpc().set_implicit_omit(); if (lengthf().is_bound()) lengthf().set_implicit_omit(); if (nsapi().is_bound()) nsapi().set_implicit_omit(); if (unused().is_bound()) unused().set_implicit_omit(); if (pVI().is_bound()) pVI().set_implicit_omit(); if (spare1().is_bound()) spare1().set_implicit_omit(); if (pL().is_bound()) pL().set_implicit_omit(); if (pCI().is_bound()) pCI().set_implicit_omit(); if (spare2().is_bound()) spare2().set_implicit_omit(); } void EvolvedAllocationRetentionPriorityII::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "record value"); switch (param.get_type()) { case Module_Param::MP_Value_List: if (90 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) nsapi().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) unused().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) pVI().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) spare1().set_param(*param.get_elem(5)); if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) pL().set_param(*param.get_elem(6)); if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) pCI().set_param(*param.get_elem(7)); if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) spare2().set_param(*param.get_elem(8)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nsapi")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsapi().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "unused")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { unused().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "pVI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { pVI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "spare1")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare1().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "pL")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { pL().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "pCI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { pCI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "spare2")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare2().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.EvolvedAllocationRetentionPriorityII: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.EvolvedAllocationRetentionPriorityII"); } } void EvolvedAllocationRetentionPriorityII::encode_text(Text_Buf& text_buf) const { field_type__gtpc.encode_text(text_buf); field_lengthf.encode_text(text_buf); field_nsapi.encode_text(text_buf); field_unused.encode_text(text_buf); field_pVI.encode_text(text_buf); field_spare1.encode_text(text_buf); field_pL.encode_text(text_buf); field_pCI.encode_text(text_buf); field_spare2.encode_text(text_buf); } void EvolvedAllocationRetentionPriorityII::decode_text(Text_Buf& text_buf) { field_type__gtpc.decode_text(text_buf); field_lengthf.decode_text(text_buf); field_nsapi.decode_text(text_buf); field_unused.decode_text(text_buf); field_pVI.decode_text(text_buf); field_spare1.decode_text(text_buf); field_pL.decode_text(text_buf); field_pCI.decode_text(text_buf); field_spare2.decode_text(text_buf); } void EvolvedAllocationRetentionPriorityII::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 EvolvedAllocationRetentionPriorityII::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 EvolvedAllocationRetentionPriorityII::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; int value_of_length_field1 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_type__gtpc.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, EvolvedAllocationRetentionPriorityII_lengthf_descr_.raw->forceomit); decoded_field_length = field_lengthf.RAW_decode(EvolvedAllocationRetentionPriorityII_lengthf_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()); INTEGER tmp1 = field_lengthf.convert_to_Integer(EvolvedAllocationRetentionPriorityII_lengthf_descr_); field_lengthf = tmp1; value_of_length_field1 += tmp1.get_long_long_val() * 8; RAW_Force_Omit field_2_force_omit(2, force_omit, General__Types::BIT4_descr_.raw->forceomit); decoded_field_length = field_nsapi.RAW_decode(General__Types::BIT4_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::BIT4_descr_.raw->forceomit); decoded_field_length = field_unused.RAW_decode(General__Types::BIT4_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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_field1 -= decoded_field_length; RAW_Force_Omit field_4_force_omit(4, force_omit, General__Types::BIT1_descr_.raw->forceomit); decoded_field_length = field_pVI.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, no_err, -1, TRUE, &field_4_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_5_force_omit(5, force_omit, General__Types::BIT1_descr_.raw->forceomit); decoded_field_length = field_spare1.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, no_err, -1, TRUE, &field_5_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_6_force_omit(6, force_omit, EvolvedAllocationRetentionPriorityII_pL_descr_.raw->forceomit); decoded_field_length = field_pL.RAW_decode(EvolvedAllocationRetentionPriorityII_pL_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, no_err, -1, TRUE, &field_6_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_7_force_omit(7, force_omit, General__Types::BIT1_descr_.raw->forceomit); decoded_field_length = field_pCI.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, no_err, -1, TRUE, &field_7_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_8_force_omit(8, force_omit, General__Types::BIT1_descr_.raw->forceomit); decoded_field_length = field_spare2.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, no_err, -1, TRUE, &field_8_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); value_of_length_field1 -= decoded_field_length; if (field_type__gtpc != os_72) return -1; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int EvolvedAllocationRetentionPriorityII::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const { if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value."); int encoded_length = 0; myleaf.isleaf = FALSE; myleaf.body.node.num_of_nodes = 9; myleaf.body.node.nodes = init_nodes_of_enc_tree(9); myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, General__Types::OCT1_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, EvolvedAllocationRetentionPriorityII_lengthf_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, General__Types::BIT4_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::BIT4_descr_.raw); myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, General__Types::BIT1_descr_.raw); myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, General__Types::BIT1_descr_.raw); myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, EvolvedAllocationRetentionPriorityII_pL_descr_.raw); myleaf.body.node.nodes[7] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 7, General__Types::BIT1_descr_.raw); myleaf.body.node.nodes[8] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 8, General__Types::BIT1_descr_.raw); encoded_length += field_type__gtpc.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += 16; myleaf.body.node.nodes[1]->calc = CALC_LENGTH; myleaf.body.node.nodes[1]->coding_descr = &EvolvedAllocationRetentionPriorityII_lengthf_descr_; myleaf.body.node.nodes[1]->calcof.lengthto.num_of_fields = 7; myleaf.body.node.nodes[1]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[1]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields = init_lengthto_fields_list(7); myleaf.body.node.nodes[1]->length = 16; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[2]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[2]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].level = myleaf.body.node.nodes[3]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].pos = myleaf.body.node.nodes[3]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].level = myleaf.body.node.nodes[4]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].pos = myleaf.body.node.nodes[4]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[3].level = myleaf.body.node.nodes[5]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[3].pos = myleaf.body.node.nodes[5]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[4].level = myleaf.body.node.nodes[6]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[4].pos = myleaf.body.node.nodes[6]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[5].level = myleaf.body.node.nodes[7]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[5].pos = myleaf.body.node.nodes[7]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[6].level = myleaf.body.node.nodes[8]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[6].pos = myleaf.body.node.nodes[8]->curr_pos.pos; encoded_length += field_nsapi.RAW_encode(General__Types::BIT4_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_unused.RAW_encode(General__Types::BIT4_descr_, *myleaf.body.node.nodes[3]); encoded_length += field_pVI.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[4]); encoded_length += field_spare1.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[5]); encoded_length += field_pL.RAW_encode(EvolvedAllocationRetentionPriorityII_pL_descr_, *myleaf.body.node.nodes[6]); encoded_length += field_pCI.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[7]); encoded_length += field_spare2.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[8]); if (field_type__gtpc != os_72) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={0}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ os_72.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 EvolvedAllocationRetentionPriorityII_template::single_value_struct { OCTETSTRING_template field_type__gtpc; INTEGER_template field_lengthf; BITSTRING_template field_nsapi; BITSTRING_template field_unused; BITSTRING_template field_pVI; BITSTRING_template field_spare1; INTEGER_template field_pL; BITSTRING_template field_pCI; BITSTRING_template field_spare2; }; void EvolvedAllocationRetentionPriorityII_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_type__gtpc = ANY_VALUE; single_value->field_lengthf = ANY_VALUE; single_value->field_nsapi = ANY_VALUE; single_value->field_unused = ANY_VALUE; single_value->field_pVI = ANY_VALUE; single_value->field_spare1 = ANY_VALUE; single_value->field_pL = ANY_VALUE; single_value->field_pCI = ANY_VALUE; single_value->field_spare2 = ANY_VALUE; } } } void EvolvedAllocationRetentionPriorityII_template::copy_value(const EvolvedAllocationRetentionPriorityII& other_value) { single_value = new single_value_struct; if (other_value.type__gtpc().is_bound()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (other_value.lengthf().is_bound()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (other_value.nsapi().is_bound()) { single_value->field_nsapi = other_value.nsapi(); } else { single_value->field_nsapi.clean_up(); } if (other_value.unused().is_bound()) { single_value->field_unused = other_value.unused(); } else { single_value->field_unused.clean_up(); } if (other_value.pVI().is_bound()) { single_value->field_pVI = other_value.pVI(); } else { single_value->field_pVI.clean_up(); } if (other_value.spare1().is_bound()) { single_value->field_spare1 = other_value.spare1(); } else { single_value->field_spare1.clean_up(); } if (other_value.pL().is_bound()) { single_value->field_pL = other_value.pL(); } else { single_value->field_pL.clean_up(); } if (other_value.pCI().is_bound()) { single_value->field_pCI = other_value.pCI(); } else { single_value->field_pCI.clean_up(); } if (other_value.spare2().is_bound()) { single_value->field_spare2 = other_value.spare2(); } else { single_value->field_spare2.clean_up(); } set_selection(SPECIFIC_VALUE); } void EvolvedAllocationRetentionPriorityII_template::copy_template(const EvolvedAllocationRetentionPriorityII_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.type__gtpc().get_selection()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lengthf().get_selection()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.nsapi().get_selection()) { single_value->field_nsapi = other_value.nsapi(); } else { single_value->field_nsapi.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.unused().get_selection()) { single_value->field_unused = other_value.unused(); } else { single_value->field_unused.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.pVI().get_selection()) { single_value->field_pVI = other_value.pVI(); } else { single_value->field_pVI.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.spare1().get_selection()) { single_value->field_spare1 = other_value.spare1(); } else { single_value->field_spare1.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.pL().get_selection()) { single_value->field_pL = other_value.pL(); } else { single_value->field_pL.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.pCI().get_selection()) { single_value->field_pCI = other_value.pCI(); } else { single_value->field_pCI.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.spare2().get_selection()) { single_value->field_spare2 = other_value.spare2(); } else { single_value->field_spare2.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 EvolvedAllocationRetentionPriorityII_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 EvolvedAllocationRetentionPriorityII_template(*other_value.implication_.precondition); implication_.implied_template = new EvolvedAllocationRetentionPriorityII_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 @GTPC_Types.EvolvedAllocationRetentionPriorityII."); break; } set_selection(other_value); } EvolvedAllocationRetentionPriorityII_template::EvolvedAllocationRetentionPriorityII_template() { } EvolvedAllocationRetentionPriorityII_template::EvolvedAllocationRetentionPriorityII_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } EvolvedAllocationRetentionPriorityII_template::EvolvedAllocationRetentionPriorityII_template(const EvolvedAllocationRetentionPriorityII& other_value) { copy_value(other_value); } EvolvedAllocationRetentionPriorityII_template::EvolvedAllocationRetentionPriorityII_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const EvolvedAllocationRetentionPriorityII&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.EvolvedAllocationRetentionPriorityII from an unbound optional field."); } } EvolvedAllocationRetentionPriorityII_template::EvolvedAllocationRetentionPriorityII_template(EvolvedAllocationRetentionPriorityII_template* p_precondition, EvolvedAllocationRetentionPriorityII_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } EvolvedAllocationRetentionPriorityII_template::EvolvedAllocationRetentionPriorityII_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; } EvolvedAllocationRetentionPriorityII_template::EvolvedAllocationRetentionPriorityII_template(const EvolvedAllocationRetentionPriorityII_template& other_value) : Base_Template() { copy_template(other_value); } EvolvedAllocationRetentionPriorityII_template::~EvolvedAllocationRetentionPriorityII_template() { clean_up(); } EvolvedAllocationRetentionPriorityII_template& EvolvedAllocationRetentionPriorityII_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } EvolvedAllocationRetentionPriorityII_template& EvolvedAllocationRetentionPriorityII_template::operator=(const EvolvedAllocationRetentionPriorityII& other_value) { clean_up(); copy_value(other_value); return *this; } EvolvedAllocationRetentionPriorityII_template& EvolvedAllocationRetentionPriorityII_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const EvolvedAllocationRetentionPriorityII&)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 @GTPC_Types.EvolvedAllocationRetentionPriorityII."); } return *this; } EvolvedAllocationRetentionPriorityII_template& EvolvedAllocationRetentionPriorityII_template::operator=(const EvolvedAllocationRetentionPriorityII_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean EvolvedAllocationRetentionPriorityII_template::match(const EvolvedAllocationRetentionPriorityII& 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.type__gtpc().is_bound()) return FALSE; if(!single_value->field_type__gtpc.match(other_value.type__gtpc(), legacy))return FALSE; if(!other_value.lengthf().is_bound()) return FALSE; if(!single_value->field_lengthf.match(other_value.lengthf(), legacy))return FALSE; if(!other_value.nsapi().is_bound()) return FALSE; if(!single_value->field_nsapi.match(other_value.nsapi(), legacy))return FALSE; if(!other_value.unused().is_bound()) return FALSE; if(!single_value->field_unused.match(other_value.unused(), legacy))return FALSE; if(!other_value.pVI().is_bound()) return FALSE; if(!single_value->field_pVI.match(other_value.pVI(), legacy))return FALSE; if(!other_value.spare1().is_bound()) return FALSE; if(!single_value->field_spare1.match(other_value.spare1(), legacy))return FALSE; if(!other_value.pL().is_bound()) return FALSE; if(!single_value->field_pL.match(other_value.pL(), legacy))return FALSE; if(!other_value.pCI().is_bound()) return FALSE; if(!single_value->field_pCI.match(other_value.pCI(), legacy))return FALSE; if(!other_value.spare2().is_bound()) return FALSE; if(!single_value->field_spare2.match(other_value.spare2(), 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 @GTPC_Types.EvolvedAllocationRetentionPriorityII."); } return FALSE; } boolean EvolvedAllocationRetentionPriorityII_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_type__gtpc.is_bound() || single_value->field_lengthf.is_bound() || single_value->field_nsapi.is_bound() || single_value->field_unused.is_bound() || single_value->field_pVI.is_bound() || single_value->field_spare1.is_bound() || single_value->field_pL.is_bound() || single_value->field_pCI.is_bound() || single_value->field_spare2.is_bound(); } boolean EvolvedAllocationRetentionPriorityII_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_type__gtpc.is_value() && single_value->field_lengthf.is_value() && single_value->field_nsapi.is_value() && single_value->field_unused.is_value() && single_value->field_pVI.is_value() && single_value->field_spare1.is_value() && single_value->field_pL.is_value() && single_value->field_pCI.is_value() && single_value->field_spare2.is_value(); } void EvolvedAllocationRetentionPriorityII_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; } EvolvedAllocationRetentionPriorityII EvolvedAllocationRetentionPriorityII_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 @GTPC_Types.EvolvedAllocationRetentionPriorityII."); EvolvedAllocationRetentionPriorityII ret_val; if (single_value->field_type__gtpc.is_bound()) { ret_val.type__gtpc() = single_value->field_type__gtpc.valueof(); } if (single_value->field_lengthf.is_bound()) { ret_val.lengthf() = single_value->field_lengthf.valueof(); } if (single_value->field_nsapi.is_bound()) { ret_val.nsapi() = single_value->field_nsapi.valueof(); } if (single_value->field_unused.is_bound()) { ret_val.unused() = single_value->field_unused.valueof(); } if (single_value->field_pVI.is_bound()) { ret_val.pVI() = single_value->field_pVI.valueof(); } if (single_value->field_spare1.is_bound()) { ret_val.spare1() = single_value->field_spare1.valueof(); } if (single_value->field_pL.is_bound()) { ret_val.pL() = single_value->field_pL.valueof(); } if (single_value->field_pCI.is_bound()) { ret_val.pCI() = single_value->field_pCI.valueof(); } if (single_value->field_spare2.is_bound()) { ret_val.spare2() = single_value->field_spare2.valueof(); } return ret_val; } void EvolvedAllocationRetentionPriorityII_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 @GTPC_Types.EvolvedAllocationRetentionPriorityII."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new EvolvedAllocationRetentionPriorityII_template[list_length]; } EvolvedAllocationRetentionPriorityII_template& EvolvedAllocationRetentionPriorityII_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 @GTPC_Types.EvolvedAllocationRetentionPriorityII."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.EvolvedAllocationRetentionPriorityII."); return value_list.list_value[list_index]; } OCTETSTRING_template& EvolvedAllocationRetentionPriorityII_template::type__gtpc() { set_specific(); return single_value->field_type__gtpc; } const OCTETSTRING_template& EvolvedAllocationRetentionPriorityII_template::type__gtpc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field type_gtpc of a non-specific template of type @GTPC_Types.EvolvedAllocationRetentionPriorityII."); return single_value->field_type__gtpc; } INTEGER_template& EvolvedAllocationRetentionPriorityII_template::lengthf() { set_specific(); return single_value->field_lengthf; } const INTEGER_template& EvolvedAllocationRetentionPriorityII_template::lengthf() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthf of a non-specific template of type @GTPC_Types.EvolvedAllocationRetentionPriorityII."); return single_value->field_lengthf; } BITSTRING_template& EvolvedAllocationRetentionPriorityII_template::nsapi() { set_specific(); return single_value->field_nsapi; } const BITSTRING_template& EvolvedAllocationRetentionPriorityII_template::nsapi() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nsapi of a non-specific template of type @GTPC_Types.EvolvedAllocationRetentionPriorityII."); return single_value->field_nsapi; } BITSTRING_template& EvolvedAllocationRetentionPriorityII_template::unused() { set_specific(); return single_value->field_unused; } const BITSTRING_template& EvolvedAllocationRetentionPriorityII_template::unused() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field unused of a non-specific template of type @GTPC_Types.EvolvedAllocationRetentionPriorityII."); return single_value->field_unused; } BITSTRING_template& EvolvedAllocationRetentionPriorityII_template::pVI() { set_specific(); return single_value->field_pVI; } const BITSTRING_template& EvolvedAllocationRetentionPriorityII_template::pVI() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field pVI of a non-specific template of type @GTPC_Types.EvolvedAllocationRetentionPriorityII."); return single_value->field_pVI; } BITSTRING_template& EvolvedAllocationRetentionPriorityII_template::spare1() { set_specific(); return single_value->field_spare1; } const BITSTRING_template& EvolvedAllocationRetentionPriorityII_template::spare1() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field spare1 of a non-specific template of type @GTPC_Types.EvolvedAllocationRetentionPriorityII."); return single_value->field_spare1; } INTEGER_template& EvolvedAllocationRetentionPriorityII_template::pL() { set_specific(); return single_value->field_pL; } const INTEGER_template& EvolvedAllocationRetentionPriorityII_template::pL() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field pL of a non-specific template of type @GTPC_Types.EvolvedAllocationRetentionPriorityII."); return single_value->field_pL; } BITSTRING_template& EvolvedAllocationRetentionPriorityII_template::pCI() { set_specific(); return single_value->field_pCI; } const BITSTRING_template& EvolvedAllocationRetentionPriorityII_template::pCI() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field pCI of a non-specific template of type @GTPC_Types.EvolvedAllocationRetentionPriorityII."); return single_value->field_pCI; } BITSTRING_template& EvolvedAllocationRetentionPriorityII_template::spare2() { set_specific(); return single_value->field_spare2; } const BITSTRING_template& EvolvedAllocationRetentionPriorityII_template::spare2() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field spare2 of a non-specific template of type @GTPC_Types.EvolvedAllocationRetentionPriorityII."); return single_value->field_spare2; } int EvolvedAllocationRetentionPriorityII_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.EvolvedAllocationRetentionPriorityII which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 9; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @GTPC_Types.EvolvedAllocationRetentionPriorityII 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 @GTPC_Types.EvolvedAllocationRetentionPriorityII containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.EvolvedAllocationRetentionPriorityII containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.EvolvedAllocationRetentionPriorityII containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.EvolvedAllocationRetentionPriorityII containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.EvolvedAllocationRetentionPriorityII containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.EvolvedAllocationRetentionPriorityII containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.EvolvedAllocationRetentionPriorityII containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.EvolvedAllocationRetentionPriorityII."); } return 0; } void EvolvedAllocationRetentionPriorityII_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ type_gtpc := "); single_value->field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log(); TTCN_Logger::log_event_str(", nsapi := "); single_value->field_nsapi.log(); TTCN_Logger::log_event_str(", unused := "); single_value->field_unused.log(); TTCN_Logger::log_event_str(", pVI := "); single_value->field_pVI.log(); TTCN_Logger::log_event_str(", spare1 := "); single_value->field_spare1.log(); TTCN_Logger::log_event_str(", pL := "); single_value->field_pL.log(); TTCN_Logger::log_event_str(", pCI := "); single_value->field_pCI.log(); TTCN_Logger::log_event_str(", spare2 := "); single_value->field_spare2.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 EvolvedAllocationRetentionPriorityII_template::log_match(const EvolvedAllocationRetentionPriorityII& 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_type__gtpc.match(match_value.type__gtpc(), legacy)){ TTCN_Logger::log_logmatch_info(".type_gtpc"); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lengthf.match(match_value.lengthf(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthf"); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_nsapi.match(match_value.nsapi(), legacy)){ TTCN_Logger::log_logmatch_info(".nsapi"); single_value->field_nsapi.log_match(match_value.nsapi(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_unused.match(match_value.unused(), legacy)){ TTCN_Logger::log_logmatch_info(".unused"); single_value->field_unused.log_match(match_value.unused(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_pVI.match(match_value.pVI(), legacy)){ TTCN_Logger::log_logmatch_info(".pVI"); single_value->field_pVI.log_match(match_value.pVI(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_spare1.match(match_value.spare1(), legacy)){ TTCN_Logger::log_logmatch_info(".spare1"); single_value->field_spare1.log_match(match_value.spare1(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_pL.match(match_value.pL(), legacy)){ TTCN_Logger::log_logmatch_info(".pL"); single_value->field_pL.log_match(match_value.pL(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_pCI.match(match_value.pCI(), legacy)){ TTCN_Logger::log_logmatch_info(".pCI"); single_value->field_pCI.log_match(match_value.pCI(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_spare2.match(match_value.spare2(), legacy)){ TTCN_Logger::log_logmatch_info(".spare2"); single_value->field_spare2.log_match(match_value.spare2(), 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("{ type_gtpc := "); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::log_event_str(", nsapi := "); single_value->field_nsapi.log_match(match_value.nsapi(), legacy); TTCN_Logger::log_event_str(", unused := "); single_value->field_unused.log_match(match_value.unused(), legacy); TTCN_Logger::log_event_str(", pVI := "); single_value->field_pVI.log_match(match_value.pVI(), legacy); TTCN_Logger::log_event_str(", spare1 := "); single_value->field_spare1.log_match(match_value.spare1(), legacy); TTCN_Logger::log_event_str(", pL := "); single_value->field_pL.log_match(match_value.pL(), legacy); TTCN_Logger::log_event_str(", pCI := "); single_value->field_pCI.log_match(match_value.pCI(), legacy); TTCN_Logger::log_event_str(", spare2 := "); single_value->field_spare2.log_match(match_value.spare2(), 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 EvolvedAllocationRetentionPriorityII_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_type__gtpc.encode_text(text_buf); single_value->field_lengthf.encode_text(text_buf); single_value->field_nsapi.encode_text(text_buf); single_value->field_unused.encode_text(text_buf); single_value->field_pVI.encode_text(text_buf); single_value->field_spare1.encode_text(text_buf); single_value->field_pL.encode_text(text_buf); single_value->field_pCI.encode_text(text_buf); single_value->field_spare2.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 @GTPC_Types.EvolvedAllocationRetentionPriorityII."); } } void EvolvedAllocationRetentionPriorityII_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_type__gtpc.decode_text(text_buf); single_value->field_lengthf.decode_text(text_buf); single_value->field_nsapi.decode_text(text_buf); single_value->field_unused.decode_text(text_buf); single_value->field_pVI.decode_text(text_buf); single_value->field_spare1.decode_text(text_buf); single_value->field_pL.decode_text(text_buf); single_value->field_pCI.decode_text(text_buf); single_value->field_spare2.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 EvolvedAllocationRetentionPriorityII_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 @GTPC_Types.EvolvedAllocationRetentionPriorityII."); } } void EvolvedAllocationRetentionPriorityII_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: { EvolvedAllocationRetentionPriorityII_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) nsapi().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) unused().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) pVI().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) spare1().set_param(*param.get_elem(5)); if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) pL().set_param(*param.get_elem(6)); if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) pCI().set_param(*param.get_elem(7)); if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) spare2().set_param(*param.get_elem(8)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nsapi")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsapi().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "unused")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { unused().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "pVI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { pVI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "spare1")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare1().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "pL")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { pL().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "pCI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { pCI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "spare2")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare2().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.EvolvedAllocationRetentionPriorityII: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { EvolvedAllocationRetentionPriorityII_template* precondition = new EvolvedAllocationRetentionPriorityII_template; precondition->set_param(*param.get_elem(0)); EvolvedAllocationRetentionPriorityII_template* implied_template = new EvolvedAllocationRetentionPriorityII_template; implied_template->set_param(*param.get_elem(1)); *this = EvolvedAllocationRetentionPriorityII_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.EvolvedAllocationRetentionPriorityII"); } is_ifpresent = param.get_ifpresent(); } void EvolvedAllocationRetentionPriorityII_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_type__gtpc.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.EvolvedAllocationRetentionPriorityII"); single_value->field_lengthf.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.EvolvedAllocationRetentionPriorityII"); single_value->field_nsapi.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.EvolvedAllocationRetentionPriorityII"); single_value->field_unused.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.EvolvedAllocationRetentionPriorityII"); single_value->field_pVI.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.EvolvedAllocationRetentionPriorityII"); single_value->field_spare1.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.EvolvedAllocationRetentionPriorityII"); single_value->field_pL.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.EvolvedAllocationRetentionPriorityII"); single_value->field_pCI.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.EvolvedAllocationRetentionPriorityII"); single_value->field_spare2.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.EvolvedAllocationRetentionPriorityII"); 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 : "@GTPC_Types.EvolvedAllocationRetentionPriorityII"); } boolean EvolvedAllocationRetentionPriorityII_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean EvolvedAllocationRetentionPriorityII_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) unauthenticatedIMSI().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) cCRSI().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) cPSR().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) retLoc().set_param(*param.get_elem(5)); if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) vB().set_param(*param.get_elem(6)); if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) pCRI().set_param(*param.get_elem(7)); if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) bDWI().set_param(*param.get_elem(8)); if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) uASI().set_param(*param.get_elem(9)); 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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "unauthenticatedIMSI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { unauthenticatedIMSI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "cCRSI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cCRSI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "cPSR")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cPSR().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "retLoc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { retLoc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "vB")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { vB().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "pCRI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { pCRI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "bDWI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { bDWI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "uASI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { uASI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.ExtendedCommonFlags: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.ExtendedCommonFlags"); } } void ExtendedCommonFlags::encode_text(Text_Buf& text_buf) const { field_type__gtpc.encode_text(text_buf); field_lengthf.encode_text(text_buf); field_unauthenticatedIMSI.encode_text(text_buf); field_cCRSI.encode_text(text_buf); field_cPSR.encode_text(text_buf); field_retLoc.encode_text(text_buf); field_vB.encode_text(text_buf); field_pCRI.encode_text(text_buf); field_bDWI.encode_text(text_buf); field_uASI.encode_text(text_buf); } void ExtendedCommonFlags::decode_text(Text_Buf& text_buf) { field_type__gtpc.decode_text(text_buf); field_lengthf.decode_text(text_buf); field_unauthenticatedIMSI.decode_text(text_buf); field_cCRSI.decode_text(text_buf); field_cPSR.decode_text(text_buf); field_retLoc.decode_text(text_buf); field_vB.decode_text(text_buf); field_pCRI.decode_text(text_buf); field_bDWI.decode_text(text_buf); field_uASI.decode_text(text_buf); } void ExtendedCommonFlags::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 ExtendedCommonFlags::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 ExtendedCommonFlags::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; int value_of_length_field1 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_type__gtpc.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, ExtendedCommonFlags_lengthf_descr_.raw->forceomit); decoded_field_length = field_lengthf.RAW_decode(ExtendedCommonFlags_lengthf_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()); INTEGER tmp1 = field_lengthf.convert_to_Integer(ExtendedCommonFlags_lengthf_descr_); field_lengthf = tmp1; value_of_length_field1 += tmp1.get_long_long_val() * 8; RAW_Force_Omit field_2_force_omit(2, force_omit, General__Types::BIT1_descr_.raw->forceomit); decoded_field_length = field_unauthenticatedIMSI.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::BIT1_descr_.raw->forceomit); decoded_field_length = field_cCRSI.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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_field1 -= decoded_field_length; RAW_Force_Omit field_4_force_omit(4, force_omit, General__Types::BIT1_descr_.raw->forceomit); decoded_field_length = field_cPSR.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, no_err, -1, TRUE, &field_4_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_5_force_omit(5, force_omit, General__Types::BIT1_descr_.raw->forceomit); decoded_field_length = field_retLoc.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, no_err, -1, TRUE, &field_5_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_6_force_omit(6, force_omit, General__Types::BIT1_descr_.raw->forceomit); decoded_field_length = field_vB.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, no_err, -1, TRUE, &field_6_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_7_force_omit(7, force_omit, General__Types::BIT1_descr_.raw->forceomit); decoded_field_length = field_pCRI.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, no_err, -1, TRUE, &field_7_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_8_force_omit(8, force_omit, General__Types::BIT1_descr_.raw->forceomit); decoded_field_length = field_bDWI.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, no_err, -1, TRUE, &field_8_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_9_force_omit(9, force_omit, General__Types::BIT1_descr_.raw->forceomit); decoded_field_length = field_uASI.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, no_err, -1, TRUE, &field_9_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_field1 -= decoded_field_length; if (field_type__gtpc != os_35) return -1; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int ExtendedCommonFlags::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 = 10; myleaf.body.node.nodes = init_nodes_of_enc_tree(10); 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, ExtendedCommonFlags_lengthf_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, General__Types::BIT1_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::BIT1_descr_.raw); myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, General__Types::BIT1_descr_.raw); myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, General__Types::BIT1_descr_.raw); myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, General__Types::BIT1_descr_.raw); myleaf.body.node.nodes[7] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 7, General__Types::BIT1_descr_.raw); myleaf.body.node.nodes[8] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 8, General__Types::BIT1_descr_.raw); myleaf.body.node.nodes[9] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 9, General__Types::BIT1_descr_.raw); encoded_length += field_type__gtpc.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += 16; myleaf.body.node.nodes[1]->calc = CALC_LENGTH; myleaf.body.node.nodes[1]->coding_descr = &ExtendedCommonFlags_lengthf_descr_; myleaf.body.node.nodes[1]->calcof.lengthto.num_of_fields = 8; myleaf.body.node.nodes[1]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[1]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields = init_lengthto_fields_list(8); myleaf.body.node.nodes[1]->length = 16; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[2]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[2]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].level = myleaf.body.node.nodes[3]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].pos = myleaf.body.node.nodes[3]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].level = myleaf.body.node.nodes[4]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].pos = myleaf.body.node.nodes[4]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[3].level = myleaf.body.node.nodes[5]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[3].pos = myleaf.body.node.nodes[5]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[4].level = myleaf.body.node.nodes[6]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[4].pos = myleaf.body.node.nodes[6]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[5].level = myleaf.body.node.nodes[7]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[5].pos = myleaf.body.node.nodes[7]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[6].level = myleaf.body.node.nodes[8]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[6].pos = myleaf.body.node.nodes[8]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[7].level = myleaf.body.node.nodes[9]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[7].pos = myleaf.body.node.nodes[9]->curr_pos.pos; encoded_length += field_unauthenticatedIMSI.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_cCRSI.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[3]); encoded_length += field_cPSR.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[4]); encoded_length += field_retLoc.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[5]); encoded_length += field_vB.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[6]); encoded_length += field_pCRI.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[7]); encoded_length += field_bDWI.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[8]); encoded_length += field_uASI.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[9]); if (field_type__gtpc != os_35) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={0}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ os_35.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 ExtendedCommonFlags_template::single_value_struct { OCTETSTRING_template field_type__gtpc; INTEGER_template field_lengthf; BITSTRING_template field_unauthenticatedIMSI; BITSTRING_template field_cCRSI; BITSTRING_template field_cPSR; BITSTRING_template field_retLoc; BITSTRING_template field_vB; BITSTRING_template field_pCRI; BITSTRING_template field_bDWI; BITSTRING_template field_uASI; }; void ExtendedCommonFlags_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_type__gtpc = ANY_VALUE; single_value->field_lengthf = ANY_VALUE; single_value->field_unauthenticatedIMSI = ANY_VALUE; single_value->field_cCRSI = ANY_VALUE; single_value->field_cPSR = ANY_VALUE; single_value->field_retLoc = ANY_VALUE; single_value->field_vB = ANY_VALUE; single_value->field_pCRI = ANY_VALUE; single_value->field_bDWI = ANY_VALUE; single_value->field_uASI = ANY_VALUE; } } } void ExtendedCommonFlags_template::copy_value(const ExtendedCommonFlags& other_value) { single_value = new single_value_struct; if (other_value.type__gtpc().is_bound()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (other_value.lengthf().is_bound()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (other_value.unauthenticatedIMSI().is_bound()) { single_value->field_unauthenticatedIMSI = other_value.unauthenticatedIMSI(); } else { single_value->field_unauthenticatedIMSI.clean_up(); } if (other_value.cCRSI().is_bound()) { single_value->field_cCRSI = other_value.cCRSI(); } else { single_value->field_cCRSI.clean_up(); } if (other_value.cPSR().is_bound()) { single_value->field_cPSR = other_value.cPSR(); } else { single_value->field_cPSR.clean_up(); } if (other_value.retLoc().is_bound()) { single_value->field_retLoc = other_value.retLoc(); } else { single_value->field_retLoc.clean_up(); } if (other_value.vB().is_bound()) { single_value->field_vB = other_value.vB(); } else { single_value->field_vB.clean_up(); } if (other_value.pCRI().is_bound()) { single_value->field_pCRI = other_value.pCRI(); } else { single_value->field_pCRI.clean_up(); } if (other_value.bDWI().is_bound()) { single_value->field_bDWI = other_value.bDWI(); } else { single_value->field_bDWI.clean_up(); } if (other_value.uASI().is_bound()) { single_value->field_uASI = other_value.uASI(); } else { single_value->field_uASI.clean_up(); } set_selection(SPECIFIC_VALUE); } void ExtendedCommonFlags_template::copy_template(const ExtendedCommonFlags_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.type__gtpc().get_selection()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lengthf().get_selection()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.unauthenticatedIMSI().get_selection()) { single_value->field_unauthenticatedIMSI = other_value.unauthenticatedIMSI(); } else { single_value->field_unauthenticatedIMSI.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.cCRSI().get_selection()) { single_value->field_cCRSI = other_value.cCRSI(); } else { single_value->field_cCRSI.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.cPSR().get_selection()) { single_value->field_cPSR = other_value.cPSR(); } else { single_value->field_cPSR.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.retLoc().get_selection()) { single_value->field_retLoc = other_value.retLoc(); } else { single_value->field_retLoc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.vB().get_selection()) { single_value->field_vB = other_value.vB(); } else { single_value->field_vB.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.pCRI().get_selection()) { single_value->field_pCRI = other_value.pCRI(); } else { single_value->field_pCRI.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.bDWI().get_selection()) { single_value->field_bDWI = other_value.bDWI(); } else { single_value->field_bDWI.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.uASI().get_selection()) { single_value->field_uASI = other_value.uASI(); } else { single_value->field_uASI.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 ExtendedCommonFlags_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 ExtendedCommonFlags_template(*other_value.implication_.precondition); implication_.implied_template = new ExtendedCommonFlags_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 @GTPC_Types.ExtendedCommonFlags."); break; } set_selection(other_value); } ExtendedCommonFlags_template::ExtendedCommonFlags_template() { } ExtendedCommonFlags_template::ExtendedCommonFlags_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } ExtendedCommonFlags_template::ExtendedCommonFlags_template(const ExtendedCommonFlags& other_value) { copy_value(other_value); } ExtendedCommonFlags_template::ExtendedCommonFlags_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const ExtendedCommonFlags&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.ExtendedCommonFlags from an unbound optional field."); } } ExtendedCommonFlags_template::ExtendedCommonFlags_template(ExtendedCommonFlags_template* p_precondition, ExtendedCommonFlags_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } ExtendedCommonFlags_template::ExtendedCommonFlags_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; } ExtendedCommonFlags_template::ExtendedCommonFlags_template(const ExtendedCommonFlags_template& other_value) : Base_Template() { copy_template(other_value); } ExtendedCommonFlags_template::~ExtendedCommonFlags_template() { clean_up(); } ExtendedCommonFlags_template& ExtendedCommonFlags_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } ExtendedCommonFlags_template& ExtendedCommonFlags_template::operator=(const ExtendedCommonFlags& other_value) { clean_up(); copy_value(other_value); return *this; } ExtendedCommonFlags_template& ExtendedCommonFlags_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const ExtendedCommonFlags&)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 @GTPC_Types.ExtendedCommonFlags."); } return *this; } ExtendedCommonFlags_template& ExtendedCommonFlags_template::operator=(const ExtendedCommonFlags_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean ExtendedCommonFlags_template::match(const ExtendedCommonFlags& 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.type__gtpc().is_bound()) return FALSE; if(!single_value->field_type__gtpc.match(other_value.type__gtpc(), legacy))return FALSE; if(!other_value.lengthf().is_bound()) return FALSE; if(!single_value->field_lengthf.match(other_value.lengthf(), legacy))return FALSE; if(!other_value.unauthenticatedIMSI().is_bound()) return FALSE; if(!single_value->field_unauthenticatedIMSI.match(other_value.unauthenticatedIMSI(), legacy))return FALSE; if(!other_value.cCRSI().is_bound()) return FALSE; if(!single_value->field_cCRSI.match(other_value.cCRSI(), legacy))return FALSE; if(!other_value.cPSR().is_bound()) return FALSE; if(!single_value->field_cPSR.match(other_value.cPSR(), legacy))return FALSE; if(!other_value.retLoc().is_bound()) return FALSE; if(!single_value->field_retLoc.match(other_value.retLoc(), legacy))return FALSE; if(!other_value.vB().is_bound()) return FALSE; if(!single_value->field_vB.match(other_value.vB(), legacy))return FALSE; if(!other_value.pCRI().is_bound()) return FALSE; if(!single_value->field_pCRI.match(other_value.pCRI(), legacy))return FALSE; if(!other_value.bDWI().is_bound()) return FALSE; if(!single_value->field_bDWI.match(other_value.bDWI(), legacy))return FALSE; if(!other_value.uASI().is_bound()) return FALSE; if(!single_value->field_uASI.match(other_value.uASI(), 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 @GTPC_Types.ExtendedCommonFlags."); } return FALSE; } boolean ExtendedCommonFlags_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_type__gtpc.is_bound() || single_value->field_lengthf.is_bound() || single_value->field_unauthenticatedIMSI.is_bound() || single_value->field_cCRSI.is_bound() || single_value->field_cPSR.is_bound() || single_value->field_retLoc.is_bound() || single_value->field_vB.is_bound() || single_value->field_pCRI.is_bound() || single_value->field_bDWI.is_bound() || single_value->field_uASI.is_bound(); } boolean ExtendedCommonFlags_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_type__gtpc.is_value() && single_value->field_lengthf.is_value() && single_value->field_unauthenticatedIMSI.is_value() && single_value->field_cCRSI.is_value() && single_value->field_cPSR.is_value() && single_value->field_retLoc.is_value() && single_value->field_vB.is_value() && single_value->field_pCRI.is_value() && single_value->field_bDWI.is_value() && single_value->field_uASI.is_value(); } void ExtendedCommonFlags_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; } ExtendedCommonFlags ExtendedCommonFlags_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 @GTPC_Types.ExtendedCommonFlags."); ExtendedCommonFlags ret_val; if (single_value->field_type__gtpc.is_bound()) { ret_val.type__gtpc() = single_value->field_type__gtpc.valueof(); } if (single_value->field_lengthf.is_bound()) { ret_val.lengthf() = single_value->field_lengthf.valueof(); } if (single_value->field_unauthenticatedIMSI.is_bound()) { ret_val.unauthenticatedIMSI() = single_value->field_unauthenticatedIMSI.valueof(); } if (single_value->field_cCRSI.is_bound()) { ret_val.cCRSI() = single_value->field_cCRSI.valueof(); } if (single_value->field_cPSR.is_bound()) { ret_val.cPSR() = single_value->field_cPSR.valueof(); } if (single_value->field_retLoc.is_bound()) { ret_val.retLoc() = single_value->field_retLoc.valueof(); } if (single_value->field_vB.is_bound()) { ret_val.vB() = single_value->field_vB.valueof(); } if (single_value->field_pCRI.is_bound()) { ret_val.pCRI() = single_value->field_pCRI.valueof(); } if (single_value->field_bDWI.is_bound()) { ret_val.bDWI() = single_value->field_bDWI.valueof(); } if (single_value->field_uASI.is_bound()) { ret_val.uASI() = single_value->field_uASI.valueof(); } return ret_val; } void ExtendedCommonFlags_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 @GTPC_Types.ExtendedCommonFlags."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new ExtendedCommonFlags_template[list_length]; } ExtendedCommonFlags_template& ExtendedCommonFlags_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 @GTPC_Types.ExtendedCommonFlags."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.ExtendedCommonFlags."); return value_list.list_value[list_index]; } OCTETSTRING_template& ExtendedCommonFlags_template::type__gtpc() { set_specific(); return single_value->field_type__gtpc; } const OCTETSTRING_template& ExtendedCommonFlags_template::type__gtpc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field type_gtpc of a non-specific template of type @GTPC_Types.ExtendedCommonFlags."); return single_value->field_type__gtpc; } INTEGER_template& ExtendedCommonFlags_template::lengthf() { set_specific(); return single_value->field_lengthf; } const INTEGER_template& ExtendedCommonFlags_template::lengthf() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthf of a non-specific template of type @GTPC_Types.ExtendedCommonFlags."); return single_value->field_lengthf; } BITSTRING_template& ExtendedCommonFlags_template::unauthenticatedIMSI() { set_specific(); return single_value->field_unauthenticatedIMSI; } const BITSTRING_template& ExtendedCommonFlags_template::unauthenticatedIMSI() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field unauthenticatedIMSI of a non-specific template of type @GTPC_Types.ExtendedCommonFlags."); return single_value->field_unauthenticatedIMSI; } BITSTRING_template& ExtendedCommonFlags_template::cCRSI() { set_specific(); return single_value->field_cCRSI; } const BITSTRING_template& ExtendedCommonFlags_template::cCRSI() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field cCRSI of a non-specific template of type @GTPC_Types.ExtendedCommonFlags."); return single_value->field_cCRSI; } BITSTRING_template& ExtendedCommonFlags_template::cPSR() { set_specific(); return single_value->field_cPSR; } const BITSTRING_template& ExtendedCommonFlags_template::cPSR() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field cPSR of a non-specific template of type @GTPC_Types.ExtendedCommonFlags."); return single_value->field_cPSR; } BITSTRING_template& ExtendedCommonFlags_template::retLoc() { set_specific(); return single_value->field_retLoc; } const BITSTRING_template& ExtendedCommonFlags_template::retLoc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field retLoc of a non-specific template of type @GTPC_Types.ExtendedCommonFlags."); return single_value->field_retLoc; } BITSTRING_template& ExtendedCommonFlags_template::vB() { set_specific(); return single_value->field_vB; } const BITSTRING_template& ExtendedCommonFlags_template::vB() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field vB of a non-specific template of type @GTPC_Types.ExtendedCommonFlags."); return single_value->field_vB; } BITSTRING_template& ExtendedCommonFlags_template::pCRI() { set_specific(); return single_value->field_pCRI; } const BITSTRING_template& ExtendedCommonFlags_template::pCRI() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field pCRI of a non-specific template of type @GTPC_Types.ExtendedCommonFlags."); return single_value->field_pCRI; } BITSTRING_template& ExtendedCommonFlags_template::bDWI() { set_specific(); return single_value->field_bDWI; } const BITSTRING_template& ExtendedCommonFlags_template::bDWI() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field bDWI of a non-specific template of type @GTPC_Types.ExtendedCommonFlags."); return single_value->field_bDWI; } BITSTRING_template& ExtendedCommonFlags_template::uASI() { set_specific(); return single_value->field_uASI; } const BITSTRING_template& ExtendedCommonFlags_template::uASI() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field uASI of a non-specific template of type @GTPC_Types.ExtendedCommonFlags."); return single_value->field_uASI; } int ExtendedCommonFlags_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.ExtendedCommonFlags which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 10; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @GTPC_Types.ExtendedCommonFlags 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 @GTPC_Types.ExtendedCommonFlags containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.ExtendedCommonFlags containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.ExtendedCommonFlags containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.ExtendedCommonFlags containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.ExtendedCommonFlags containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.ExtendedCommonFlags containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.ExtendedCommonFlags containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.ExtendedCommonFlags."); } return 0; } void ExtendedCommonFlags_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ type_gtpc := "); single_value->field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log(); TTCN_Logger::log_event_str(", unauthenticatedIMSI := "); single_value->field_unauthenticatedIMSI.log(); TTCN_Logger::log_event_str(", cCRSI := "); single_value->field_cCRSI.log(); TTCN_Logger::log_event_str(", cPSR := "); single_value->field_cPSR.log(); TTCN_Logger::log_event_str(", retLoc := "); single_value->field_retLoc.log(); TTCN_Logger::log_event_str(", vB := "); single_value->field_vB.log(); TTCN_Logger::log_event_str(", pCRI := "); single_value->field_pCRI.log(); TTCN_Logger::log_event_str(", bDWI := "); single_value->field_bDWI.log(); TTCN_Logger::log_event_str(", uASI := "); single_value->field_uASI.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 ExtendedCommonFlags_template::log_match(const ExtendedCommonFlags& 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_type__gtpc.match(match_value.type__gtpc(), legacy)){ TTCN_Logger::log_logmatch_info(".type_gtpc"); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lengthf.match(match_value.lengthf(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthf"); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_unauthenticatedIMSI.match(match_value.unauthenticatedIMSI(), legacy)){ TTCN_Logger::log_logmatch_info(".unauthenticatedIMSI"); single_value->field_unauthenticatedIMSI.log_match(match_value.unauthenticatedIMSI(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_cCRSI.match(match_value.cCRSI(), legacy)){ TTCN_Logger::log_logmatch_info(".cCRSI"); single_value->field_cCRSI.log_match(match_value.cCRSI(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_cPSR.match(match_value.cPSR(), legacy)){ TTCN_Logger::log_logmatch_info(".cPSR"); single_value->field_cPSR.log_match(match_value.cPSR(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_retLoc.match(match_value.retLoc(), legacy)){ TTCN_Logger::log_logmatch_info(".retLoc"); single_value->field_retLoc.log_match(match_value.retLoc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_vB.match(match_value.vB(), legacy)){ TTCN_Logger::log_logmatch_info(".vB"); single_value->field_vB.log_match(match_value.vB(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_pCRI.match(match_value.pCRI(), legacy)){ TTCN_Logger::log_logmatch_info(".pCRI"); single_value->field_pCRI.log_match(match_value.pCRI(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_bDWI.match(match_value.bDWI(), legacy)){ TTCN_Logger::log_logmatch_info(".bDWI"); single_value->field_bDWI.log_match(match_value.bDWI(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_uASI.match(match_value.uASI(), legacy)){ TTCN_Logger::log_logmatch_info(".uASI"); single_value->field_uASI.log_match(match_value.uASI(), 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("{ type_gtpc := "); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::log_event_str(", unauthenticatedIMSI := "); single_value->field_unauthenticatedIMSI.log_match(match_value.unauthenticatedIMSI(), legacy); TTCN_Logger::log_event_str(", cCRSI := "); single_value->field_cCRSI.log_match(match_value.cCRSI(), legacy); TTCN_Logger::log_event_str(", cPSR := "); single_value->field_cPSR.log_match(match_value.cPSR(), legacy); TTCN_Logger::log_event_str(", retLoc := "); single_value->field_retLoc.log_match(match_value.retLoc(), legacy); TTCN_Logger::log_event_str(", vB := "); single_value->field_vB.log_match(match_value.vB(), legacy); TTCN_Logger::log_event_str(", pCRI := "); single_value->field_pCRI.log_match(match_value.pCRI(), legacy); TTCN_Logger::log_event_str(", bDWI := "); single_value->field_bDWI.log_match(match_value.bDWI(), legacy); TTCN_Logger::log_event_str(", uASI := "); single_value->field_uASI.log_match(match_value.uASI(), 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 ExtendedCommonFlags_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_type__gtpc.encode_text(text_buf); single_value->field_lengthf.encode_text(text_buf); single_value->field_unauthenticatedIMSI.encode_text(text_buf); single_value->field_cCRSI.encode_text(text_buf); single_value->field_cPSR.encode_text(text_buf); single_value->field_retLoc.encode_text(text_buf); single_value->field_vB.encode_text(text_buf); single_value->field_pCRI.encode_text(text_buf); single_value->field_bDWI.encode_text(text_buf); single_value->field_uASI.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 @GTPC_Types.ExtendedCommonFlags."); } } void ExtendedCommonFlags_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_type__gtpc.decode_text(text_buf); single_value->field_lengthf.decode_text(text_buf); single_value->field_unauthenticatedIMSI.decode_text(text_buf); single_value->field_cCRSI.decode_text(text_buf); single_value->field_cPSR.decode_text(text_buf); single_value->field_retLoc.decode_text(text_buf); single_value->field_vB.decode_text(text_buf); single_value->field_pCRI.decode_text(text_buf); single_value->field_bDWI.decode_text(text_buf); single_value->field_uASI.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 ExtendedCommonFlags_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 @GTPC_Types.ExtendedCommonFlags."); } } void ExtendedCommonFlags_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: { ExtendedCommonFlags_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) unauthenticatedIMSI().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) cCRSI().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) cPSR().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) retLoc().set_param(*param.get_elem(5)); if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) vB().set_param(*param.get_elem(6)); if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) pCRI().set_param(*param.get_elem(7)); if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) bDWI().set_param(*param.get_elem(8)); if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) uASI().set_param(*param.get_elem(9)); 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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "unauthenticatedIMSI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { unauthenticatedIMSI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "cCRSI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cCRSI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "cPSR")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cPSR().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "retLoc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { retLoc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "vB")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { vB().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "pCRI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { pCRI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "bDWI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { bDWI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "uASI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { uASI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.ExtendedCommonFlags: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { ExtendedCommonFlags_template* precondition = new ExtendedCommonFlags_template; precondition->set_param(*param.get_elem(0)); ExtendedCommonFlags_template* implied_template = new ExtendedCommonFlags_template; implied_template->set_param(*param.get_elem(1)); *this = ExtendedCommonFlags_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.ExtendedCommonFlags"); } is_ifpresent = param.get_ifpresent(); } void ExtendedCommonFlags_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_type__gtpc.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.ExtendedCommonFlags"); single_value->field_lengthf.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.ExtendedCommonFlags"); single_value->field_unauthenticatedIMSI.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.ExtendedCommonFlags"); single_value->field_cCRSI.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.ExtendedCommonFlags"); single_value->field_cPSR.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.ExtendedCommonFlags"); single_value->field_retLoc.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.ExtendedCommonFlags"); single_value->field_vB.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.ExtendedCommonFlags"); single_value->field_pCRI.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.ExtendedCommonFlags"); single_value->field_bDWI.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.ExtendedCommonFlags"); single_value->field_uASI.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.ExtendedCommonFlags"); 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 : "@GTPC_Types.ExtendedCommonFlags"); } boolean ExtendedCommonFlags_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean ExtendedCommonFlags_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) mccDigit1().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) mccDigit2().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) mccDigit3().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) mncDigit3().set_param(*param.get_elem(5)); if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) mncDigit1().set_param(*param.get_elem(6)); if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) mncDigit2().set_param(*param.get_elem(7)); if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) spare1().set_param(*param.get_elem(8)); if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) cSG__ID().set_param(*param.get_elem(9)); if (param.get_size()>10 && param.get_elem(10)->get_type()!=Module_Param::MP_NotUsed) cMI().set_param(*param.get_elem(10)); if (param.get_size()>11 && param.get_elem(11)->get_type()!=Module_Param::MP_NotUsed) spare2().set_param(*param.get_elem(11)); if (param.get_size()>12 && param.get_elem(12)->get_type()!=Module_Param::MP_NotUsed) accessMode().set_param(*param.get_elem(12)); 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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mccDigit1")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mccDigit1().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mccDigit2")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mccDigit2().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mccDigit3")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mccDigit3().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mncDigit3")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mncDigit3().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mncDigit1")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mncDigit1().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mncDigit2")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mncDigit2().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "spare1")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare1().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "cSG_ID")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cSG__ID().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "cMI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cMI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "spare2")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare2().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "accessMode")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { accessMode().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.UserCSGInformation: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.UserCSGInformation"); } } void UserCSGInformation::encode_text(Text_Buf& text_buf) const { field_type__gtpc.encode_text(text_buf); field_lengthf.encode_text(text_buf); field_mccDigit1.encode_text(text_buf); field_mccDigit2.encode_text(text_buf); field_mccDigit3.encode_text(text_buf); field_mncDigit3.encode_text(text_buf); field_mncDigit1.encode_text(text_buf); field_mncDigit2.encode_text(text_buf); field_spare1.encode_text(text_buf); field_cSG__ID.encode_text(text_buf); field_cMI.encode_text(text_buf); field_spare2.encode_text(text_buf); field_accessMode.encode_text(text_buf); } void UserCSGInformation::decode_text(Text_Buf& text_buf) { field_type__gtpc.decode_text(text_buf); field_lengthf.decode_text(text_buf); field_mccDigit1.decode_text(text_buf); field_mccDigit2.decode_text(text_buf); field_mccDigit3.decode_text(text_buf); field_mncDigit3.decode_text(text_buf); field_mncDigit1.decode_text(text_buf); field_mncDigit2.decode_text(text_buf); field_spare1.decode_text(text_buf); field_cSG__ID.decode_text(text_buf); field_cMI.decode_text(text_buf); field_spare2.decode_text(text_buf); field_accessMode.decode_text(text_buf); } void UserCSGInformation::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 UserCSGInformation::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 UserCSGInformation::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; int value_of_length_field1 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_type__gtpc.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, UserCSGInformation_lengthf_descr_.raw->forceomit); decoded_field_length = field_lengthf.RAW_decode(UserCSGInformation_lengthf_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()); INTEGER tmp1 = field_lengthf.convert_to_Integer(UserCSGInformation_lengthf_descr_); field_lengthf = tmp1; value_of_length_field1 += tmp1.get_long_long_val() * 8; RAW_Force_Omit field_2_force_omit(2, force_omit, General__Types::HEX1_descr_.raw->forceomit); decoded_field_length = field_mccDigit1.RAW_decode(General__Types::HEX1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::HEX1_descr_.raw->forceomit); decoded_field_length = field_mccDigit2.RAW_decode(General__Types::HEX1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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_field1 -= decoded_field_length; RAW_Force_Omit field_4_force_omit(4, force_omit, General__Types::HEX1_descr_.raw->forceomit); decoded_field_length = field_mccDigit3.RAW_decode(General__Types::HEX1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, no_err, -1, TRUE, &field_4_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_5_force_omit(5, force_omit, General__Types::HEX1_descr_.raw->forceomit); decoded_field_length = field_mncDigit3.RAW_decode(General__Types::HEX1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, no_err, -1, TRUE, &field_5_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_6_force_omit(6, force_omit, General__Types::HEX1_descr_.raw->forceomit); decoded_field_length = field_mncDigit1.RAW_decode(General__Types::HEX1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, no_err, -1, TRUE, &field_6_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_7_force_omit(7, force_omit, General__Types::HEX1_descr_.raw->forceomit); decoded_field_length = field_mncDigit2.RAW_decode(General__Types::HEX1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, no_err, -1, TRUE, &field_7_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_8_force_omit(8, force_omit, UserCSGInformation_spare1_descr_.raw->forceomit); decoded_field_length = field_spare1.RAW_decode(UserCSGInformation_spare1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, no_err, -1, TRUE, &field_8_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_9_force_omit(9, force_omit, UserCSGInformation_cSG__ID_descr_.raw->forceomit); decoded_field_length = field_cSG__ID.RAW_decode(UserCSGInformation_cSG__ID_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, no_err, -1, TRUE, &field_9_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_field1 -= decoded_field_length; RAW_Force_Omit field_10_force_omit(10, force_omit, General__Types::BIT1_descr_.raw->forceomit); decoded_field_length = field_cMI.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, no_err, -1, TRUE, &field_10_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_field1 -= decoded_field_length; RAW_Force_Omit field_11_force_omit(11, force_omit, General__Types::BIT5_descr_.raw->forceomit); decoded_field_length = field_spare2.RAW_decode(General__Types::BIT5_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, no_err, -1, TRUE, &field_11_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_field1 -= decoded_field_length; RAW_Force_Omit field_12_force_omit(12, force_omit, UserCSGInformation_accessMode_descr_.raw->forceomit); decoded_field_length = field_accessMode.RAW_decode(UserCSGInformation_accessMode_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, no_err, -1, TRUE, &field_12_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_field1 -= decoded_field_length; if (field_type__gtpc != os_36) return -1; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int UserCSGInformation::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 = 13; myleaf.body.node.nodes = init_nodes_of_enc_tree(13); 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, UserCSGInformation_lengthf_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, General__Types::HEX1_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::HEX1_descr_.raw); myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, General__Types::HEX1_descr_.raw); myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, General__Types::HEX1_descr_.raw); myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, General__Types::HEX1_descr_.raw); myleaf.body.node.nodes[7] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 7, General__Types::HEX1_descr_.raw); myleaf.body.node.nodes[8] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 8, UserCSGInformation_spare1_descr_.raw); myleaf.body.node.nodes[9] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 9, UserCSGInformation_cSG__ID_descr_.raw); myleaf.body.node.nodes[10] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 10, General__Types::BIT1_descr_.raw); myleaf.body.node.nodes[11] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 11, General__Types::BIT5_descr_.raw); myleaf.body.node.nodes[12] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 12, UserCSGInformation_accessMode_descr_.raw); encoded_length += field_type__gtpc.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += 16; myleaf.body.node.nodes[1]->calc = CALC_LENGTH; myleaf.body.node.nodes[1]->coding_descr = &UserCSGInformation_lengthf_descr_; myleaf.body.node.nodes[1]->calcof.lengthto.num_of_fields = 11; myleaf.body.node.nodes[1]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[1]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields = init_lengthto_fields_list(11); myleaf.body.node.nodes[1]->length = 16; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[2]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[2]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].level = myleaf.body.node.nodes[3]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].pos = myleaf.body.node.nodes[3]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].level = myleaf.body.node.nodes[4]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].pos = myleaf.body.node.nodes[4]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[3].level = myleaf.body.node.nodes[5]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[3].pos = myleaf.body.node.nodes[5]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[4].level = myleaf.body.node.nodes[6]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[4].pos = myleaf.body.node.nodes[6]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[5].level = myleaf.body.node.nodes[7]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[5].pos = myleaf.body.node.nodes[7]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[6].level = myleaf.body.node.nodes[8]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[6].pos = myleaf.body.node.nodes[8]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[7].level = myleaf.body.node.nodes[9]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[7].pos = myleaf.body.node.nodes[9]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[8].level = myleaf.body.node.nodes[10]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[8].pos = myleaf.body.node.nodes[10]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[9].level = myleaf.body.node.nodes[11]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[9].pos = myleaf.body.node.nodes[11]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[10].level = myleaf.body.node.nodes[12]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[10].pos = myleaf.body.node.nodes[12]->curr_pos.pos; encoded_length += field_mccDigit1.RAW_encode(General__Types::HEX1_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_mccDigit2.RAW_encode(General__Types::HEX1_descr_, *myleaf.body.node.nodes[3]); encoded_length += field_mccDigit3.RAW_encode(General__Types::HEX1_descr_, *myleaf.body.node.nodes[4]); encoded_length += field_mncDigit3.RAW_encode(General__Types::HEX1_descr_, *myleaf.body.node.nodes[5]); encoded_length += field_mncDigit1.RAW_encode(General__Types::HEX1_descr_, *myleaf.body.node.nodes[6]); encoded_length += field_mncDigit2.RAW_encode(General__Types::HEX1_descr_, *myleaf.body.node.nodes[7]); encoded_length += field_spare1.RAW_encode(UserCSGInformation_spare1_descr_, *myleaf.body.node.nodes[8]); encoded_length += field_cSG__ID.RAW_encode(UserCSGInformation_cSG__ID_descr_, *myleaf.body.node.nodes[9]); encoded_length += field_cMI.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[10]); encoded_length += field_spare2.RAW_encode(General__Types::BIT5_descr_, *myleaf.body.node.nodes[11]); encoded_length += field_accessMode.RAW_encode(UserCSGInformation_accessMode_descr_, *myleaf.body.node.nodes[12]); if (field_type__gtpc != os_36) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={0}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ os_36.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 UserCSGInformation_template::single_value_struct { OCTETSTRING_template field_type__gtpc; INTEGER_template field_lengthf; HEXSTRING_template field_mccDigit1; HEXSTRING_template field_mccDigit2; HEXSTRING_template field_mccDigit3; HEXSTRING_template field_mncDigit3; HEXSTRING_template field_mncDigit1; HEXSTRING_template field_mncDigit2; BITSTRING_template field_spare1; BITSTRING_template field_cSG__ID; BITSTRING_template field_cMI; BITSTRING_template field_spare2; INTEGER_template field_accessMode; }; void UserCSGInformation_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_type__gtpc = ANY_VALUE; single_value->field_lengthf = ANY_VALUE; single_value->field_mccDigit1 = ANY_VALUE; single_value->field_mccDigit2 = ANY_VALUE; single_value->field_mccDigit3 = ANY_VALUE; single_value->field_mncDigit3 = ANY_VALUE; single_value->field_mncDigit1 = ANY_VALUE; single_value->field_mncDigit2 = ANY_VALUE; single_value->field_spare1 = ANY_VALUE; single_value->field_cSG__ID = ANY_VALUE; single_value->field_cMI = ANY_VALUE; single_value->field_spare2 = ANY_VALUE; single_value->field_accessMode = ANY_VALUE; } } } void UserCSGInformation_template::copy_value(const UserCSGInformation& other_value) { single_value = new single_value_struct; if (other_value.type__gtpc().is_bound()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (other_value.lengthf().is_bound()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (other_value.mccDigit1().is_bound()) { single_value->field_mccDigit1 = other_value.mccDigit1(); } else { single_value->field_mccDigit1.clean_up(); } if (other_value.mccDigit2().is_bound()) { single_value->field_mccDigit2 = other_value.mccDigit2(); } else { single_value->field_mccDigit2.clean_up(); } if (other_value.mccDigit3().is_bound()) { single_value->field_mccDigit3 = other_value.mccDigit3(); } else { single_value->field_mccDigit3.clean_up(); } if (other_value.mncDigit3().is_bound()) { single_value->field_mncDigit3 = other_value.mncDigit3(); } else { single_value->field_mncDigit3.clean_up(); } if (other_value.mncDigit1().is_bound()) { single_value->field_mncDigit1 = other_value.mncDigit1(); } else { single_value->field_mncDigit1.clean_up(); } if (other_value.mncDigit2().is_bound()) { single_value->field_mncDigit2 = other_value.mncDigit2(); } else { single_value->field_mncDigit2.clean_up(); } if (other_value.spare1().is_bound()) { single_value->field_spare1 = other_value.spare1(); } else { single_value->field_spare1.clean_up(); } if (other_value.cSG__ID().is_bound()) { single_value->field_cSG__ID = other_value.cSG__ID(); } else { single_value->field_cSG__ID.clean_up(); } if (other_value.cMI().is_bound()) { single_value->field_cMI = other_value.cMI(); } else { single_value->field_cMI.clean_up(); } if (other_value.spare2().is_bound()) { single_value->field_spare2 = other_value.spare2(); } else { single_value->field_spare2.clean_up(); } if (other_value.accessMode().is_bound()) { single_value->field_accessMode = other_value.accessMode(); } else { single_value->field_accessMode.clean_up(); } set_selection(SPECIFIC_VALUE); } void UserCSGInformation_template::copy_template(const UserCSGInformation_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.type__gtpc().get_selection()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lengthf().get_selection()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.mccDigit1().get_selection()) { single_value->field_mccDigit1 = other_value.mccDigit1(); } else { single_value->field_mccDigit1.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.mccDigit2().get_selection()) { single_value->field_mccDigit2 = other_value.mccDigit2(); } else { single_value->field_mccDigit2.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.mccDigit3().get_selection()) { single_value->field_mccDigit3 = other_value.mccDigit3(); } else { single_value->field_mccDigit3.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.mncDigit3().get_selection()) { single_value->field_mncDigit3 = other_value.mncDigit3(); } else { single_value->field_mncDigit3.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.mncDigit1().get_selection()) { single_value->field_mncDigit1 = other_value.mncDigit1(); } else { single_value->field_mncDigit1.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.mncDigit2().get_selection()) { single_value->field_mncDigit2 = other_value.mncDigit2(); } else { single_value->field_mncDigit2.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.spare1().get_selection()) { single_value->field_spare1 = other_value.spare1(); } else { single_value->field_spare1.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.cSG__ID().get_selection()) { single_value->field_cSG__ID = other_value.cSG__ID(); } else { single_value->field_cSG__ID.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.cMI().get_selection()) { single_value->field_cMI = other_value.cMI(); } else { single_value->field_cMI.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.spare2().get_selection()) { single_value->field_spare2 = other_value.spare2(); } else { single_value->field_spare2.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.accessMode().get_selection()) { single_value->field_accessMode = other_value.accessMode(); } else { single_value->field_accessMode.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 UserCSGInformation_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 UserCSGInformation_template(*other_value.implication_.precondition); implication_.implied_template = new UserCSGInformation_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 @GTPC_Types.UserCSGInformation."); break; } set_selection(other_value); } UserCSGInformation_template::UserCSGInformation_template() { } UserCSGInformation_template::UserCSGInformation_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } UserCSGInformation_template::UserCSGInformation_template(const UserCSGInformation& other_value) { copy_value(other_value); } UserCSGInformation_template::UserCSGInformation_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const UserCSGInformation&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.UserCSGInformation from an unbound optional field."); } } UserCSGInformation_template::UserCSGInformation_template(UserCSGInformation_template* p_precondition, UserCSGInformation_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } UserCSGInformation_template::UserCSGInformation_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; } UserCSGInformation_template::UserCSGInformation_template(const UserCSGInformation_template& other_value) : Base_Template() { copy_template(other_value); } UserCSGInformation_template::~UserCSGInformation_template() { clean_up(); } UserCSGInformation_template& UserCSGInformation_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } UserCSGInformation_template& UserCSGInformation_template::operator=(const UserCSGInformation& other_value) { clean_up(); copy_value(other_value); return *this; } UserCSGInformation_template& UserCSGInformation_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const UserCSGInformation&)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 @GTPC_Types.UserCSGInformation."); } return *this; } UserCSGInformation_template& UserCSGInformation_template::operator=(const UserCSGInformation_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean UserCSGInformation_template::match(const UserCSGInformation& 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.type__gtpc().is_bound()) return FALSE; if(!single_value->field_type__gtpc.match(other_value.type__gtpc(), legacy))return FALSE; if(!other_value.lengthf().is_bound()) return FALSE; if(!single_value->field_lengthf.match(other_value.lengthf(), legacy))return FALSE; if(!other_value.mccDigit1().is_bound()) return FALSE; if(!single_value->field_mccDigit1.match(other_value.mccDigit1(), legacy))return FALSE; if(!other_value.mccDigit2().is_bound()) return FALSE; if(!single_value->field_mccDigit2.match(other_value.mccDigit2(), legacy))return FALSE; if(!other_value.mccDigit3().is_bound()) return FALSE; if(!single_value->field_mccDigit3.match(other_value.mccDigit3(), legacy))return FALSE; if(!other_value.mncDigit3().is_bound()) return FALSE; if(!single_value->field_mncDigit3.match(other_value.mncDigit3(), legacy))return FALSE; if(!other_value.mncDigit1().is_bound()) return FALSE; if(!single_value->field_mncDigit1.match(other_value.mncDigit1(), legacy))return FALSE; if(!other_value.mncDigit2().is_bound()) return FALSE; if(!single_value->field_mncDigit2.match(other_value.mncDigit2(), legacy))return FALSE; if(!other_value.spare1().is_bound()) return FALSE; if(!single_value->field_spare1.match(other_value.spare1(), legacy))return FALSE; if(!other_value.cSG__ID().is_bound()) return FALSE; if(!single_value->field_cSG__ID.match(other_value.cSG__ID(), legacy))return FALSE; if(!other_value.cMI().is_bound()) return FALSE; if(!single_value->field_cMI.match(other_value.cMI(), legacy))return FALSE; if(!other_value.spare2().is_bound()) return FALSE; if(!single_value->field_spare2.match(other_value.spare2(), legacy))return FALSE; if(!other_value.accessMode().is_bound()) return FALSE; if(!single_value->field_accessMode.match(other_value.accessMode(), 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 @GTPC_Types.UserCSGInformation."); } return FALSE; } boolean UserCSGInformation_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_type__gtpc.is_bound() || single_value->field_lengthf.is_bound() || single_value->field_mccDigit1.is_bound() || single_value->field_mccDigit2.is_bound() || single_value->field_mccDigit3.is_bound() || single_value->field_mncDigit3.is_bound() || single_value->field_mncDigit1.is_bound() || single_value->field_mncDigit2.is_bound() || single_value->field_spare1.is_bound() || single_value->field_cSG__ID.is_bound() || single_value->field_cMI.is_bound() || single_value->field_spare2.is_bound() || single_value->field_accessMode.is_bound(); } boolean UserCSGInformation_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_type__gtpc.is_value() && single_value->field_lengthf.is_value() && single_value->field_mccDigit1.is_value() && single_value->field_mccDigit2.is_value() && single_value->field_mccDigit3.is_value() && single_value->field_mncDigit3.is_value() && single_value->field_mncDigit1.is_value() && single_value->field_mncDigit2.is_value() && single_value->field_spare1.is_value() && single_value->field_cSG__ID.is_value() && single_value->field_cMI.is_value() && single_value->field_spare2.is_value() && single_value->field_accessMode.is_value(); } void UserCSGInformation_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; } UserCSGInformation UserCSGInformation_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 @GTPC_Types.UserCSGInformation."); UserCSGInformation ret_val; if (single_value->field_type__gtpc.is_bound()) { ret_val.type__gtpc() = single_value->field_type__gtpc.valueof(); } if (single_value->field_lengthf.is_bound()) { ret_val.lengthf() = single_value->field_lengthf.valueof(); } if (single_value->field_mccDigit1.is_bound()) { ret_val.mccDigit1() = single_value->field_mccDigit1.valueof(); } if (single_value->field_mccDigit2.is_bound()) { ret_val.mccDigit2() = single_value->field_mccDigit2.valueof(); } if (single_value->field_mccDigit3.is_bound()) { ret_val.mccDigit3() = single_value->field_mccDigit3.valueof(); } if (single_value->field_mncDigit3.is_bound()) { ret_val.mncDigit3() = single_value->field_mncDigit3.valueof(); } if (single_value->field_mncDigit1.is_bound()) { ret_val.mncDigit1() = single_value->field_mncDigit1.valueof(); } if (single_value->field_mncDigit2.is_bound()) { ret_val.mncDigit2() = single_value->field_mncDigit2.valueof(); } if (single_value->field_spare1.is_bound()) { ret_val.spare1() = single_value->field_spare1.valueof(); } if (single_value->field_cSG__ID.is_bound()) { ret_val.cSG__ID() = single_value->field_cSG__ID.valueof(); } if (single_value->field_cMI.is_bound()) { ret_val.cMI() = single_value->field_cMI.valueof(); } if (single_value->field_spare2.is_bound()) { ret_val.spare2() = single_value->field_spare2.valueof(); } if (single_value->field_accessMode.is_bound()) { ret_val.accessMode() = single_value->field_accessMode.valueof(); } return ret_val; } void UserCSGInformation_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 @GTPC_Types.UserCSGInformation."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new UserCSGInformation_template[list_length]; } UserCSGInformation_template& UserCSGInformation_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 @GTPC_Types.UserCSGInformation."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.UserCSGInformation."); return value_list.list_value[list_index]; } OCTETSTRING_template& UserCSGInformation_template::type__gtpc() { set_specific(); return single_value->field_type__gtpc; } const OCTETSTRING_template& UserCSGInformation_template::type__gtpc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field type_gtpc of a non-specific template of type @GTPC_Types.UserCSGInformation."); return single_value->field_type__gtpc; } INTEGER_template& UserCSGInformation_template::lengthf() { set_specific(); return single_value->field_lengthf; } const INTEGER_template& UserCSGInformation_template::lengthf() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthf of a non-specific template of type @GTPC_Types.UserCSGInformation."); return single_value->field_lengthf; } HEXSTRING_template& UserCSGInformation_template::mccDigit1() { set_specific(); return single_value->field_mccDigit1; } const HEXSTRING_template& UserCSGInformation_template::mccDigit1() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field mccDigit1 of a non-specific template of type @GTPC_Types.UserCSGInformation."); return single_value->field_mccDigit1; } HEXSTRING_template& UserCSGInformation_template::mccDigit2() { set_specific(); return single_value->field_mccDigit2; } const HEXSTRING_template& UserCSGInformation_template::mccDigit2() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field mccDigit2 of a non-specific template of type @GTPC_Types.UserCSGInformation."); return single_value->field_mccDigit2; } HEXSTRING_template& UserCSGInformation_template::mccDigit3() { set_specific(); return single_value->field_mccDigit3; } const HEXSTRING_template& UserCSGInformation_template::mccDigit3() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field mccDigit3 of a non-specific template of type @GTPC_Types.UserCSGInformation."); return single_value->field_mccDigit3; } HEXSTRING_template& UserCSGInformation_template::mncDigit3() { set_specific(); return single_value->field_mncDigit3; } const HEXSTRING_template& UserCSGInformation_template::mncDigit3() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field mncDigit3 of a non-specific template of type @GTPC_Types.UserCSGInformation."); return single_value->field_mncDigit3; } HEXSTRING_template& UserCSGInformation_template::mncDigit1() { set_specific(); return single_value->field_mncDigit1; } const HEXSTRING_template& UserCSGInformation_template::mncDigit1() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field mncDigit1 of a non-specific template of type @GTPC_Types.UserCSGInformation."); return single_value->field_mncDigit1; } HEXSTRING_template& UserCSGInformation_template::mncDigit2() { set_specific(); return single_value->field_mncDigit2; } const HEXSTRING_template& UserCSGInformation_template::mncDigit2() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field mncDigit2 of a non-specific template of type @GTPC_Types.UserCSGInformation."); return single_value->field_mncDigit2; } BITSTRING_template& UserCSGInformation_template::spare1() { set_specific(); return single_value->field_spare1; } const BITSTRING_template& UserCSGInformation_template::spare1() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field spare1 of a non-specific template of type @GTPC_Types.UserCSGInformation."); return single_value->field_spare1; } BITSTRING_template& UserCSGInformation_template::cSG__ID() { set_specific(); return single_value->field_cSG__ID; } const BITSTRING_template& UserCSGInformation_template::cSG__ID() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field cSG_ID of a non-specific template of type @GTPC_Types.UserCSGInformation."); return single_value->field_cSG__ID; } BITSTRING_template& UserCSGInformation_template::cMI() { set_specific(); return single_value->field_cMI; } const BITSTRING_template& UserCSGInformation_template::cMI() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field cMI of a non-specific template of type @GTPC_Types.UserCSGInformation."); return single_value->field_cMI; } BITSTRING_template& UserCSGInformation_template::spare2() { set_specific(); return single_value->field_spare2; } const BITSTRING_template& UserCSGInformation_template::spare2() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field spare2 of a non-specific template of type @GTPC_Types.UserCSGInformation."); return single_value->field_spare2; } INTEGER_template& UserCSGInformation_template::accessMode() { set_specific(); return single_value->field_accessMode; } const INTEGER_template& UserCSGInformation_template::accessMode() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field accessMode of a non-specific template of type @GTPC_Types.UserCSGInformation."); return single_value->field_accessMode; } int UserCSGInformation_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.UserCSGInformation which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 13; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @GTPC_Types.UserCSGInformation 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 @GTPC_Types.UserCSGInformation containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.UserCSGInformation containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.UserCSGInformation containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.UserCSGInformation containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.UserCSGInformation containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.UserCSGInformation containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.UserCSGInformation containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.UserCSGInformation."); } return 0; } void UserCSGInformation_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ type_gtpc := "); single_value->field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log(); TTCN_Logger::log_event_str(", mccDigit1 := "); single_value->field_mccDigit1.log(); TTCN_Logger::log_event_str(", mccDigit2 := "); single_value->field_mccDigit2.log(); TTCN_Logger::log_event_str(", mccDigit3 := "); single_value->field_mccDigit3.log(); TTCN_Logger::log_event_str(", mncDigit3 := "); single_value->field_mncDigit3.log(); TTCN_Logger::log_event_str(", mncDigit1 := "); single_value->field_mncDigit1.log(); TTCN_Logger::log_event_str(", mncDigit2 := "); single_value->field_mncDigit2.log(); TTCN_Logger::log_event_str(", spare1 := "); single_value->field_spare1.log(); TTCN_Logger::log_event_str(", cSG_ID := "); single_value->field_cSG__ID.log(); TTCN_Logger::log_event_str(", cMI := "); single_value->field_cMI.log(); TTCN_Logger::log_event_str(", spare2 := "); single_value->field_spare2.log(); TTCN_Logger::log_event_str(", accessMode := "); single_value->field_accessMode.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 UserCSGInformation_template::log_match(const UserCSGInformation& 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_type__gtpc.match(match_value.type__gtpc(), legacy)){ TTCN_Logger::log_logmatch_info(".type_gtpc"); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lengthf.match(match_value.lengthf(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthf"); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_mccDigit1.match(match_value.mccDigit1(), legacy)){ TTCN_Logger::log_logmatch_info(".mccDigit1"); single_value->field_mccDigit1.log_match(match_value.mccDigit1(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_mccDigit2.match(match_value.mccDigit2(), legacy)){ TTCN_Logger::log_logmatch_info(".mccDigit2"); single_value->field_mccDigit2.log_match(match_value.mccDigit2(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_mccDigit3.match(match_value.mccDigit3(), legacy)){ TTCN_Logger::log_logmatch_info(".mccDigit3"); single_value->field_mccDigit3.log_match(match_value.mccDigit3(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_mncDigit3.match(match_value.mncDigit3(), legacy)){ TTCN_Logger::log_logmatch_info(".mncDigit3"); single_value->field_mncDigit3.log_match(match_value.mncDigit3(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_mncDigit1.match(match_value.mncDigit1(), legacy)){ TTCN_Logger::log_logmatch_info(".mncDigit1"); single_value->field_mncDigit1.log_match(match_value.mncDigit1(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_mncDigit2.match(match_value.mncDigit2(), legacy)){ TTCN_Logger::log_logmatch_info(".mncDigit2"); single_value->field_mncDigit2.log_match(match_value.mncDigit2(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_spare1.match(match_value.spare1(), legacy)){ TTCN_Logger::log_logmatch_info(".spare1"); single_value->field_spare1.log_match(match_value.spare1(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_cSG__ID.match(match_value.cSG__ID(), legacy)){ TTCN_Logger::log_logmatch_info(".cSG_ID"); single_value->field_cSG__ID.log_match(match_value.cSG__ID(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_cMI.match(match_value.cMI(), legacy)){ TTCN_Logger::log_logmatch_info(".cMI"); single_value->field_cMI.log_match(match_value.cMI(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_spare2.match(match_value.spare2(), legacy)){ TTCN_Logger::log_logmatch_info(".spare2"); single_value->field_spare2.log_match(match_value.spare2(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_accessMode.match(match_value.accessMode(), legacy)){ TTCN_Logger::log_logmatch_info(".accessMode"); single_value->field_accessMode.log_match(match_value.accessMode(), 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("{ type_gtpc := "); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::log_event_str(", mccDigit1 := "); single_value->field_mccDigit1.log_match(match_value.mccDigit1(), legacy); TTCN_Logger::log_event_str(", mccDigit2 := "); single_value->field_mccDigit2.log_match(match_value.mccDigit2(), legacy); TTCN_Logger::log_event_str(", mccDigit3 := "); single_value->field_mccDigit3.log_match(match_value.mccDigit3(), legacy); TTCN_Logger::log_event_str(", mncDigit3 := "); single_value->field_mncDigit3.log_match(match_value.mncDigit3(), legacy); TTCN_Logger::log_event_str(", mncDigit1 := "); single_value->field_mncDigit1.log_match(match_value.mncDigit1(), legacy); TTCN_Logger::log_event_str(", mncDigit2 := "); single_value->field_mncDigit2.log_match(match_value.mncDigit2(), legacy); TTCN_Logger::log_event_str(", spare1 := "); single_value->field_spare1.log_match(match_value.spare1(), legacy); TTCN_Logger::log_event_str(", cSG_ID := "); single_value->field_cSG__ID.log_match(match_value.cSG__ID(), legacy); TTCN_Logger::log_event_str(", cMI := "); single_value->field_cMI.log_match(match_value.cMI(), legacy); TTCN_Logger::log_event_str(", spare2 := "); single_value->field_spare2.log_match(match_value.spare2(), legacy); TTCN_Logger::log_event_str(", accessMode := "); single_value->field_accessMode.log_match(match_value.accessMode(), 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 UserCSGInformation_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_type__gtpc.encode_text(text_buf); single_value->field_lengthf.encode_text(text_buf); single_value->field_mccDigit1.encode_text(text_buf); single_value->field_mccDigit2.encode_text(text_buf); single_value->field_mccDigit3.encode_text(text_buf); single_value->field_mncDigit3.encode_text(text_buf); single_value->field_mncDigit1.encode_text(text_buf); single_value->field_mncDigit2.encode_text(text_buf); single_value->field_spare1.encode_text(text_buf); single_value->field_cSG__ID.encode_text(text_buf); single_value->field_cMI.encode_text(text_buf); single_value->field_spare2.encode_text(text_buf); single_value->field_accessMode.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 @GTPC_Types.UserCSGInformation."); } } void UserCSGInformation_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_type__gtpc.decode_text(text_buf); single_value->field_lengthf.decode_text(text_buf); single_value->field_mccDigit1.decode_text(text_buf); single_value->field_mccDigit2.decode_text(text_buf); single_value->field_mccDigit3.decode_text(text_buf); single_value->field_mncDigit3.decode_text(text_buf); single_value->field_mncDigit1.decode_text(text_buf); single_value->field_mncDigit2.decode_text(text_buf); single_value->field_spare1.decode_text(text_buf); single_value->field_cSG__ID.decode_text(text_buf); single_value->field_cMI.decode_text(text_buf); single_value->field_spare2.decode_text(text_buf); single_value->field_accessMode.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 UserCSGInformation_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 @GTPC_Types.UserCSGInformation."); } } void UserCSGInformation_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: { UserCSGInformation_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) mccDigit1().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) mccDigit2().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) mccDigit3().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) mncDigit3().set_param(*param.get_elem(5)); if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) mncDigit1().set_param(*param.get_elem(6)); if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) mncDigit2().set_param(*param.get_elem(7)); if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) spare1().set_param(*param.get_elem(8)); if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) cSG__ID().set_param(*param.get_elem(9)); if (param.get_size()>10 && param.get_elem(10)->get_type()!=Module_Param::MP_NotUsed) cMI().set_param(*param.get_elem(10)); if (param.get_size()>11 && param.get_elem(11)->get_type()!=Module_Param::MP_NotUsed) spare2().set_param(*param.get_elem(11)); if (param.get_size()>12 && param.get_elem(12)->get_type()!=Module_Param::MP_NotUsed) accessMode().set_param(*param.get_elem(12)); 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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mccDigit1")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mccDigit1().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mccDigit2")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mccDigit2().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mccDigit3")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mccDigit3().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mncDigit3")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mncDigit3().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mncDigit1")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mncDigit1().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mncDigit2")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mncDigit2().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "spare1")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare1().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "cSG_ID")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cSG__ID().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "cMI")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cMI().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "spare2")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare2().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "accessMode")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { accessMode().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.UserCSGInformation: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { UserCSGInformation_template* precondition = new UserCSGInformation_template; precondition->set_param(*param.get_elem(0)); UserCSGInformation_template* implied_template = new UserCSGInformation_template; implied_template->set_param(*param.get_elem(1)); *this = UserCSGInformation_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.UserCSGInformation"); } is_ifpresent = param.get_ifpresent(); } void UserCSGInformation_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_type__gtpc.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.UserCSGInformation"); single_value->field_lengthf.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.UserCSGInformation"); single_value->field_mccDigit1.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.UserCSGInformation"); single_value->field_mccDigit2.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.UserCSGInformation"); single_value->field_mccDigit3.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.UserCSGInformation"); single_value->field_mncDigit3.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.UserCSGInformation"); single_value->field_mncDigit1.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.UserCSGInformation"); single_value->field_mncDigit2.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.UserCSGInformation"); single_value->field_spare1.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.UserCSGInformation"); single_value->field_cSG__ID.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.UserCSGInformation"); single_value->field_cMI.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.UserCSGInformation"); single_value->field_spare2.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.UserCSGInformation"); single_value->field_accessMode.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.UserCSGInformation"); 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 : "@GTPC_Types.UserCSGInformation"); } boolean UserCSGInformation_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean UserCSGInformation_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) uCCSG().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) uCSHC().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) uCUHC().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) spare().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "uCCSG")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { uCCSG().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "uCSHC")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { uCSHC().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "uCUHC")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { uCUHC().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 @GTPC_Types.CSGInfoReportingAction: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.CSGInfoReportingAction"); } } void CSGInfoReportingAction::encode_text(Text_Buf& text_buf) const { field_type__gtpc.encode_text(text_buf); field_lengthf.encode_text(text_buf); field_uCCSG.encode_text(text_buf); field_uCSHC.encode_text(text_buf); field_uCUHC.encode_text(text_buf); field_spare.encode_text(text_buf); } void CSGInfoReportingAction::decode_text(Text_Buf& text_buf) { field_type__gtpc.decode_text(text_buf); field_lengthf.decode_text(text_buf); field_uCCSG.decode_text(text_buf); field_uCSHC.decode_text(text_buf); field_uCUHC.decode_text(text_buf); field_spare.decode_text(text_buf); } void CSGInfoReportingAction::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 CSGInfoReportingAction::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 CSGInfoReportingAction::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; int value_of_length_field1 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_type__gtpc.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, CSGInfoReportingAction_lengthf_descr_.raw->forceomit); decoded_field_length = field_lengthf.RAW_decode(CSGInfoReportingAction_lengthf_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()); INTEGER tmp1 = field_lengthf.convert_to_Integer(CSGInfoReportingAction_lengthf_descr_); field_lengthf = tmp1; value_of_length_field1 += tmp1.get_long_long_val() * 8; RAW_Force_Omit field_2_force_omit(2, force_omit, General__Types::BIT1_descr_.raw->forceomit); decoded_field_length = field_uCCSG.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::BIT1_descr_.raw->forceomit); decoded_field_length = field_uCSHC.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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_field1 -= decoded_field_length; RAW_Force_Omit field_4_force_omit(4, force_omit, General__Types::BIT1_descr_.raw->forceomit); decoded_field_length = field_uCUHC.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, no_err, -1, TRUE, &field_4_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_5_force_omit(5, force_omit, General__Types::BIT5_descr_.raw->forceomit); decoded_field_length = field_spare.RAW_decode(General__Types::BIT5_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, no_err, -1, TRUE, &field_5_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); value_of_length_field1 -= decoded_field_length; if (field_type__gtpc != os_44) return -1; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int CSGInfoReportingAction::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, CSGInfoReportingAction_lengthf_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, General__Types::BIT1_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::BIT1_descr_.raw); myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, General__Types::BIT1_descr_.raw); myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, General__Types::BIT5_descr_.raw); encoded_length += field_type__gtpc.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += 16; myleaf.body.node.nodes[1]->calc = CALC_LENGTH; myleaf.body.node.nodes[1]->coding_descr = &CSGInfoReportingAction_lengthf_descr_; myleaf.body.node.nodes[1]->calcof.lengthto.num_of_fields = 4; myleaf.body.node.nodes[1]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[1]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields = init_lengthto_fields_list(4); myleaf.body.node.nodes[1]->length = 16; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[2]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[2]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].level = myleaf.body.node.nodes[3]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].pos = myleaf.body.node.nodes[3]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].level = myleaf.body.node.nodes[4]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].pos = myleaf.body.node.nodes[4]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[3].level = myleaf.body.node.nodes[5]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[3].pos = myleaf.body.node.nodes[5]->curr_pos.pos; encoded_length += field_uCCSG.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_uCSHC.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[3]); encoded_length += field_uCUHC.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[4]); encoded_length += field_spare.RAW_encode(General__Types::BIT5_descr_, *myleaf.body.node.nodes[5]); if (field_type__gtpc != os_44) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={0}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ os_44.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 CSGInfoReportingAction_template::single_value_struct { OCTETSTRING_template field_type__gtpc; INTEGER_template field_lengthf; BITSTRING_template field_uCCSG; BITSTRING_template field_uCSHC; BITSTRING_template field_uCUHC; BITSTRING_template field_spare; }; void CSGInfoReportingAction_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_type__gtpc = ANY_VALUE; single_value->field_lengthf = ANY_VALUE; single_value->field_uCCSG = ANY_VALUE; single_value->field_uCSHC = ANY_VALUE; single_value->field_uCUHC = ANY_VALUE; single_value->field_spare = ANY_VALUE; } } } void CSGInfoReportingAction_template::copy_value(const CSGInfoReportingAction& other_value) { single_value = new single_value_struct; if (other_value.type__gtpc().is_bound()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (other_value.lengthf().is_bound()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (other_value.uCCSG().is_bound()) { single_value->field_uCCSG = other_value.uCCSG(); } else { single_value->field_uCCSG.clean_up(); } if (other_value.uCSHC().is_bound()) { single_value->field_uCSHC = other_value.uCSHC(); } else { single_value->field_uCSHC.clean_up(); } if (other_value.uCUHC().is_bound()) { single_value->field_uCUHC = other_value.uCUHC(); } else { single_value->field_uCUHC.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 CSGInfoReportingAction_template::copy_template(const CSGInfoReportingAction_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.type__gtpc().get_selection()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lengthf().get_selection()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.uCCSG().get_selection()) { single_value->field_uCCSG = other_value.uCCSG(); } else { single_value->field_uCCSG.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.uCSHC().get_selection()) { single_value->field_uCSHC = other_value.uCSHC(); } else { single_value->field_uCSHC.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.uCUHC().get_selection()) { single_value->field_uCUHC = other_value.uCUHC(); } else { single_value->field_uCUHC.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 CSGInfoReportingAction_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 CSGInfoReportingAction_template(*other_value.implication_.precondition); implication_.implied_template = new CSGInfoReportingAction_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 @GTPC_Types.CSGInfoReportingAction."); break; } set_selection(other_value); } CSGInfoReportingAction_template::CSGInfoReportingAction_template() { } CSGInfoReportingAction_template::CSGInfoReportingAction_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } CSGInfoReportingAction_template::CSGInfoReportingAction_template(const CSGInfoReportingAction& other_value) { copy_value(other_value); } CSGInfoReportingAction_template::CSGInfoReportingAction_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const CSGInfoReportingAction&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.CSGInfoReportingAction from an unbound optional field."); } } CSGInfoReportingAction_template::CSGInfoReportingAction_template(CSGInfoReportingAction_template* p_precondition, CSGInfoReportingAction_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } CSGInfoReportingAction_template::CSGInfoReportingAction_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; } CSGInfoReportingAction_template::CSGInfoReportingAction_template(const CSGInfoReportingAction_template& other_value) : Base_Template() { copy_template(other_value); } CSGInfoReportingAction_template::~CSGInfoReportingAction_template() { clean_up(); } CSGInfoReportingAction_template& CSGInfoReportingAction_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } CSGInfoReportingAction_template& CSGInfoReportingAction_template::operator=(const CSGInfoReportingAction& other_value) { clean_up(); copy_value(other_value); return *this; } CSGInfoReportingAction_template& CSGInfoReportingAction_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const CSGInfoReportingAction&)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 @GTPC_Types.CSGInfoReportingAction."); } return *this; } CSGInfoReportingAction_template& CSGInfoReportingAction_template::operator=(const CSGInfoReportingAction_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean CSGInfoReportingAction_template::match(const CSGInfoReportingAction& 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.type__gtpc().is_bound()) return FALSE; if(!single_value->field_type__gtpc.match(other_value.type__gtpc(), legacy))return FALSE; if(!other_value.lengthf().is_bound()) return FALSE; if(!single_value->field_lengthf.match(other_value.lengthf(), legacy))return FALSE; if(!other_value.uCCSG().is_bound()) return FALSE; if(!single_value->field_uCCSG.match(other_value.uCCSG(), legacy))return FALSE; if(!other_value.uCSHC().is_bound()) return FALSE; if(!single_value->field_uCSHC.match(other_value.uCSHC(), legacy))return FALSE; if(!other_value.uCUHC().is_bound()) return FALSE; if(!single_value->field_uCUHC.match(other_value.uCUHC(), 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 @GTPC_Types.CSGInfoReportingAction."); } return FALSE; } boolean CSGInfoReportingAction_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_type__gtpc.is_bound() || single_value->field_lengthf.is_bound() || single_value->field_uCCSG.is_bound() || single_value->field_uCSHC.is_bound() || single_value->field_uCUHC.is_bound() || single_value->field_spare.is_bound(); } boolean CSGInfoReportingAction_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_type__gtpc.is_value() && single_value->field_lengthf.is_value() && single_value->field_uCCSG.is_value() && single_value->field_uCSHC.is_value() && single_value->field_uCUHC.is_value() && single_value->field_spare.is_value(); } void CSGInfoReportingAction_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; } CSGInfoReportingAction CSGInfoReportingAction_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 @GTPC_Types.CSGInfoReportingAction."); CSGInfoReportingAction ret_val; if (single_value->field_type__gtpc.is_bound()) { ret_val.type__gtpc() = single_value->field_type__gtpc.valueof(); } if (single_value->field_lengthf.is_bound()) { ret_val.lengthf() = single_value->field_lengthf.valueof(); } if (single_value->field_uCCSG.is_bound()) { ret_val.uCCSG() = single_value->field_uCCSG.valueof(); } if (single_value->field_uCSHC.is_bound()) { ret_val.uCSHC() = single_value->field_uCSHC.valueof(); } if (single_value->field_uCUHC.is_bound()) { ret_val.uCUHC() = single_value->field_uCUHC.valueof(); } if (single_value->field_spare.is_bound()) { ret_val.spare() = single_value->field_spare.valueof(); } return ret_val; } void CSGInfoReportingAction_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 @GTPC_Types.CSGInfoReportingAction."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new CSGInfoReportingAction_template[list_length]; } CSGInfoReportingAction_template& CSGInfoReportingAction_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 @GTPC_Types.CSGInfoReportingAction."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.CSGInfoReportingAction."); return value_list.list_value[list_index]; } OCTETSTRING_template& CSGInfoReportingAction_template::type__gtpc() { set_specific(); return single_value->field_type__gtpc; } const OCTETSTRING_template& CSGInfoReportingAction_template::type__gtpc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field type_gtpc of a non-specific template of type @GTPC_Types.CSGInfoReportingAction."); return single_value->field_type__gtpc; } INTEGER_template& CSGInfoReportingAction_template::lengthf() { set_specific(); return single_value->field_lengthf; } const INTEGER_template& CSGInfoReportingAction_template::lengthf() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthf of a non-specific template of type @GTPC_Types.CSGInfoReportingAction."); return single_value->field_lengthf; } BITSTRING_template& CSGInfoReportingAction_template::uCCSG() { set_specific(); return single_value->field_uCCSG; } const BITSTRING_template& CSGInfoReportingAction_template::uCCSG() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field uCCSG of a non-specific template of type @GTPC_Types.CSGInfoReportingAction."); return single_value->field_uCCSG; } BITSTRING_template& CSGInfoReportingAction_template::uCSHC() { set_specific(); return single_value->field_uCSHC; } const BITSTRING_template& CSGInfoReportingAction_template::uCSHC() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field uCSHC of a non-specific template of type @GTPC_Types.CSGInfoReportingAction."); return single_value->field_uCSHC; } BITSTRING_template& CSGInfoReportingAction_template::uCUHC() { set_specific(); return single_value->field_uCUHC; } const BITSTRING_template& CSGInfoReportingAction_template::uCUHC() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field uCUHC of a non-specific template of type @GTPC_Types.CSGInfoReportingAction."); return single_value->field_uCUHC; } BITSTRING_template& CSGInfoReportingAction_template::spare() { set_specific(); return single_value->field_spare; } const BITSTRING_template& CSGInfoReportingAction_template::spare() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field spare of a non-specific template of type @GTPC_Types.CSGInfoReportingAction."); return single_value->field_spare; } int CSGInfoReportingAction_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.CSGInfoReportingAction which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 6; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @GTPC_Types.CSGInfoReportingAction 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 @GTPC_Types.CSGInfoReportingAction containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.CSGInfoReportingAction containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.CSGInfoReportingAction containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.CSGInfoReportingAction containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.CSGInfoReportingAction containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.CSGInfoReportingAction containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.CSGInfoReportingAction containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.CSGInfoReportingAction."); } return 0; } void CSGInfoReportingAction_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ type_gtpc := "); single_value->field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log(); TTCN_Logger::log_event_str(", uCCSG := "); single_value->field_uCCSG.log(); TTCN_Logger::log_event_str(", uCSHC := "); single_value->field_uCSHC.log(); TTCN_Logger::log_event_str(", uCUHC := "); single_value->field_uCUHC.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 CSGInfoReportingAction_template::log_match(const CSGInfoReportingAction& 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_type__gtpc.match(match_value.type__gtpc(), legacy)){ TTCN_Logger::log_logmatch_info(".type_gtpc"); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lengthf.match(match_value.lengthf(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthf"); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_uCCSG.match(match_value.uCCSG(), legacy)){ TTCN_Logger::log_logmatch_info(".uCCSG"); single_value->field_uCCSG.log_match(match_value.uCCSG(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_uCSHC.match(match_value.uCSHC(), legacy)){ TTCN_Logger::log_logmatch_info(".uCSHC"); single_value->field_uCSHC.log_match(match_value.uCSHC(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_uCUHC.match(match_value.uCUHC(), legacy)){ TTCN_Logger::log_logmatch_info(".uCUHC"); single_value->field_uCUHC.log_match(match_value.uCUHC(), 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("{ type_gtpc := "); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::log_event_str(", uCCSG := "); single_value->field_uCCSG.log_match(match_value.uCCSG(), legacy); TTCN_Logger::log_event_str(", uCSHC := "); single_value->field_uCSHC.log_match(match_value.uCSHC(), legacy); TTCN_Logger::log_event_str(", uCUHC := "); single_value->field_uCUHC.log_match(match_value.uCUHC(), 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 CSGInfoReportingAction_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_type__gtpc.encode_text(text_buf); single_value->field_lengthf.encode_text(text_buf); single_value->field_uCCSG.encode_text(text_buf); single_value->field_uCSHC.encode_text(text_buf); single_value->field_uCUHC.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 @GTPC_Types.CSGInfoReportingAction."); } } void CSGInfoReportingAction_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_type__gtpc.decode_text(text_buf); single_value->field_lengthf.decode_text(text_buf); single_value->field_uCCSG.decode_text(text_buf); single_value->field_uCSHC.decode_text(text_buf); single_value->field_uCUHC.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 CSGInfoReportingAction_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 @GTPC_Types.CSGInfoReportingAction."); } } void CSGInfoReportingAction_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: { CSGInfoReportingAction_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) uCCSG().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) uCSHC().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) uCUHC().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) spare().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "uCCSG")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { uCCSG().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "uCSHC")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { uCSHC().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "uCUHC")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { uCUHC().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 @GTPC_Types.CSGInfoReportingAction: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { CSGInfoReportingAction_template* precondition = new CSGInfoReportingAction_template; precondition->set_param(*param.get_elem(0)); CSGInfoReportingAction_template* implied_template = new CSGInfoReportingAction_template; implied_template->set_param(*param.get_elem(1)); *this = CSGInfoReportingAction_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.CSGInfoReportingAction"); } is_ifpresent = param.get_ifpresent(); } void CSGInfoReportingAction_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_type__gtpc.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.CSGInfoReportingAction"); single_value->field_lengthf.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.CSGInfoReportingAction"); single_value->field_uCCSG.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.CSGInfoReportingAction"); single_value->field_uCSHC.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.CSGInfoReportingAction"); single_value->field_uCUHC.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.CSGInfoReportingAction"); single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.CSGInfoReportingAction"); 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 : "@GTPC_Types.CSGInfoReportingAction"); } boolean CSGInfoReportingAction_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean CSGInfoReportingAction_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) cSG__ID().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "spare")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "cSG_ID")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cSG__ID().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.CSG_Id: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.CSG_Id"); } } void CSG__Id::encode_text(Text_Buf& text_buf) const { field_type__gtpc.encode_text(text_buf); field_lengthf.encode_text(text_buf); field_spare.encode_text(text_buf); field_cSG__ID.encode_text(text_buf); } void CSG__Id::decode_text(Text_Buf& text_buf) { field_type__gtpc.decode_text(text_buf); field_lengthf.decode_text(text_buf); field_spare.decode_text(text_buf); field_cSG__ID.decode_text(text_buf); } void CSG__Id::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 CSG__Id::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 CSG__Id::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; int value_of_length_field1 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_type__gtpc.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, CSG__Id_lengthf_descr_.raw->forceomit); decoded_field_length = field_lengthf.RAW_decode(CSG__Id_lengthf_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()); INTEGER tmp1 = field_lengthf.convert_to_Integer(CSG__Id_lengthf_descr_); field_lengthf = tmp1; value_of_length_field1 += tmp1.get_long_long_val() * 8; RAW_Force_Omit field_2_force_omit(2, force_omit, CSG__Id_spare_descr_.raw->forceomit); decoded_field_length = field_spare.RAW_decode(CSG__Id_spare_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_3_force_omit(3, force_omit, CSG__Id_cSG__ID_descr_.raw->forceomit); decoded_field_length = field_cSG__ID.RAW_decode(CSG__Id_cSG__ID_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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_field1 -= decoded_field_length; if (field_type__gtpc != os_92) return -1; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int CSG__Id::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, CSG__Id_lengthf_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, CSG__Id_spare_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, CSG__Id_cSG__ID_descr_.raw); encoded_length += field_type__gtpc.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += 16; myleaf.body.node.nodes[1]->calc = CALC_LENGTH; myleaf.body.node.nodes[1]->coding_descr = &CSG__Id_lengthf_descr_; myleaf.body.node.nodes[1]->calcof.lengthto.num_of_fields = 2; myleaf.body.node.nodes[1]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[1]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields = init_lengthto_fields_list(2); myleaf.body.node.nodes[1]->length = 16; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[2]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[2]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].level = myleaf.body.node.nodes[3]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].pos = myleaf.body.node.nodes[3]->curr_pos.pos; encoded_length += field_spare.RAW_encode(CSG__Id_spare_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_cSG__ID.RAW_encode(CSG__Id_cSG__ID_descr_, *myleaf.body.node.nodes[3]); if (field_type__gtpc != os_92) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={0}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ os_92.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 CSG__Id_template::single_value_struct { OCTETSTRING_template field_type__gtpc; INTEGER_template field_lengthf; BITSTRING_template field_spare; BITSTRING_template field_cSG__ID; }; void CSG__Id_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_type__gtpc = ANY_VALUE; single_value->field_lengthf = ANY_VALUE; single_value->field_spare = ANY_VALUE; single_value->field_cSG__ID = ANY_VALUE; } } } void CSG__Id_template::copy_value(const CSG__Id& other_value) { single_value = new single_value_struct; if (other_value.type__gtpc().is_bound()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (other_value.lengthf().is_bound()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (other_value.spare().is_bound()) { single_value->field_spare = other_value.spare(); } else { single_value->field_spare.clean_up(); } if (other_value.cSG__ID().is_bound()) { single_value->field_cSG__ID = other_value.cSG__ID(); } else { single_value->field_cSG__ID.clean_up(); } set_selection(SPECIFIC_VALUE); } void CSG__Id_template::copy_template(const CSG__Id_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.type__gtpc().get_selection()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lengthf().get_selection()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.spare().get_selection()) { single_value->field_spare = other_value.spare(); } else { single_value->field_spare.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.cSG__ID().get_selection()) { single_value->field_cSG__ID = other_value.cSG__ID(); } else { single_value->field_cSG__ID.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 CSG__Id_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 CSG__Id_template(*other_value.implication_.precondition); implication_.implied_template = new CSG__Id_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 @GTPC_Types.CSG_Id."); break; } set_selection(other_value); } CSG__Id_template::CSG__Id_template() { } CSG__Id_template::CSG__Id_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } CSG__Id_template::CSG__Id_template(const CSG__Id& other_value) { copy_value(other_value); } CSG__Id_template::CSG__Id_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const CSG__Id&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.CSG_Id from an unbound optional field."); } } CSG__Id_template::CSG__Id_template(CSG__Id_template* p_precondition, CSG__Id_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } CSG__Id_template::CSG__Id_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; } CSG__Id_template::CSG__Id_template(const CSG__Id_template& other_value) : Base_Template() { copy_template(other_value); } CSG__Id_template::~CSG__Id_template() { clean_up(); } CSG__Id_template& CSG__Id_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } CSG__Id_template& CSG__Id_template::operator=(const CSG__Id& other_value) { clean_up(); copy_value(other_value); return *this; } CSG__Id_template& CSG__Id_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const CSG__Id&)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 @GTPC_Types.CSG_Id."); } return *this; } CSG__Id_template& CSG__Id_template::operator=(const CSG__Id_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean CSG__Id_template::match(const CSG__Id& 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.type__gtpc().is_bound()) return FALSE; if(!single_value->field_type__gtpc.match(other_value.type__gtpc(), legacy))return FALSE; if(!other_value.lengthf().is_bound()) return FALSE; if(!single_value->field_lengthf.match(other_value.lengthf(), legacy))return FALSE; if(!other_value.spare().is_bound()) return FALSE; if(!single_value->field_spare.match(other_value.spare(), legacy))return FALSE; if(!other_value.cSG__ID().is_bound()) return FALSE; if(!single_value->field_cSG__ID.match(other_value.cSG__ID(), 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 @GTPC_Types.CSG_Id."); } return FALSE; } boolean CSG__Id_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_type__gtpc.is_bound() || single_value->field_lengthf.is_bound() || single_value->field_spare.is_bound() || single_value->field_cSG__ID.is_bound(); } boolean CSG__Id_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_type__gtpc.is_value() && single_value->field_lengthf.is_value() && single_value->field_spare.is_value() && single_value->field_cSG__ID.is_value(); } void CSG__Id_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; } CSG__Id CSG__Id_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 @GTPC_Types.CSG_Id."); CSG__Id ret_val; if (single_value->field_type__gtpc.is_bound()) { ret_val.type__gtpc() = single_value->field_type__gtpc.valueof(); } if (single_value->field_lengthf.is_bound()) { ret_val.lengthf() = single_value->field_lengthf.valueof(); } if (single_value->field_spare.is_bound()) { ret_val.spare() = single_value->field_spare.valueof(); } if (single_value->field_cSG__ID.is_bound()) { ret_val.cSG__ID() = single_value->field_cSG__ID.valueof(); } return ret_val; } void CSG__Id_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 @GTPC_Types.CSG_Id."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new CSG__Id_template[list_length]; } CSG__Id_template& CSG__Id_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 @GTPC_Types.CSG_Id."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.CSG_Id."); return value_list.list_value[list_index]; } OCTETSTRING_template& CSG__Id_template::type__gtpc() { set_specific(); return single_value->field_type__gtpc; } const OCTETSTRING_template& CSG__Id_template::type__gtpc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field type_gtpc of a non-specific template of type @GTPC_Types.CSG_Id."); return single_value->field_type__gtpc; } INTEGER_template& CSG__Id_template::lengthf() { set_specific(); return single_value->field_lengthf; } const INTEGER_template& CSG__Id_template::lengthf() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthf of a non-specific template of type @GTPC_Types.CSG_Id."); return single_value->field_lengthf; } BITSTRING_template& CSG__Id_template::spare() { set_specific(); return single_value->field_spare; } const BITSTRING_template& CSG__Id_template::spare() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field spare of a non-specific template of type @GTPC_Types.CSG_Id."); return single_value->field_spare; } BITSTRING_template& CSG__Id_template::cSG__ID() { set_specific(); return single_value->field_cSG__ID; } const BITSTRING_template& CSG__Id_template::cSG__ID() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field cSG_ID of a non-specific template of type @GTPC_Types.CSG_Id."); return single_value->field_cSG__ID; } int CSG__Id_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.CSG_Id 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 @GTPC_Types.CSG_Id 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 @GTPC_Types.CSG_Id containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.CSG_Id containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.CSG_Id containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.CSG_Id containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.CSG_Id containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.CSG_Id containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.CSG_Id containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.CSG_Id."); } return 0; } void CSG__Id_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ type_gtpc := "); single_value->field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log(); TTCN_Logger::log_event_str(", spare := "); single_value->field_spare.log(); TTCN_Logger::log_event_str(", cSG_ID := "); single_value->field_cSG__ID.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 CSG__Id_template::log_match(const CSG__Id& 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_type__gtpc.match(match_value.type__gtpc(), legacy)){ TTCN_Logger::log_logmatch_info(".type_gtpc"); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lengthf.match(match_value.lengthf(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthf"); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_spare.match(match_value.spare(), legacy)){ TTCN_Logger::log_logmatch_info(".spare"); single_value->field_spare.log_match(match_value.spare(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_cSG__ID.match(match_value.cSG__ID(), legacy)){ TTCN_Logger::log_logmatch_info(".cSG_ID"); single_value->field_cSG__ID.log_match(match_value.cSG__ID(), 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("{ type_gtpc := "); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::log_event_str(", spare := "); single_value->field_spare.log_match(match_value.spare(), legacy); TTCN_Logger::log_event_str(", cSG_ID := "); single_value->field_cSG__ID.log_match(match_value.cSG__ID(), 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 CSG__Id_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_type__gtpc.encode_text(text_buf); single_value->field_lengthf.encode_text(text_buf); single_value->field_spare.encode_text(text_buf); single_value->field_cSG__ID.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 @GTPC_Types.CSG_Id."); } } void CSG__Id_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_type__gtpc.decode_text(text_buf); single_value->field_lengthf.decode_text(text_buf); single_value->field_spare.decode_text(text_buf); single_value->field_cSG__ID.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 CSG__Id_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 @GTPC_Types.CSG_Id."); } } void CSG__Id_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: { CSG__Id_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) cSG__ID().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "spare")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "cSG_ID")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cSG__ID().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.CSG_Id: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { CSG__Id_template* precondition = new CSG__Id_template; precondition->set_param(*param.get_elem(0)); CSG__Id_template* implied_template = new CSG__Id_template; implied_template->set_param(*param.get_elem(1)); *this = CSG__Id_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.CSG_Id"); } is_ifpresent = param.get_ifpresent(); } void CSG__Id_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_type__gtpc.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.CSG_Id"); single_value->field_lengthf.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.CSG_Id"); single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.CSG_Id"); single_value->field_cSG__ID.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.CSG_Id"); 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 : "@GTPC_Types.CSG_Id"); } boolean CSG__Id_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean CSG__Id_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) cMI__Value().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) spare().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "cMI_Value")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cMI__Value().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 @GTPC_Types.CSG_MembershipIndication: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.CSG_MembershipIndication"); } } void CSG__MembershipIndication::encode_text(Text_Buf& text_buf) const { field_type__gtpc.encode_text(text_buf); field_lengthf.encode_text(text_buf); field_cMI__Value.encode_text(text_buf); field_spare.encode_text(text_buf); } void CSG__MembershipIndication::decode_text(Text_Buf& text_buf) { field_type__gtpc.decode_text(text_buf); field_lengthf.decode_text(text_buf); field_cMI__Value.decode_text(text_buf); field_spare.decode_text(text_buf); } void CSG__MembershipIndication::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 CSG__MembershipIndication::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 CSG__MembershipIndication::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; int value_of_length_field1 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_type__gtpc.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, CSG__MembershipIndication_lengthf_descr_.raw->forceomit); decoded_field_length = field_lengthf.RAW_decode(CSG__MembershipIndication_lengthf_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()); INTEGER tmp1 = field_lengthf.convert_to_Integer(CSG__MembershipIndication_lengthf_descr_); field_lengthf = tmp1; value_of_length_field1 += tmp1.get_long_long_val() * 8; RAW_Force_Omit field_2_force_omit(2, force_omit, General__Types::BIT1_descr_.raw->forceomit); decoded_field_length = field_cMI__Value.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::BIT7_descr_.raw->forceomit); decoded_field_length = field_spare.RAW_decode(General__Types::BIT7_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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_field1 -= decoded_field_length; if (field_type__gtpc != os_93) return -1; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int CSG__MembershipIndication::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, CSG__MembershipIndication_lengthf_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, General__Types::BIT1_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::BIT7_descr_.raw); encoded_length += field_type__gtpc.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += 16; myleaf.body.node.nodes[1]->calc = CALC_LENGTH; myleaf.body.node.nodes[1]->coding_descr = &CSG__MembershipIndication_lengthf_descr_; myleaf.body.node.nodes[1]->calcof.lengthto.num_of_fields = 2; myleaf.body.node.nodes[1]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[1]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields = init_lengthto_fields_list(2); myleaf.body.node.nodes[1]->length = 16; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[2]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[2]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].level = myleaf.body.node.nodes[3]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].pos = myleaf.body.node.nodes[3]->curr_pos.pos; encoded_length += field_cMI__Value.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_spare.RAW_encode(General__Types::BIT7_descr_, *myleaf.body.node.nodes[3]); if (field_type__gtpc != os_93) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={0}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ os_93.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 CSG__MembershipIndication_template::single_value_struct { OCTETSTRING_template field_type__gtpc; INTEGER_template field_lengthf; BITSTRING_template field_cMI__Value; BITSTRING_template field_spare; }; void CSG__MembershipIndication_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_type__gtpc = ANY_VALUE; single_value->field_lengthf = ANY_VALUE; single_value->field_cMI__Value = ANY_VALUE; single_value->field_spare = ANY_VALUE; } } } void CSG__MembershipIndication_template::copy_value(const CSG__MembershipIndication& other_value) { single_value = new single_value_struct; if (other_value.type__gtpc().is_bound()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (other_value.lengthf().is_bound()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (other_value.cMI__Value().is_bound()) { single_value->field_cMI__Value = other_value.cMI__Value(); } else { single_value->field_cMI__Value.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 CSG__MembershipIndication_template::copy_template(const CSG__MembershipIndication_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.type__gtpc().get_selection()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lengthf().get_selection()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.cMI__Value().get_selection()) { single_value->field_cMI__Value = other_value.cMI__Value(); } else { single_value->field_cMI__Value.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 CSG__MembershipIndication_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 CSG__MembershipIndication_template(*other_value.implication_.precondition); implication_.implied_template = new CSG__MembershipIndication_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 @GTPC_Types.CSG_MembershipIndication."); break; } set_selection(other_value); } CSG__MembershipIndication_template::CSG__MembershipIndication_template() { } CSG__MembershipIndication_template::CSG__MembershipIndication_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } CSG__MembershipIndication_template::CSG__MembershipIndication_template(const CSG__MembershipIndication& other_value) { copy_value(other_value); } CSG__MembershipIndication_template::CSG__MembershipIndication_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const CSG__MembershipIndication&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.CSG_MembershipIndication from an unbound optional field."); } } CSG__MembershipIndication_template::CSG__MembershipIndication_template(CSG__MembershipIndication_template* p_precondition, CSG__MembershipIndication_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } CSG__MembershipIndication_template::CSG__MembershipIndication_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; } CSG__MembershipIndication_template::CSG__MembershipIndication_template(const CSG__MembershipIndication_template& other_value) : Base_Template() { copy_template(other_value); } CSG__MembershipIndication_template::~CSG__MembershipIndication_template() { clean_up(); } CSG__MembershipIndication_template& CSG__MembershipIndication_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } CSG__MembershipIndication_template& CSG__MembershipIndication_template::operator=(const CSG__MembershipIndication& other_value) { clean_up(); copy_value(other_value); return *this; } CSG__MembershipIndication_template& CSG__MembershipIndication_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const CSG__MembershipIndication&)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 @GTPC_Types.CSG_MembershipIndication."); } return *this; } CSG__MembershipIndication_template& CSG__MembershipIndication_template::operator=(const CSG__MembershipIndication_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean CSG__MembershipIndication_template::match(const CSG__MembershipIndication& 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.type__gtpc().is_bound()) return FALSE; if(!single_value->field_type__gtpc.match(other_value.type__gtpc(), legacy))return FALSE; if(!other_value.lengthf().is_bound()) return FALSE; if(!single_value->field_lengthf.match(other_value.lengthf(), legacy))return FALSE; if(!other_value.cMI__Value().is_bound()) return FALSE; if(!single_value->field_cMI__Value.match(other_value.cMI__Value(), 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 @GTPC_Types.CSG_MembershipIndication."); } return FALSE; } boolean CSG__MembershipIndication_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_type__gtpc.is_bound() || single_value->field_lengthf.is_bound() || single_value->field_cMI__Value.is_bound() || single_value->field_spare.is_bound(); } boolean CSG__MembershipIndication_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_type__gtpc.is_value() && single_value->field_lengthf.is_value() && single_value->field_cMI__Value.is_value() && single_value->field_spare.is_value(); } void CSG__MembershipIndication_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; } CSG__MembershipIndication CSG__MembershipIndication_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 @GTPC_Types.CSG_MembershipIndication."); CSG__MembershipIndication ret_val; if (single_value->field_type__gtpc.is_bound()) { ret_val.type__gtpc() = single_value->field_type__gtpc.valueof(); } if (single_value->field_lengthf.is_bound()) { ret_val.lengthf() = single_value->field_lengthf.valueof(); } if (single_value->field_cMI__Value.is_bound()) { ret_val.cMI__Value() = single_value->field_cMI__Value.valueof(); } if (single_value->field_spare.is_bound()) { ret_val.spare() = single_value->field_spare.valueof(); } return ret_val; } void CSG__MembershipIndication_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 @GTPC_Types.CSG_MembershipIndication."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new CSG__MembershipIndication_template[list_length]; } CSG__MembershipIndication_template& CSG__MembershipIndication_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 @GTPC_Types.CSG_MembershipIndication."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.CSG_MembershipIndication."); return value_list.list_value[list_index]; } OCTETSTRING_template& CSG__MembershipIndication_template::type__gtpc() { set_specific(); return single_value->field_type__gtpc; } const OCTETSTRING_template& CSG__MembershipIndication_template::type__gtpc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field type_gtpc of a non-specific template of type @GTPC_Types.CSG_MembershipIndication."); return single_value->field_type__gtpc; } INTEGER_template& CSG__MembershipIndication_template::lengthf() { set_specific(); return single_value->field_lengthf; } const INTEGER_template& CSG__MembershipIndication_template::lengthf() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthf of a non-specific template of type @GTPC_Types.CSG_MembershipIndication."); return single_value->field_lengthf; } BITSTRING_template& CSG__MembershipIndication_template::cMI__Value() { set_specific(); return single_value->field_cMI__Value; } const BITSTRING_template& CSG__MembershipIndication_template::cMI__Value() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field cMI_Value of a non-specific template of type @GTPC_Types.CSG_MembershipIndication."); return single_value->field_cMI__Value; } BITSTRING_template& CSG__MembershipIndication_template::spare() { set_specific(); return single_value->field_spare; } const BITSTRING_template& CSG__MembershipIndication_template::spare() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field spare of a non-specific template of type @GTPC_Types.CSG_MembershipIndication."); return single_value->field_spare; } int CSG__MembershipIndication_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.CSG_MembershipIndication 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 @GTPC_Types.CSG_MembershipIndication 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 @GTPC_Types.CSG_MembershipIndication containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.CSG_MembershipIndication containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.CSG_MembershipIndication containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.CSG_MembershipIndication containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.CSG_MembershipIndication containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.CSG_MembershipIndication containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.CSG_MembershipIndication containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.CSG_MembershipIndication."); } return 0; } void CSG__MembershipIndication_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ type_gtpc := "); single_value->field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log(); TTCN_Logger::log_event_str(", cMI_Value := "); single_value->field_cMI__Value.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 CSG__MembershipIndication_template::log_match(const CSG__MembershipIndication& 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_type__gtpc.match(match_value.type__gtpc(), legacy)){ TTCN_Logger::log_logmatch_info(".type_gtpc"); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lengthf.match(match_value.lengthf(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthf"); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_cMI__Value.match(match_value.cMI__Value(), legacy)){ TTCN_Logger::log_logmatch_info(".cMI_Value"); single_value->field_cMI__Value.log_match(match_value.cMI__Value(), 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("{ type_gtpc := "); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::log_event_str(", cMI_Value := "); single_value->field_cMI__Value.log_match(match_value.cMI__Value(), 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 CSG__MembershipIndication_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_type__gtpc.encode_text(text_buf); single_value->field_lengthf.encode_text(text_buf); single_value->field_cMI__Value.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 @GTPC_Types.CSG_MembershipIndication."); } } void CSG__MembershipIndication_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_type__gtpc.decode_text(text_buf); single_value->field_lengthf.decode_text(text_buf); single_value->field_cMI__Value.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 CSG__MembershipIndication_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 @GTPC_Types.CSG_MembershipIndication."); } } void CSG__MembershipIndication_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: { CSG__MembershipIndication_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) cMI__Value().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) spare().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "cMI_Value")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cMI__Value().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 @GTPC_Types.CSG_MembershipIndication: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { CSG__MembershipIndication_template* precondition = new CSG__MembershipIndication_template; precondition->set_param(*param.get_elem(0)); CSG__MembershipIndication_template* implied_template = new CSG__MembershipIndication_template; implied_template->set_param(*param.get_elem(1)); *this = CSG__MembershipIndication_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.CSG_MembershipIndication"); } is_ifpresent = param.get_ifpresent(); } void CSG__MembershipIndication_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_type__gtpc.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.CSG_MembershipIndication"); single_value->field_lengthf.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.CSG_MembershipIndication"); single_value->field_cMI__Value.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.CSG_MembershipIndication"); single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.CSG_MembershipIndication"); 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 : "@GTPC_Types.CSG_MembershipIndication"); } boolean CSG__MembershipIndication_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean CSG__MembershipIndication_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) aPN__AMBR__Uplink().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) aPN__AMBR__Downlink().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "aPN_AMBR_Uplink")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { aPN__AMBR__Uplink().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "aPN_AMBR_Downlink")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { aPN__AMBR__Downlink().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.APN_AMBR: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.APN_AMBR"); } } void APN__AMBR::encode_text(Text_Buf& text_buf) const { field_type__gtpc.encode_text(text_buf); field_lengthf.encode_text(text_buf); field_aPN__AMBR__Uplink.encode_text(text_buf); field_aPN__AMBR__Downlink.encode_text(text_buf); } void APN__AMBR::decode_text(Text_Buf& text_buf) { field_type__gtpc.decode_text(text_buf); field_lengthf.decode_text(text_buf); field_aPN__AMBR__Uplink.decode_text(text_buf); field_aPN__AMBR__Downlink.decode_text(text_buf); } void APN__AMBR::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 APN__AMBR::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 APN__AMBR::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; int value_of_length_field1 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_type__gtpc.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, APN__AMBR_lengthf_descr_.raw->forceomit); decoded_field_length = field_lengthf.RAW_decode(APN__AMBR_lengthf_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()); INTEGER tmp1 = field_lengthf.convert_to_Integer(APN__AMBR_lengthf_descr_); field_lengthf = tmp1; value_of_length_field1 += tmp1.get_long_long_val() * 8; RAW_Force_Omit field_2_force_omit(2, force_omit, General__Types::LIN4__BO__LAST_descr_.raw->forceomit); decoded_field_length = field_aPN__AMBR__Uplink.RAW_decode(General__Types::LIN4__BO__LAST_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::LIN4__BO__LAST_descr_.raw->forceomit); decoded_field_length = field_aPN__AMBR__Downlink.RAW_decode(General__Types::LIN4__BO__LAST_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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_field1 -= decoded_field_length; if (field_type__gtpc != os_37) return -1; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int APN__AMBR::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, APN__AMBR_lengthf_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, General__Types::LIN4__BO__LAST_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::LIN4__BO__LAST_descr_.raw); encoded_length += field_type__gtpc.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += 16; myleaf.body.node.nodes[1]->calc = CALC_LENGTH; myleaf.body.node.nodes[1]->coding_descr = &APN__AMBR_lengthf_descr_; myleaf.body.node.nodes[1]->calcof.lengthto.num_of_fields = 2; myleaf.body.node.nodes[1]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[1]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields = init_lengthto_fields_list(2); myleaf.body.node.nodes[1]->length = 16; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[2]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[2]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].level = myleaf.body.node.nodes[3]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].pos = myleaf.body.node.nodes[3]->curr_pos.pos; encoded_length += field_aPN__AMBR__Uplink.RAW_encode(General__Types::LIN4__BO__LAST_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_aPN__AMBR__Downlink.RAW_encode(General__Types::LIN4__BO__LAST_descr_, *myleaf.body.node.nodes[3]); if (field_type__gtpc != os_37) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={0}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ os_37.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 APN__AMBR_template::single_value_struct { OCTETSTRING_template field_type__gtpc; INTEGER_template field_lengthf; INTEGER_template field_aPN__AMBR__Uplink; INTEGER_template field_aPN__AMBR__Downlink; }; void APN__AMBR_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_type__gtpc = ANY_VALUE; single_value->field_lengthf = ANY_VALUE; single_value->field_aPN__AMBR__Uplink = ANY_VALUE; single_value->field_aPN__AMBR__Downlink = ANY_VALUE; } } } void APN__AMBR_template::copy_value(const APN__AMBR& other_value) { single_value = new single_value_struct; if (other_value.type__gtpc().is_bound()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (other_value.lengthf().is_bound()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (other_value.aPN__AMBR__Uplink().is_bound()) { single_value->field_aPN__AMBR__Uplink = other_value.aPN__AMBR__Uplink(); } else { single_value->field_aPN__AMBR__Uplink.clean_up(); } if (other_value.aPN__AMBR__Downlink().is_bound()) { single_value->field_aPN__AMBR__Downlink = other_value.aPN__AMBR__Downlink(); } else { single_value->field_aPN__AMBR__Downlink.clean_up(); } set_selection(SPECIFIC_VALUE); } void APN__AMBR_template::copy_template(const APN__AMBR_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.type__gtpc().get_selection()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lengthf().get_selection()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.aPN__AMBR__Uplink().get_selection()) { single_value->field_aPN__AMBR__Uplink = other_value.aPN__AMBR__Uplink(); } else { single_value->field_aPN__AMBR__Uplink.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.aPN__AMBR__Downlink().get_selection()) { single_value->field_aPN__AMBR__Downlink = other_value.aPN__AMBR__Downlink(); } else { single_value->field_aPN__AMBR__Downlink.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 APN__AMBR_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 APN__AMBR_template(*other_value.implication_.precondition); implication_.implied_template = new APN__AMBR_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 @GTPC_Types.APN_AMBR."); break; } set_selection(other_value); } APN__AMBR_template::APN__AMBR_template() { } APN__AMBR_template::APN__AMBR_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } APN__AMBR_template::APN__AMBR_template(const APN__AMBR& other_value) { copy_value(other_value); } APN__AMBR_template::APN__AMBR_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const APN__AMBR&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.APN_AMBR from an unbound optional field."); } } APN__AMBR_template::APN__AMBR_template(APN__AMBR_template* p_precondition, APN__AMBR_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } APN__AMBR_template::APN__AMBR_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; } APN__AMBR_template::APN__AMBR_template(const APN__AMBR_template& other_value) : Base_Template() { copy_template(other_value); } APN__AMBR_template::~APN__AMBR_template() { clean_up(); } APN__AMBR_template& APN__AMBR_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } APN__AMBR_template& APN__AMBR_template::operator=(const APN__AMBR& other_value) { clean_up(); copy_value(other_value); return *this; } APN__AMBR_template& APN__AMBR_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const APN__AMBR&)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 @GTPC_Types.APN_AMBR."); } return *this; } APN__AMBR_template& APN__AMBR_template::operator=(const APN__AMBR_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean APN__AMBR_template::match(const APN__AMBR& 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.type__gtpc().is_bound()) return FALSE; if(!single_value->field_type__gtpc.match(other_value.type__gtpc(), legacy))return FALSE; if(!other_value.lengthf().is_bound()) return FALSE; if(!single_value->field_lengthf.match(other_value.lengthf(), legacy))return FALSE; if(!other_value.aPN__AMBR__Uplink().is_bound()) return FALSE; if(!single_value->field_aPN__AMBR__Uplink.match(other_value.aPN__AMBR__Uplink(), legacy))return FALSE; if(!other_value.aPN__AMBR__Downlink().is_bound()) return FALSE; if(!single_value->field_aPN__AMBR__Downlink.match(other_value.aPN__AMBR__Downlink(), 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 @GTPC_Types.APN_AMBR."); } return FALSE; } boolean APN__AMBR_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_type__gtpc.is_bound() || single_value->field_lengthf.is_bound() || single_value->field_aPN__AMBR__Uplink.is_bound() || single_value->field_aPN__AMBR__Downlink.is_bound(); } boolean APN__AMBR_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_type__gtpc.is_value() && single_value->field_lengthf.is_value() && single_value->field_aPN__AMBR__Uplink.is_value() && single_value->field_aPN__AMBR__Downlink.is_value(); } void APN__AMBR_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; } APN__AMBR APN__AMBR_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 @GTPC_Types.APN_AMBR."); APN__AMBR ret_val; if (single_value->field_type__gtpc.is_bound()) { ret_val.type__gtpc() = single_value->field_type__gtpc.valueof(); } if (single_value->field_lengthf.is_bound()) { ret_val.lengthf() = single_value->field_lengthf.valueof(); } if (single_value->field_aPN__AMBR__Uplink.is_bound()) { ret_val.aPN__AMBR__Uplink() = single_value->field_aPN__AMBR__Uplink.valueof(); } if (single_value->field_aPN__AMBR__Downlink.is_bound()) { ret_val.aPN__AMBR__Downlink() = single_value->field_aPN__AMBR__Downlink.valueof(); } return ret_val; } void APN__AMBR_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 @GTPC_Types.APN_AMBR."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new APN__AMBR_template[list_length]; } APN__AMBR_template& APN__AMBR_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 @GTPC_Types.APN_AMBR."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.APN_AMBR."); return value_list.list_value[list_index]; } OCTETSTRING_template& APN__AMBR_template::type__gtpc() { set_specific(); return single_value->field_type__gtpc; } const OCTETSTRING_template& APN__AMBR_template::type__gtpc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field type_gtpc of a non-specific template of type @GTPC_Types.APN_AMBR."); return single_value->field_type__gtpc; } INTEGER_template& APN__AMBR_template::lengthf() { set_specific(); return single_value->field_lengthf; } const INTEGER_template& APN__AMBR_template::lengthf() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthf of a non-specific template of type @GTPC_Types.APN_AMBR."); return single_value->field_lengthf; } INTEGER_template& APN__AMBR_template::aPN__AMBR__Uplink() { set_specific(); return single_value->field_aPN__AMBR__Uplink; } const INTEGER_template& APN__AMBR_template::aPN__AMBR__Uplink() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field aPN_AMBR_Uplink of a non-specific template of type @GTPC_Types.APN_AMBR."); return single_value->field_aPN__AMBR__Uplink; } INTEGER_template& APN__AMBR_template::aPN__AMBR__Downlink() { set_specific(); return single_value->field_aPN__AMBR__Downlink; } const INTEGER_template& APN__AMBR_template::aPN__AMBR__Downlink() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field aPN_AMBR_Downlink of a non-specific template of type @GTPC_Types.APN_AMBR."); return single_value->field_aPN__AMBR__Downlink; } int APN__AMBR_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.APN_AMBR 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 @GTPC_Types.APN_AMBR 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 @GTPC_Types.APN_AMBR containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.APN_AMBR containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.APN_AMBR containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.APN_AMBR containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.APN_AMBR containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.APN_AMBR containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.APN_AMBR containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.APN_AMBR."); } return 0; } void APN__AMBR_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ type_gtpc := "); single_value->field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log(); TTCN_Logger::log_event_str(", aPN_AMBR_Uplink := "); single_value->field_aPN__AMBR__Uplink.log(); TTCN_Logger::log_event_str(", aPN_AMBR_Downlink := "); single_value->field_aPN__AMBR__Downlink.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 APN__AMBR_template::log_match(const APN__AMBR& 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_type__gtpc.match(match_value.type__gtpc(), legacy)){ TTCN_Logger::log_logmatch_info(".type_gtpc"); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lengthf.match(match_value.lengthf(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthf"); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_aPN__AMBR__Uplink.match(match_value.aPN__AMBR__Uplink(), legacy)){ TTCN_Logger::log_logmatch_info(".aPN_AMBR_Uplink"); single_value->field_aPN__AMBR__Uplink.log_match(match_value.aPN__AMBR__Uplink(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_aPN__AMBR__Downlink.match(match_value.aPN__AMBR__Downlink(), legacy)){ TTCN_Logger::log_logmatch_info(".aPN_AMBR_Downlink"); single_value->field_aPN__AMBR__Downlink.log_match(match_value.aPN__AMBR__Downlink(), 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("{ type_gtpc := "); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::log_event_str(", aPN_AMBR_Uplink := "); single_value->field_aPN__AMBR__Uplink.log_match(match_value.aPN__AMBR__Uplink(), legacy); TTCN_Logger::log_event_str(", aPN_AMBR_Downlink := "); single_value->field_aPN__AMBR__Downlink.log_match(match_value.aPN__AMBR__Downlink(), 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 APN__AMBR_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_type__gtpc.encode_text(text_buf); single_value->field_lengthf.encode_text(text_buf); single_value->field_aPN__AMBR__Uplink.encode_text(text_buf); single_value->field_aPN__AMBR__Downlink.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 @GTPC_Types.APN_AMBR."); } } void APN__AMBR_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_type__gtpc.decode_text(text_buf); single_value->field_lengthf.decode_text(text_buf); single_value->field_aPN__AMBR__Uplink.decode_text(text_buf); single_value->field_aPN__AMBR__Downlink.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 APN__AMBR_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 @GTPC_Types.APN_AMBR."); } } void APN__AMBR_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: { APN__AMBR_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) aPN__AMBR__Uplink().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) aPN__AMBR__Downlink().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "aPN_AMBR_Uplink")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { aPN__AMBR__Uplink().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "aPN_AMBR_Downlink")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { aPN__AMBR__Downlink().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.APN_AMBR: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { APN__AMBR_template* precondition = new APN__AMBR_template; precondition->set_param(*param.get_elem(0)); APN__AMBR_template* implied_template = new APN__AMBR_template; implied_template->set_param(*param.get_elem(1)); *this = APN__AMBR_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.APN_AMBR"); } is_ifpresent = param.get_ifpresent(); } void APN__AMBR_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_type__gtpc.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.APN_AMBR"); single_value->field_lengthf.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.APN_AMBR"); single_value->field_aPN__AMBR__Uplink.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.APN_AMBR"); single_value->field_aPN__AMBR__Downlink.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.APN_AMBR"); 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 : "@GTPC_Types.APN_AMBR"); } boolean APN__AMBR_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean APN__AMBR_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) ue__network__capability().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ue_network_capability")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ue__network__capability().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.UE_Network_Capability: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.UE_Network_Capability"); } } void UE__Network__Capability::encode_text(Text_Buf& text_buf) const { field_type__gtpc.encode_text(text_buf); field_lengthf.encode_text(text_buf); field_ue__network__capability.encode_text(text_buf); } void UE__Network__Capability::decode_text(Text_Buf& text_buf) { field_type__gtpc.decode_text(text_buf); field_lengthf.decode_text(text_buf); field_ue__network__capability.decode_text(text_buf); } void UE__Network__Capability::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 UE__Network__Capability::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 UE__Network__Capability::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; int value_of_length_field1 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_type__gtpc.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, UE__Network__Capability_lengthf_descr_.raw->forceomit); decoded_field_length = field_lengthf.RAW_decode(UE__Network__Capability_lengthf_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()); INTEGER tmp1 = field_lengthf.convert_to_Integer(UE__Network__Capability_lengthf_descr_); field_lengthf = tmp1; value_of_length_field1 += tmp1.get_long_long_val() * 8; RAW_Force_Omit field_2_force_omit(2, force_omit, OCTETSTRING_descr_.raw->forceomit); decoded_field_length = field_ue__network__capability.RAW_decode(OCTETSTRING_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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()); value_of_length_field1 -= decoded_field_length; if (field_type__gtpc != os_73) return -1; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int UE__Network__Capability::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, UE__Network__Capability_lengthf_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, OCTETSTRING_descr_.raw); encoded_length += field_type__gtpc.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += 16; myleaf.body.node.nodes[1]->calc = CALC_LENGTH; myleaf.body.node.nodes[1]->coding_descr = &UE__Network__Capability_lengthf_descr_; myleaf.body.node.nodes[1]->calcof.lengthto.num_of_fields = 1; myleaf.body.node.nodes[1]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[1]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields = init_lengthto_fields_list(1); myleaf.body.node.nodes[1]->length = 16; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[2]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[2]->curr_pos.pos; encoded_length += field_ue__network__capability.RAW_encode(OCTETSTRING_descr_, *myleaf.body.node.nodes[2]); if (field_type__gtpc != os_73) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={0}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ os_73.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 UE__Network__Capability_template::single_value_struct { OCTETSTRING_template field_type__gtpc; INTEGER_template field_lengthf; OCTETSTRING_template field_ue__network__capability; }; void UE__Network__Capability_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_type__gtpc = ANY_VALUE; single_value->field_lengthf = ANY_VALUE; single_value->field_ue__network__capability = ANY_VALUE; } } } void UE__Network__Capability_template::copy_value(const UE__Network__Capability& other_value) { single_value = new single_value_struct; if (other_value.type__gtpc().is_bound()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (other_value.lengthf().is_bound()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (other_value.ue__network__capability().is_bound()) { single_value->field_ue__network__capability = other_value.ue__network__capability(); } else { single_value->field_ue__network__capability.clean_up(); } set_selection(SPECIFIC_VALUE); } void UE__Network__Capability_template::copy_template(const UE__Network__Capability_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.type__gtpc().get_selection()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lengthf().get_selection()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.ue__network__capability().get_selection()) { single_value->field_ue__network__capability = other_value.ue__network__capability(); } else { single_value->field_ue__network__capability.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 UE__Network__Capability_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 UE__Network__Capability_template(*other_value.implication_.precondition); implication_.implied_template = new UE__Network__Capability_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 @GTPC_Types.UE_Network_Capability."); break; } set_selection(other_value); } UE__Network__Capability_template::UE__Network__Capability_template() { } UE__Network__Capability_template::UE__Network__Capability_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } UE__Network__Capability_template::UE__Network__Capability_template(const UE__Network__Capability& other_value) { copy_value(other_value); } UE__Network__Capability_template::UE__Network__Capability_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const UE__Network__Capability&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.UE_Network_Capability from an unbound optional field."); } } UE__Network__Capability_template::UE__Network__Capability_template(UE__Network__Capability_template* p_precondition, UE__Network__Capability_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } UE__Network__Capability_template::UE__Network__Capability_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; } UE__Network__Capability_template::UE__Network__Capability_template(const UE__Network__Capability_template& other_value) : Base_Template() { copy_template(other_value); } UE__Network__Capability_template::~UE__Network__Capability_template() { clean_up(); } UE__Network__Capability_template& UE__Network__Capability_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } UE__Network__Capability_template& UE__Network__Capability_template::operator=(const UE__Network__Capability& other_value) { clean_up(); copy_value(other_value); return *this; } UE__Network__Capability_template& UE__Network__Capability_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const UE__Network__Capability&)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 @GTPC_Types.UE_Network_Capability."); } return *this; } UE__Network__Capability_template& UE__Network__Capability_template::operator=(const UE__Network__Capability_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean UE__Network__Capability_template::match(const UE__Network__Capability& 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.type__gtpc().is_bound()) return FALSE; if(!single_value->field_type__gtpc.match(other_value.type__gtpc(), legacy))return FALSE; if(!other_value.lengthf().is_bound()) return FALSE; if(!single_value->field_lengthf.match(other_value.lengthf(), legacy))return FALSE; if(!other_value.ue__network__capability().is_bound()) return FALSE; if(!single_value->field_ue__network__capability.match(other_value.ue__network__capability(), 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 @GTPC_Types.UE_Network_Capability."); } return FALSE; } boolean UE__Network__Capability_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_type__gtpc.is_bound() || single_value->field_lengthf.is_bound() || single_value->field_ue__network__capability.is_bound(); } boolean UE__Network__Capability_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_type__gtpc.is_value() && single_value->field_lengthf.is_value() && single_value->field_ue__network__capability.is_value(); } void UE__Network__Capability_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; } UE__Network__Capability UE__Network__Capability_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 @GTPC_Types.UE_Network_Capability."); UE__Network__Capability ret_val; if (single_value->field_type__gtpc.is_bound()) { ret_val.type__gtpc() = single_value->field_type__gtpc.valueof(); } if (single_value->field_lengthf.is_bound()) { ret_val.lengthf() = single_value->field_lengthf.valueof(); } if (single_value->field_ue__network__capability.is_bound()) { ret_val.ue__network__capability() = single_value->field_ue__network__capability.valueof(); } return ret_val; } void UE__Network__Capability_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 @GTPC_Types.UE_Network_Capability."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new UE__Network__Capability_template[list_length]; } UE__Network__Capability_template& UE__Network__Capability_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 @GTPC_Types.UE_Network_Capability."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.UE_Network_Capability."); return value_list.list_value[list_index]; } OCTETSTRING_template& UE__Network__Capability_template::type__gtpc() { set_specific(); return single_value->field_type__gtpc; } const OCTETSTRING_template& UE__Network__Capability_template::type__gtpc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field type_gtpc of a non-specific template of type @GTPC_Types.UE_Network_Capability."); return single_value->field_type__gtpc; } INTEGER_template& UE__Network__Capability_template::lengthf() { set_specific(); return single_value->field_lengthf; } const INTEGER_template& UE__Network__Capability_template::lengthf() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthf of a non-specific template of type @GTPC_Types.UE_Network_Capability."); return single_value->field_lengthf; } OCTETSTRING_template& UE__Network__Capability_template::ue__network__capability() { set_specific(); return single_value->field_ue__network__capability; } const OCTETSTRING_template& UE__Network__Capability_template::ue__network__capability() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ue_network_capability of a non-specific template of type @GTPC_Types.UE_Network_Capability."); return single_value->field_ue__network__capability; } int UE__Network__Capability_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.UE_Network_Capability 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 @GTPC_Types.UE_Network_Capability 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 @GTPC_Types.UE_Network_Capability containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.UE_Network_Capability containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.UE_Network_Capability containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.UE_Network_Capability containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.UE_Network_Capability containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.UE_Network_Capability containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.UE_Network_Capability containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.UE_Network_Capability."); } return 0; } void UE__Network__Capability_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ type_gtpc := "); single_value->field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log(); TTCN_Logger::log_event_str(", ue_network_capability := "); single_value->field_ue__network__capability.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 UE__Network__Capability_template::log_match(const UE__Network__Capability& 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_type__gtpc.match(match_value.type__gtpc(), legacy)){ TTCN_Logger::log_logmatch_info(".type_gtpc"); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lengthf.match(match_value.lengthf(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthf"); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_ue__network__capability.match(match_value.ue__network__capability(), legacy)){ TTCN_Logger::log_logmatch_info(".ue_network_capability"); single_value->field_ue__network__capability.log_match(match_value.ue__network__capability(), 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("{ type_gtpc := "); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::log_event_str(", ue_network_capability := "); single_value->field_ue__network__capability.log_match(match_value.ue__network__capability(), 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 UE__Network__Capability_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_type__gtpc.encode_text(text_buf); single_value->field_lengthf.encode_text(text_buf); single_value->field_ue__network__capability.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 @GTPC_Types.UE_Network_Capability."); } } void UE__Network__Capability_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_type__gtpc.decode_text(text_buf); single_value->field_lengthf.decode_text(text_buf); single_value->field_ue__network__capability.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 UE__Network__Capability_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 @GTPC_Types.UE_Network_Capability."); } } void UE__Network__Capability_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: { UE__Network__Capability_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) ue__network__capability().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ue_network_capability")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ue__network__capability().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.UE_Network_Capability: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { UE__Network__Capability_template* precondition = new UE__Network__Capability_template; precondition->set_param(*param.get_elem(0)); UE__Network__Capability_template* implied_template = new UE__Network__Capability_template; implied_template->set_param(*param.get_elem(1)); *this = UE__Network__Capability_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.UE_Network_Capability"); } is_ifpresent = param.get_ifpresent(); } void UE__Network__Capability_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_type__gtpc.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.UE_Network_Capability"); single_value->field_lengthf.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.UE_Network_Capability"); single_value->field_ue__network__capability.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.UE_Network_Capability"); 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 : "@GTPC_Types.UE_Network_Capability"); } boolean UE__Network__Capability_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean UE__Network__Capability_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_authorized__ue__ambr__uplink, const OPTIONAL< INTEGER >& par_authorized__ue__ambr__downlink) : field_type__gtpc(par_type__gtpc), field_lengthf(par_lengthf), field_subscribed__ue__ambr__uplink(par_subscribed__ue__ambr__uplink), field_subscribed__ue__ambr__downlink(par_subscribed__ue__ambr__downlink), field_authorized__ue__ambr__uplink(par_authorized__ue__ambr__uplink), field_authorized__ue__ambr__downlink(par_authorized__ue__ambr__downlink) { } UE__AMBR::UE__AMBR(const UE__AMBR& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GTPC_Types.UE_AMBR."); if (other_value.type__gtpc().is_bound()) field_type__gtpc = other_value.type__gtpc(); else field_type__gtpc.clean_up(); if (other_value.lengthf().is_bound()) field_lengthf = other_value.lengthf(); else field_lengthf.clean_up(); if (other_value.subscribed__ue__ambr__uplink().is_bound()) field_subscribed__ue__ambr__uplink = other_value.subscribed__ue__ambr__uplink(); else field_subscribed__ue__ambr__uplink.clean_up(); if (other_value.subscribed__ue__ambr__downlink().is_bound()) field_subscribed__ue__ambr__downlink = other_value.subscribed__ue__ambr__downlink(); else field_subscribed__ue__ambr__downlink.clean_up(); if (other_value.authorized__ue__ambr__uplink().is_bound()) field_authorized__ue__ambr__uplink = other_value.authorized__ue__ambr__uplink(); else field_authorized__ue__ambr__uplink.clean_up(); if (other_value.authorized__ue__ambr__downlink().is_bound()) field_authorized__ue__ambr__downlink = other_value.authorized__ue__ambr__downlink(); else field_authorized__ue__ambr__downlink.clean_up(); } void UE__AMBR::clean_up() { field_type__gtpc.clean_up(); field_lengthf.clean_up(); field_subscribed__ue__ambr__uplink.clean_up(); field_subscribed__ue__ambr__downlink.clean_up(); field_authorized__ue__ambr__uplink.clean_up(); field_authorized__ue__ambr__downlink.clean_up(); } const TTCN_Typedescriptor_t* UE__AMBR::get_descriptor() const { return &UE__AMBR_descr_; } UE__AMBR& UE__AMBR::operator=(const UE__AMBR& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GTPC_Types.UE_AMBR."); if (other_value.type__gtpc().is_bound()) field_type__gtpc = other_value.type__gtpc(); else field_type__gtpc.clean_up(); if (other_value.lengthf().is_bound()) field_lengthf = other_value.lengthf(); else field_lengthf.clean_up(); if (other_value.subscribed__ue__ambr__uplink().is_bound()) field_subscribed__ue__ambr__uplink = other_value.subscribed__ue__ambr__uplink(); else field_subscribed__ue__ambr__uplink.clean_up(); if (other_value.subscribed__ue__ambr__downlink().is_bound()) field_subscribed__ue__ambr__downlink = other_value.subscribed__ue__ambr__downlink(); else field_subscribed__ue__ambr__downlink.clean_up(); if (other_value.authorized__ue__ambr__uplink().is_bound()) field_authorized__ue__ambr__uplink = other_value.authorized__ue__ambr__uplink(); else field_authorized__ue__ambr__uplink.clean_up(); if (other_value.authorized__ue__ambr__downlink().is_bound()) field_authorized__ue__ambr__downlink = other_value.authorized__ue__ambr__downlink(); else field_authorized__ue__ambr__downlink.clean_up(); } return *this; } boolean UE__AMBR::operator==(const UE__AMBR& other_value) const { return field_type__gtpc==other_value.field_type__gtpc && field_lengthf==other_value.field_lengthf && field_subscribed__ue__ambr__uplink==other_value.field_subscribed__ue__ambr__uplink && field_subscribed__ue__ambr__downlink==other_value.field_subscribed__ue__ambr__downlink && field_authorized__ue__ambr__uplink==other_value.field_authorized__ue__ambr__uplink && field_authorized__ue__ambr__downlink==other_value.field_authorized__ue__ambr__downlink; } boolean UE__AMBR::is_bound() const { return (field_type__gtpc.is_bound()) || (field_lengthf.is_bound()) || (field_subscribed__ue__ambr__uplink.is_bound()) || (field_subscribed__ue__ambr__downlink.is_bound()) || (OPTIONAL_OMIT == field_authorized__ue__ambr__uplink.get_selection() || field_authorized__ue__ambr__uplink.is_bound()) || (OPTIONAL_OMIT == field_authorized__ue__ambr__downlink.get_selection() || field_authorized__ue__ambr__downlink.is_bound()); } boolean UE__AMBR::is_value() const { return field_type__gtpc.is_value() && field_lengthf.is_value() && field_subscribed__ue__ambr__uplink.is_value() && field_subscribed__ue__ambr__downlink.is_value() && (OPTIONAL_OMIT == field_authorized__ue__ambr__uplink.get_selection() || field_authorized__ue__ambr__uplink.is_value()) && (OPTIONAL_OMIT == field_authorized__ue__ambr__downlink.get_selection() || field_authorized__ue__ambr__downlink.is_value()); } int UE__AMBR::size_of() const { int ret_val = 4; if (field_authorized__ue__ambr__uplink.ispresent()) ret_val++; if (field_authorized__ue__ambr__downlink.ispresent()) ret_val++; return ret_val; } void UE__AMBR::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ type_gtpc := "); field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); field_lengthf.log(); TTCN_Logger::log_event_str(", subscribed_ue_ambr_uplink := "); field_subscribed__ue__ambr__uplink.log(); TTCN_Logger::log_event_str(", subscribed_ue_ambr_downlink := "); field_subscribed__ue__ambr__downlink.log(); TTCN_Logger::log_event_str(", authorized_ue_ambr_uplink := "); field_authorized__ue__ambr__uplink.log(); TTCN_Logger::log_event_str(", authorized_ue_ambr_downlink := "); field_authorized__ue__ambr__downlink.log(); TTCN_Logger::log_event_str(" }"); } void UE__AMBR::set_implicit_omit() { if (type__gtpc().is_bound()) type__gtpc().set_implicit_omit(); if (lengthf().is_bound()) lengthf().set_implicit_omit(); if (subscribed__ue__ambr__uplink().is_bound()) subscribed__ue__ambr__uplink().set_implicit_omit(); if (subscribed__ue__ambr__downlink().is_bound()) subscribed__ue__ambr__downlink().set_implicit_omit(); if (!authorized__ue__ambr__uplink().is_bound()) authorized__ue__ambr__uplink() = OMIT_VALUE; else authorized__ue__ambr__uplink().set_implicit_omit(); if (!authorized__ue__ambr__downlink().is_bound()) authorized__ue__ambr__downlink() = OMIT_VALUE; else authorized__ue__ambr__downlink().set_implicit_omit(); } void UE__AMBR::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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) subscribed__ue__ambr__uplink().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) subscribed__ue__ambr__downlink().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) authorized__ue__ambr__uplink().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) authorized__ue__ambr__downlink().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "subscribed_ue_ambr_uplink")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { subscribed__ue__ambr__uplink().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "subscribed_ue_ambr_downlink")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { subscribed__ue__ambr__downlink().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "authorized_ue_ambr_uplink")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { authorized__ue__ambr__uplink().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "authorized_ue_ambr_downlink")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { authorized__ue__ambr__downlink().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.UE_AMBR: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.UE_AMBR"); } } void UE__AMBR::encode_text(Text_Buf& text_buf) const { field_type__gtpc.encode_text(text_buf); field_lengthf.encode_text(text_buf); field_subscribed__ue__ambr__uplink.encode_text(text_buf); field_subscribed__ue__ambr__downlink.encode_text(text_buf); field_authorized__ue__ambr__uplink.encode_text(text_buf); field_authorized__ue__ambr__downlink.encode_text(text_buf); } void UE__AMBR::decode_text(Text_Buf& text_buf) { field_type__gtpc.decode_text(text_buf); field_lengthf.decode_text(text_buf); field_subscribed__ue__ambr__uplink.decode_text(text_buf); field_subscribed__ue__ambr__downlink.decode_text(text_buf); field_authorized__ue__ambr__uplink.decode_text(text_buf); field_authorized__ue__ambr__downlink.decode_text(text_buf); } void UE__AMBR::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 UE__AMBR::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 UE__AMBR::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; int value_of_length_field1 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_type__gtpc.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, UE__AMBR_lengthf_descr_.raw->forceomit); decoded_field_length = field_lengthf.RAW_decode(UE__AMBR_lengthf_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()); INTEGER tmp1 = field_lengthf.convert_to_Integer(UE__AMBR_lengthf_descr_); field_lengthf = tmp1; value_of_length_field1 += tmp1.get_long_long_val() * 8; RAW_Force_Omit field_2_force_omit(2, force_omit, General__Types::LIN4__BO__LAST_descr_.raw->forceomit); decoded_field_length = field_subscribed__ue__ambr__uplink.RAW_decode(General__Types::LIN4__BO__LAST_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::LIN4__BO__LAST_descr_.raw->forceomit); decoded_field_length = field_subscribed__ue__ambr__downlink.RAW_decode(General__Types::LIN4__BO__LAST_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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_field1 -= decoded_field_length; if (limit > 0 && value_of_length_field1 > 0){ if (force_omit != NULL && (*force_omit)(4)) { field_authorized__ue__ambr__uplink = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_4_force_omit(4, force_omit, General__Types::LIN4__BO__LAST_descr_.raw->forceomit); decoded_field_length = field_authorized__ue__ambr__uplink().RAW_decode(General__Types::LIN4__BO__LAST_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, TRUE, -1, TRUE, &field_4_force_omit); if (decoded_field_length < 1) { field_authorized__ue__ambr__uplink = 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()); value_of_length_field1 -= decoded_field_length; } } } else field_authorized__ue__ambr__uplink=OMIT_VALUE; if (limit > 0 && value_of_length_field1 > 0){ if (force_omit != NULL && (*force_omit)(5)) { field_authorized__ue__ambr__downlink = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_5_force_omit(5, force_omit, General__Types::LIN4__BO__LAST_descr_.raw->forceomit); decoded_field_length = field_authorized__ue__ambr__downlink().RAW_decode(General__Types::LIN4__BO__LAST_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, TRUE, -1, TRUE, &field_5_force_omit); if (decoded_field_length < 1) { field_authorized__ue__ambr__downlink = 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()); value_of_length_field1 -= decoded_field_length; } } } else field_authorized__ue__ambr__downlink=OMIT_VALUE; if (field_type__gtpc != os_74) return -1; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int UE__AMBR::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, UE__AMBR_lengthf_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, General__Types::LIN4__BO__LAST_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::LIN4__BO__LAST_descr_.raw); if (field_authorized__ue__ambr__uplink.ispresent()) { myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, General__Types::LIN4__BO__LAST_descr_.raw); } else myleaf.body.node.nodes[4] = NULL; if (field_authorized__ue__ambr__downlink.ispresent()) { myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, General__Types::LIN4__BO__LAST_descr_.raw); } else myleaf.body.node.nodes[5] = NULL; encoded_length += field_type__gtpc.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += 16; myleaf.body.node.nodes[1]->calc = CALC_LENGTH; myleaf.body.node.nodes[1]->coding_descr = &UE__AMBR_lengthf_descr_; myleaf.body.node.nodes[1]->calcof.lengthto.num_of_fields = 4; myleaf.body.node.nodes[1]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[1]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields = init_lengthto_fields_list(4); myleaf.body.node.nodes[1]->length = 16; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[2]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[2]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].level = myleaf.body.node.nodes[3]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].pos = myleaf.body.node.nodes[3]->curr_pos.pos; if (field_authorized__ue__ambr__uplink.ispresent()) { myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].level = myleaf.body.node.nodes[4]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].pos = myleaf.body.node.nodes[4]->curr_pos.pos; } else { myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].level = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].pos = 0; } if (field_authorized__ue__ambr__downlink.ispresent()) { myleaf.body.node.nodes[1]->calcof.lengthto.fields[3].level = myleaf.body.node.nodes[5]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[3].pos = myleaf.body.node.nodes[5]->curr_pos.pos; } else { myleaf.body.node.nodes[1]->calcof.lengthto.fields[3].level = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields[3].pos = 0; } encoded_length += field_subscribed__ue__ambr__uplink.RAW_encode(General__Types::LIN4__BO__LAST_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_subscribed__ue__ambr__downlink.RAW_encode(General__Types::LIN4__BO__LAST_descr_, *myleaf.body.node.nodes[3]); if (field_authorized__ue__ambr__uplink.ispresent()) { encoded_length += field_authorized__ue__ambr__uplink().RAW_encode(General__Types::LIN4__BO__LAST_descr_, *myleaf.body.node.nodes[4]); } if (field_authorized__ue__ambr__downlink.ispresent()) { encoded_length += field_authorized__ue__ambr__downlink().RAW_encode(General__Types::LIN4__BO__LAST_descr_, *myleaf.body.node.nodes[5]); } if (field_type__gtpc != os_74) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={0}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ os_74.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 UE__AMBR_template::single_value_struct { OCTETSTRING_template field_type__gtpc; INTEGER_template field_lengthf; INTEGER_template field_subscribed__ue__ambr__uplink; INTEGER_template field_subscribed__ue__ambr__downlink; INTEGER_template field_authorized__ue__ambr__uplink; INTEGER_template field_authorized__ue__ambr__downlink; }; void UE__AMBR_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_type__gtpc = ANY_VALUE; single_value->field_lengthf = ANY_VALUE; single_value->field_subscribed__ue__ambr__uplink = ANY_VALUE; single_value->field_subscribed__ue__ambr__downlink = ANY_VALUE; single_value->field_authorized__ue__ambr__uplink = ANY_OR_OMIT; single_value->field_authorized__ue__ambr__downlink = ANY_OR_OMIT; } } } void UE__AMBR_template::copy_value(const UE__AMBR& other_value) { single_value = new single_value_struct; if (other_value.type__gtpc().is_bound()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (other_value.lengthf().is_bound()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (other_value.subscribed__ue__ambr__uplink().is_bound()) { single_value->field_subscribed__ue__ambr__uplink = other_value.subscribed__ue__ambr__uplink(); } else { single_value->field_subscribed__ue__ambr__uplink.clean_up(); } if (other_value.subscribed__ue__ambr__downlink().is_bound()) { single_value->field_subscribed__ue__ambr__downlink = other_value.subscribed__ue__ambr__downlink(); } else { single_value->field_subscribed__ue__ambr__downlink.clean_up(); } if (other_value.authorized__ue__ambr__uplink().is_bound()) { if (other_value.authorized__ue__ambr__uplink().ispresent()) single_value->field_authorized__ue__ambr__uplink = other_value.authorized__ue__ambr__uplink()(); else single_value->field_authorized__ue__ambr__uplink = OMIT_VALUE; } else { single_value->field_authorized__ue__ambr__uplink.clean_up(); } if (other_value.authorized__ue__ambr__downlink().is_bound()) { if (other_value.authorized__ue__ambr__downlink().ispresent()) single_value->field_authorized__ue__ambr__downlink = other_value.authorized__ue__ambr__downlink()(); else single_value->field_authorized__ue__ambr__downlink = OMIT_VALUE; } else { single_value->field_authorized__ue__ambr__downlink.clean_up(); } set_selection(SPECIFIC_VALUE); } void UE__AMBR_template::copy_template(const UE__AMBR_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.type__gtpc().get_selection()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lengthf().get_selection()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.subscribed__ue__ambr__uplink().get_selection()) { single_value->field_subscribed__ue__ambr__uplink = other_value.subscribed__ue__ambr__uplink(); } else { single_value->field_subscribed__ue__ambr__uplink.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.subscribed__ue__ambr__downlink().get_selection()) { single_value->field_subscribed__ue__ambr__downlink = other_value.subscribed__ue__ambr__downlink(); } else { single_value->field_subscribed__ue__ambr__downlink.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.authorized__ue__ambr__uplink().get_selection()) { single_value->field_authorized__ue__ambr__uplink = other_value.authorized__ue__ambr__uplink(); } else { single_value->field_authorized__ue__ambr__uplink.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.authorized__ue__ambr__downlink().get_selection()) { single_value->field_authorized__ue__ambr__downlink = other_value.authorized__ue__ambr__downlink(); } else { single_value->field_authorized__ue__ambr__downlink.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 UE__AMBR_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 UE__AMBR_template(*other_value.implication_.precondition); implication_.implied_template = new UE__AMBR_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 @GTPC_Types.UE_AMBR."); break; } set_selection(other_value); } UE__AMBR_template::UE__AMBR_template() { } UE__AMBR_template::UE__AMBR_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } UE__AMBR_template::UE__AMBR_template(const UE__AMBR& other_value) { copy_value(other_value); } UE__AMBR_template::UE__AMBR_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const UE__AMBR&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.UE_AMBR from an unbound optional field."); } } UE__AMBR_template::UE__AMBR_template(UE__AMBR_template* p_precondition, UE__AMBR_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } UE__AMBR_template::UE__AMBR_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; } UE__AMBR_template::UE__AMBR_template(const UE__AMBR_template& other_value) : Base_Template() { copy_template(other_value); } UE__AMBR_template::~UE__AMBR_template() { clean_up(); } UE__AMBR_template& UE__AMBR_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } UE__AMBR_template& UE__AMBR_template::operator=(const UE__AMBR& other_value) { clean_up(); copy_value(other_value); return *this; } UE__AMBR_template& UE__AMBR_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const UE__AMBR&)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 @GTPC_Types.UE_AMBR."); } return *this; } UE__AMBR_template& UE__AMBR_template::operator=(const UE__AMBR_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean UE__AMBR_template::match(const UE__AMBR& 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.type__gtpc().is_bound()) return FALSE; if(!single_value->field_type__gtpc.match(other_value.type__gtpc(), legacy))return FALSE; if(!other_value.lengthf().is_bound()) return FALSE; if(!single_value->field_lengthf.match(other_value.lengthf(), legacy))return FALSE; if(!other_value.subscribed__ue__ambr__uplink().is_bound()) return FALSE; if(!single_value->field_subscribed__ue__ambr__uplink.match(other_value.subscribed__ue__ambr__uplink(), legacy))return FALSE; if(!other_value.subscribed__ue__ambr__downlink().is_bound()) return FALSE; if(!single_value->field_subscribed__ue__ambr__downlink.match(other_value.subscribed__ue__ambr__downlink(), legacy))return FALSE; if(!other_value.authorized__ue__ambr__uplink().is_bound()) return FALSE; if((other_value.authorized__ue__ambr__uplink().ispresent() ? !single_value->field_authorized__ue__ambr__uplink.match((const INTEGER&)other_value.authorized__ue__ambr__uplink(), legacy) : !single_value->field_authorized__ue__ambr__uplink.match_omit(legacy)))return FALSE; if(!other_value.authorized__ue__ambr__downlink().is_bound()) return FALSE; if((other_value.authorized__ue__ambr__downlink().ispresent() ? !single_value->field_authorized__ue__ambr__downlink.match((const INTEGER&)other_value.authorized__ue__ambr__downlink(), legacy) : !single_value->field_authorized__ue__ambr__downlink.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 @GTPC_Types.UE_AMBR."); } return FALSE; } boolean UE__AMBR_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_type__gtpc.is_bound() || single_value->field_lengthf.is_bound() || single_value->field_subscribed__ue__ambr__uplink.is_bound() || single_value->field_subscribed__ue__ambr__downlink.is_bound() || (single_value->field_authorized__ue__ambr__uplink.is_omit() || single_value->field_authorized__ue__ambr__uplink.is_bound()) || (single_value->field_authorized__ue__ambr__downlink.is_omit() || single_value->field_authorized__ue__ambr__downlink.is_bound()); } boolean UE__AMBR_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_type__gtpc.is_value() && single_value->field_lengthf.is_value() && single_value->field_subscribed__ue__ambr__uplink.is_value() && single_value->field_subscribed__ue__ambr__downlink.is_value() && (single_value->field_authorized__ue__ambr__uplink.is_omit() || single_value->field_authorized__ue__ambr__uplink.is_value()) && (single_value->field_authorized__ue__ambr__downlink.is_omit() || single_value->field_authorized__ue__ambr__downlink.is_value()); } void UE__AMBR_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; } UE__AMBR UE__AMBR_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 @GTPC_Types.UE_AMBR."); UE__AMBR ret_val; if (single_value->field_type__gtpc.is_bound()) { ret_val.type__gtpc() = single_value->field_type__gtpc.valueof(); } if (single_value->field_lengthf.is_bound()) { ret_val.lengthf() = single_value->field_lengthf.valueof(); } if (single_value->field_subscribed__ue__ambr__uplink.is_bound()) { ret_val.subscribed__ue__ambr__uplink() = single_value->field_subscribed__ue__ambr__uplink.valueof(); } if (single_value->field_subscribed__ue__ambr__downlink.is_bound()) { ret_val.subscribed__ue__ambr__downlink() = single_value->field_subscribed__ue__ambr__downlink.valueof(); } if (single_value->field_authorized__ue__ambr__uplink.is_omit()) ret_val.authorized__ue__ambr__uplink() = OMIT_VALUE; else if (single_value->field_authorized__ue__ambr__uplink.is_bound()) { ret_val.authorized__ue__ambr__uplink() = single_value->field_authorized__ue__ambr__uplink.valueof(); } if (single_value->field_authorized__ue__ambr__downlink.is_omit()) ret_val.authorized__ue__ambr__downlink() = OMIT_VALUE; else if (single_value->field_authorized__ue__ambr__downlink.is_bound()) { ret_val.authorized__ue__ambr__downlink() = single_value->field_authorized__ue__ambr__downlink.valueof(); } return ret_val; } void UE__AMBR_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 @GTPC_Types.UE_AMBR."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new UE__AMBR_template[list_length]; } UE__AMBR_template& UE__AMBR_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 @GTPC_Types.UE_AMBR."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.UE_AMBR."); return value_list.list_value[list_index]; } OCTETSTRING_template& UE__AMBR_template::type__gtpc() { set_specific(); return single_value->field_type__gtpc; } const OCTETSTRING_template& UE__AMBR_template::type__gtpc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field type_gtpc of a non-specific template of type @GTPC_Types.UE_AMBR."); return single_value->field_type__gtpc; } INTEGER_template& UE__AMBR_template::lengthf() { set_specific(); return single_value->field_lengthf; } const INTEGER_template& UE__AMBR_template::lengthf() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthf of a non-specific template of type @GTPC_Types.UE_AMBR."); return single_value->field_lengthf; } INTEGER_template& UE__AMBR_template::subscribed__ue__ambr__uplink() { set_specific(); return single_value->field_subscribed__ue__ambr__uplink; } const INTEGER_template& UE__AMBR_template::subscribed__ue__ambr__uplink() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field subscribed_ue_ambr_uplink of a non-specific template of type @GTPC_Types.UE_AMBR."); return single_value->field_subscribed__ue__ambr__uplink; } INTEGER_template& UE__AMBR_template::subscribed__ue__ambr__downlink() { set_specific(); return single_value->field_subscribed__ue__ambr__downlink; } const INTEGER_template& UE__AMBR_template::subscribed__ue__ambr__downlink() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field subscribed_ue_ambr_downlink of a non-specific template of type @GTPC_Types.UE_AMBR."); return single_value->field_subscribed__ue__ambr__downlink; } INTEGER_template& UE__AMBR_template::authorized__ue__ambr__uplink() { set_specific(); return single_value->field_authorized__ue__ambr__uplink; } const INTEGER_template& UE__AMBR_template::authorized__ue__ambr__uplink() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field authorized_ue_ambr_uplink of a non-specific template of type @GTPC_Types.UE_AMBR."); return single_value->field_authorized__ue__ambr__uplink; } INTEGER_template& UE__AMBR_template::authorized__ue__ambr__downlink() { set_specific(); return single_value->field_authorized__ue__ambr__downlink; } const INTEGER_template& UE__AMBR_template::authorized__ue__ambr__downlink() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field authorized_ue_ambr_downlink of a non-specific template of type @GTPC_Types.UE_AMBR."); return single_value->field_authorized__ue__ambr__downlink; } int UE__AMBR_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.UE_AMBR which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 4; if (single_value->field_authorized__ue__ambr__uplink.is_present()) ret_val++; if (single_value->field_authorized__ue__ambr__downlink.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 @GTPC_Types.UE_AMBR 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 @GTPC_Types.UE_AMBR containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.UE_AMBR containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.UE_AMBR containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.UE_AMBR containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.UE_AMBR containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.UE_AMBR containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.UE_AMBR containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.UE_AMBR."); } return 0; } void UE__AMBR_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ type_gtpc := "); single_value->field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log(); TTCN_Logger::log_event_str(", subscribed_ue_ambr_uplink := "); single_value->field_subscribed__ue__ambr__uplink.log(); TTCN_Logger::log_event_str(", subscribed_ue_ambr_downlink := "); single_value->field_subscribed__ue__ambr__downlink.log(); TTCN_Logger::log_event_str(", authorized_ue_ambr_uplink := "); single_value->field_authorized__ue__ambr__uplink.log(); TTCN_Logger::log_event_str(", authorized_ue_ambr_downlink := "); single_value->field_authorized__ue__ambr__downlink.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 UE__AMBR_template::log_match(const UE__AMBR& 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_type__gtpc.match(match_value.type__gtpc(), legacy)){ TTCN_Logger::log_logmatch_info(".type_gtpc"); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lengthf.match(match_value.lengthf(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthf"); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_subscribed__ue__ambr__uplink.match(match_value.subscribed__ue__ambr__uplink(), legacy)){ TTCN_Logger::log_logmatch_info(".subscribed_ue_ambr_uplink"); single_value->field_subscribed__ue__ambr__uplink.log_match(match_value.subscribed__ue__ambr__uplink(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_subscribed__ue__ambr__downlink.match(match_value.subscribed__ue__ambr__downlink(), legacy)){ TTCN_Logger::log_logmatch_info(".subscribed_ue_ambr_downlink"); single_value->field_subscribed__ue__ambr__downlink.log_match(match_value.subscribed__ue__ambr__downlink(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.authorized__ue__ambr__uplink().ispresent()){ if(!single_value->field_authorized__ue__ambr__uplink.match(match_value.authorized__ue__ambr__uplink(), legacy)){ TTCN_Logger::log_logmatch_info(".authorized_ue_ambr_uplink"); single_value->field_authorized__ue__ambr__uplink.log_match(match_value.authorized__ue__ambr__uplink(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_authorized__ue__ambr__uplink.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".authorized_ue_ambr_uplink := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_authorized__ue__ambr__uplink.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if (match_value.authorized__ue__ambr__downlink().ispresent()){ if(!single_value->field_authorized__ue__ambr__downlink.match(match_value.authorized__ue__ambr__downlink(), legacy)){ TTCN_Logger::log_logmatch_info(".authorized_ue_ambr_downlink"); single_value->field_authorized__ue__ambr__downlink.log_match(match_value.authorized__ue__ambr__downlink(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_authorized__ue__ambr__downlink.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".authorized_ue_ambr_downlink := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_authorized__ue__ambr__downlink.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("{ type_gtpc := "); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::log_event_str(", subscribed_ue_ambr_uplink := "); single_value->field_subscribed__ue__ambr__uplink.log_match(match_value.subscribed__ue__ambr__uplink(), legacy); TTCN_Logger::log_event_str(", subscribed_ue_ambr_downlink := "); single_value->field_subscribed__ue__ambr__downlink.log_match(match_value.subscribed__ue__ambr__downlink(), legacy); TTCN_Logger::log_event_str(", authorized_ue_ambr_uplink := "); if (match_value.authorized__ue__ambr__uplink().ispresent()) { single_value->field_authorized__ue__ambr__uplink.log_match(match_value.authorized__ue__ambr__uplink(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_authorized__ue__ambr__uplink.log(); if (single_value->field_authorized__ue__ambr__uplink.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", authorized_ue_ambr_downlink := "); if (match_value.authorized__ue__ambr__downlink().ispresent()) { single_value->field_authorized__ue__ambr__downlink.log_match(match_value.authorized__ue__ambr__downlink(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_authorized__ue__ambr__downlink.log(); if (single_value->field_authorized__ue__ambr__downlink.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 UE__AMBR_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_type__gtpc.encode_text(text_buf); single_value->field_lengthf.encode_text(text_buf); single_value->field_subscribed__ue__ambr__uplink.encode_text(text_buf); single_value->field_subscribed__ue__ambr__downlink.encode_text(text_buf); single_value->field_authorized__ue__ambr__uplink.encode_text(text_buf); single_value->field_authorized__ue__ambr__downlink.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 @GTPC_Types.UE_AMBR."); } } void UE__AMBR_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_type__gtpc.decode_text(text_buf); single_value->field_lengthf.decode_text(text_buf); single_value->field_subscribed__ue__ambr__uplink.decode_text(text_buf); single_value->field_subscribed__ue__ambr__downlink.decode_text(text_buf); single_value->field_authorized__ue__ambr__uplink.decode_text(text_buf); single_value->field_authorized__ue__ambr__downlink.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 UE__AMBR_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 @GTPC_Types.UE_AMBR."); } } void UE__AMBR_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: { UE__AMBR_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) subscribed__ue__ambr__uplink().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) subscribed__ue__ambr__downlink().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) authorized__ue__ambr__uplink().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) authorized__ue__ambr__downlink().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "subscribed_ue_ambr_uplink")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { subscribed__ue__ambr__uplink().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "subscribed_ue_ambr_downlink")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { subscribed__ue__ambr__downlink().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "authorized_ue_ambr_uplink")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { authorized__ue__ambr__uplink().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "authorized_ue_ambr_downlink")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { authorized__ue__ambr__downlink().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.UE_AMBR: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { UE__AMBR_template* precondition = new UE__AMBR_template; precondition->set_param(*param.get_elem(0)); UE__AMBR_template* implied_template = new UE__AMBR_template; implied_template->set_param(*param.get_elem(1)); *this = UE__AMBR_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.UE_AMBR"); } is_ifpresent = param.get_ifpresent(); } void UE__AMBR_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_type__gtpc.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.UE_AMBR"); single_value->field_lengthf.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.UE_AMBR"); single_value->field_subscribed__ue__ambr__uplink.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.UE_AMBR"); single_value->field_subscribed__ue__ambr__downlink.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.UE_AMBR"); single_value->field_authorized__ue__ambr__uplink.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.UE_AMBR"); single_value->field_authorized__ue__ambr__downlink.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.UE_AMBR"); 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 : "@GTPC_Types.UE_AMBR"); } boolean UE__AMBR_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean UE__AMBR_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) nsapi().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) authorized__apn__ambr__uplink().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) authorized__apn__ambr__downlink().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nsapi")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsapi().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "spare")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "authorized_apn_ambr_uplink")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { authorized__apn__ambr__uplink().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "authorized_apn_ambr_downlink")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { authorized__apn__ambr__downlink().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.APN_AMBR_NSAPI: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.APN_AMBR_NSAPI"); } } void APN__AMBR__NSAPI::encode_text(Text_Buf& text_buf) const { field_type__gtpc.encode_text(text_buf); field_lengthf.encode_text(text_buf); field_nsapi.encode_text(text_buf); field_spare.encode_text(text_buf); field_authorized__apn__ambr__uplink.encode_text(text_buf); field_authorized__apn__ambr__downlink.encode_text(text_buf); } void APN__AMBR__NSAPI::decode_text(Text_Buf& text_buf) { field_type__gtpc.decode_text(text_buf); field_lengthf.decode_text(text_buf); field_nsapi.decode_text(text_buf); field_spare.decode_text(text_buf); field_authorized__apn__ambr__uplink.decode_text(text_buf); field_authorized__apn__ambr__downlink.decode_text(text_buf); } void APN__AMBR__NSAPI::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 APN__AMBR__NSAPI::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 APN__AMBR__NSAPI::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; int value_of_length_field1 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_type__gtpc.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, APN__AMBR__NSAPI_lengthf_descr_.raw->forceomit); decoded_field_length = field_lengthf.RAW_decode(APN__AMBR__NSAPI_lengthf_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()); INTEGER tmp1 = field_lengthf.convert_to_Integer(APN__AMBR__NSAPI_lengthf_descr_); field_lengthf = tmp1; value_of_length_field1 += tmp1.get_long_long_val() * 8; RAW_Force_Omit field_2_force_omit(2, force_omit, General__Types::HEX1_descr_.raw->forceomit); decoded_field_length = field_nsapi.RAW_decode(General__Types::HEX1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::HEX1_descr_.raw->forceomit); decoded_field_length = field_spare.RAW_decode(General__Types::HEX1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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_field1 -= decoded_field_length; RAW_Force_Omit field_4_force_omit(4, force_omit, General__Types::LIN4__BO__LAST_descr_.raw->forceomit); decoded_field_length = field_authorized__apn__ambr__uplink.RAW_decode(General__Types::LIN4__BO__LAST_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, no_err, -1, TRUE, &field_4_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_5_force_omit(5, force_omit, General__Types::LIN4__BO__LAST_descr_.raw->forceomit); decoded_field_length = field_authorized__apn__ambr__downlink.RAW_decode(General__Types::LIN4__BO__LAST_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, no_err, -1, TRUE, &field_5_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); value_of_length_field1 -= decoded_field_length; if (field_type__gtpc != os_75) return -1; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int APN__AMBR__NSAPI::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, APN__AMBR__NSAPI_lengthf_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, General__Types::HEX1_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::HEX1_descr_.raw); myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, General__Types::LIN4__BO__LAST_descr_.raw); myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, General__Types::LIN4__BO__LAST_descr_.raw); encoded_length += field_type__gtpc.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += 16; myleaf.body.node.nodes[1]->calc = CALC_LENGTH; myleaf.body.node.nodes[1]->coding_descr = &APN__AMBR__NSAPI_lengthf_descr_; myleaf.body.node.nodes[1]->calcof.lengthto.num_of_fields = 4; myleaf.body.node.nodes[1]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[1]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields = init_lengthto_fields_list(4); myleaf.body.node.nodes[1]->length = 16; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].level = myleaf.body.node.nodes[2]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].pos = myleaf.body.node.nodes[2]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].level = myleaf.body.node.nodes[4]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].pos = myleaf.body.node.nodes[4]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[3].level = myleaf.body.node.nodes[5]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[3].pos = myleaf.body.node.nodes[5]->curr_pos.pos; encoded_length += field_nsapi.RAW_encode(General__Types::HEX1_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_spare.RAW_encode(General__Types::HEX1_descr_, *myleaf.body.node.nodes[3]); encoded_length += field_authorized__apn__ambr__uplink.RAW_encode(General__Types::LIN4__BO__LAST_descr_, *myleaf.body.node.nodes[4]); encoded_length += field_authorized__apn__ambr__downlink.RAW_encode(General__Types::LIN4__BO__LAST_descr_, *myleaf.body.node.nodes[5]); if (field_type__gtpc != os_75) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={0}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ os_75.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 APN__AMBR__NSAPI_template::single_value_struct { OCTETSTRING_template field_type__gtpc; INTEGER_template field_lengthf; HEXSTRING_template field_nsapi; HEXSTRING_template field_spare; INTEGER_template field_authorized__apn__ambr__uplink; INTEGER_template field_authorized__apn__ambr__downlink; }; void APN__AMBR__NSAPI_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_type__gtpc = ANY_VALUE; single_value->field_lengthf = ANY_VALUE; single_value->field_nsapi = ANY_VALUE; single_value->field_spare = ANY_VALUE; single_value->field_authorized__apn__ambr__uplink = ANY_VALUE; single_value->field_authorized__apn__ambr__downlink = ANY_VALUE; } } } void APN__AMBR__NSAPI_template::copy_value(const APN__AMBR__NSAPI& other_value) { single_value = new single_value_struct; if (other_value.type__gtpc().is_bound()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (other_value.lengthf().is_bound()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (other_value.nsapi().is_bound()) { single_value->field_nsapi = other_value.nsapi(); } else { single_value->field_nsapi.clean_up(); } if (other_value.spare().is_bound()) { single_value->field_spare = other_value.spare(); } else { single_value->field_spare.clean_up(); } if (other_value.authorized__apn__ambr__uplink().is_bound()) { single_value->field_authorized__apn__ambr__uplink = other_value.authorized__apn__ambr__uplink(); } else { single_value->field_authorized__apn__ambr__uplink.clean_up(); } if (other_value.authorized__apn__ambr__downlink().is_bound()) { single_value->field_authorized__apn__ambr__downlink = other_value.authorized__apn__ambr__downlink(); } else { single_value->field_authorized__apn__ambr__downlink.clean_up(); } set_selection(SPECIFIC_VALUE); } void APN__AMBR__NSAPI_template::copy_template(const APN__AMBR__NSAPI_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.type__gtpc().get_selection()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lengthf().get_selection()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.nsapi().get_selection()) { single_value->field_nsapi = other_value.nsapi(); } else { single_value->field_nsapi.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.spare().get_selection()) { single_value->field_spare = other_value.spare(); } else { single_value->field_spare.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.authorized__apn__ambr__uplink().get_selection()) { single_value->field_authorized__apn__ambr__uplink = other_value.authorized__apn__ambr__uplink(); } else { single_value->field_authorized__apn__ambr__uplink.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.authorized__apn__ambr__downlink().get_selection()) { single_value->field_authorized__apn__ambr__downlink = other_value.authorized__apn__ambr__downlink(); } else { single_value->field_authorized__apn__ambr__downlink.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 APN__AMBR__NSAPI_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 APN__AMBR__NSAPI_template(*other_value.implication_.precondition); implication_.implied_template = new APN__AMBR__NSAPI_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 @GTPC_Types.APN_AMBR_NSAPI."); break; } set_selection(other_value); } APN__AMBR__NSAPI_template::APN__AMBR__NSAPI_template() { } APN__AMBR__NSAPI_template::APN__AMBR__NSAPI_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } APN__AMBR__NSAPI_template::APN__AMBR__NSAPI_template(const APN__AMBR__NSAPI& other_value) { copy_value(other_value); } APN__AMBR__NSAPI_template::APN__AMBR__NSAPI_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const APN__AMBR__NSAPI&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.APN_AMBR_NSAPI from an unbound optional field."); } } APN__AMBR__NSAPI_template::APN__AMBR__NSAPI_template(APN__AMBR__NSAPI_template* p_precondition, APN__AMBR__NSAPI_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } APN__AMBR__NSAPI_template::APN__AMBR__NSAPI_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; } APN__AMBR__NSAPI_template::APN__AMBR__NSAPI_template(const APN__AMBR__NSAPI_template& other_value) : Base_Template() { copy_template(other_value); } APN__AMBR__NSAPI_template::~APN__AMBR__NSAPI_template() { clean_up(); } APN__AMBR__NSAPI_template& APN__AMBR__NSAPI_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } APN__AMBR__NSAPI_template& APN__AMBR__NSAPI_template::operator=(const APN__AMBR__NSAPI& other_value) { clean_up(); copy_value(other_value); return *this; } APN__AMBR__NSAPI_template& APN__AMBR__NSAPI_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const APN__AMBR__NSAPI&)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 @GTPC_Types.APN_AMBR_NSAPI."); } return *this; } APN__AMBR__NSAPI_template& APN__AMBR__NSAPI_template::operator=(const APN__AMBR__NSAPI_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean APN__AMBR__NSAPI_template::match(const APN__AMBR__NSAPI& 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.type__gtpc().is_bound()) return FALSE; if(!single_value->field_type__gtpc.match(other_value.type__gtpc(), legacy))return FALSE; if(!other_value.lengthf().is_bound()) return FALSE; if(!single_value->field_lengthf.match(other_value.lengthf(), legacy))return FALSE; if(!other_value.nsapi().is_bound()) return FALSE; if(!single_value->field_nsapi.match(other_value.nsapi(), legacy))return FALSE; if(!other_value.spare().is_bound()) return FALSE; if(!single_value->field_spare.match(other_value.spare(), legacy))return FALSE; if(!other_value.authorized__apn__ambr__uplink().is_bound()) return FALSE; if(!single_value->field_authorized__apn__ambr__uplink.match(other_value.authorized__apn__ambr__uplink(), legacy))return FALSE; if(!other_value.authorized__apn__ambr__downlink().is_bound()) return FALSE; if(!single_value->field_authorized__apn__ambr__downlink.match(other_value.authorized__apn__ambr__downlink(), 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 @GTPC_Types.APN_AMBR_NSAPI."); } return FALSE; } boolean APN__AMBR__NSAPI_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_type__gtpc.is_bound() || single_value->field_lengthf.is_bound() || single_value->field_nsapi.is_bound() || single_value->field_spare.is_bound() || single_value->field_authorized__apn__ambr__uplink.is_bound() || single_value->field_authorized__apn__ambr__downlink.is_bound(); } boolean APN__AMBR__NSAPI_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_type__gtpc.is_value() && single_value->field_lengthf.is_value() && single_value->field_nsapi.is_value() && single_value->field_spare.is_value() && single_value->field_authorized__apn__ambr__uplink.is_value() && single_value->field_authorized__apn__ambr__downlink.is_value(); } void APN__AMBR__NSAPI_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; } APN__AMBR__NSAPI APN__AMBR__NSAPI_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 @GTPC_Types.APN_AMBR_NSAPI."); APN__AMBR__NSAPI ret_val; if (single_value->field_type__gtpc.is_bound()) { ret_val.type__gtpc() = single_value->field_type__gtpc.valueof(); } if (single_value->field_lengthf.is_bound()) { ret_val.lengthf() = single_value->field_lengthf.valueof(); } if (single_value->field_nsapi.is_bound()) { ret_val.nsapi() = single_value->field_nsapi.valueof(); } if (single_value->field_spare.is_bound()) { ret_val.spare() = single_value->field_spare.valueof(); } if (single_value->field_authorized__apn__ambr__uplink.is_bound()) { ret_val.authorized__apn__ambr__uplink() = single_value->field_authorized__apn__ambr__uplink.valueof(); } if (single_value->field_authorized__apn__ambr__downlink.is_bound()) { ret_val.authorized__apn__ambr__downlink() = single_value->field_authorized__apn__ambr__downlink.valueof(); } return ret_val; } void APN__AMBR__NSAPI_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 @GTPC_Types.APN_AMBR_NSAPI."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new APN__AMBR__NSAPI_template[list_length]; } APN__AMBR__NSAPI_template& APN__AMBR__NSAPI_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 @GTPC_Types.APN_AMBR_NSAPI."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.APN_AMBR_NSAPI."); return value_list.list_value[list_index]; } OCTETSTRING_template& APN__AMBR__NSAPI_template::type__gtpc() { set_specific(); return single_value->field_type__gtpc; } const OCTETSTRING_template& APN__AMBR__NSAPI_template::type__gtpc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field type_gtpc of a non-specific template of type @GTPC_Types.APN_AMBR_NSAPI."); return single_value->field_type__gtpc; } INTEGER_template& APN__AMBR__NSAPI_template::lengthf() { set_specific(); return single_value->field_lengthf; } const INTEGER_template& APN__AMBR__NSAPI_template::lengthf() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthf of a non-specific template of type @GTPC_Types.APN_AMBR_NSAPI."); return single_value->field_lengthf; } HEXSTRING_template& APN__AMBR__NSAPI_template::nsapi() { set_specific(); return single_value->field_nsapi; } const HEXSTRING_template& APN__AMBR__NSAPI_template::nsapi() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nsapi of a non-specific template of type @GTPC_Types.APN_AMBR_NSAPI."); return single_value->field_nsapi; } HEXSTRING_template& APN__AMBR__NSAPI_template::spare() { set_specific(); return single_value->field_spare; } const HEXSTRING_template& APN__AMBR__NSAPI_template::spare() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field spare of a non-specific template of type @GTPC_Types.APN_AMBR_NSAPI."); return single_value->field_spare; } INTEGER_template& APN__AMBR__NSAPI_template::authorized__apn__ambr__uplink() { set_specific(); return single_value->field_authorized__apn__ambr__uplink; } const INTEGER_template& APN__AMBR__NSAPI_template::authorized__apn__ambr__uplink() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field authorized_apn_ambr_uplink of a non-specific template of type @GTPC_Types.APN_AMBR_NSAPI."); return single_value->field_authorized__apn__ambr__uplink; } INTEGER_template& APN__AMBR__NSAPI_template::authorized__apn__ambr__downlink() { set_specific(); return single_value->field_authorized__apn__ambr__downlink; } const INTEGER_template& APN__AMBR__NSAPI_template::authorized__apn__ambr__downlink() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field authorized_apn_ambr_downlink of a non-specific template of type @GTPC_Types.APN_AMBR_NSAPI."); return single_value->field_authorized__apn__ambr__downlink; } int APN__AMBR__NSAPI_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.APN_AMBR_NSAPI which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 6; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @GTPC_Types.APN_AMBR_NSAPI 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 @GTPC_Types.APN_AMBR_NSAPI containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.APN_AMBR_NSAPI containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.APN_AMBR_NSAPI containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.APN_AMBR_NSAPI containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.APN_AMBR_NSAPI containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.APN_AMBR_NSAPI containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.APN_AMBR_NSAPI containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.APN_AMBR_NSAPI."); } return 0; } void APN__AMBR__NSAPI_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ type_gtpc := "); single_value->field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log(); TTCN_Logger::log_event_str(", nsapi := "); single_value->field_nsapi.log(); TTCN_Logger::log_event_str(", spare := "); single_value->field_spare.log(); TTCN_Logger::log_event_str(", authorized_apn_ambr_uplink := "); single_value->field_authorized__apn__ambr__uplink.log(); TTCN_Logger::log_event_str(", authorized_apn_ambr_downlink := "); single_value->field_authorized__apn__ambr__downlink.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 APN__AMBR__NSAPI_template::log_match(const APN__AMBR__NSAPI& 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_type__gtpc.match(match_value.type__gtpc(), legacy)){ TTCN_Logger::log_logmatch_info(".type_gtpc"); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lengthf.match(match_value.lengthf(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthf"); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_nsapi.match(match_value.nsapi(), legacy)){ TTCN_Logger::log_logmatch_info(".nsapi"); single_value->field_nsapi.log_match(match_value.nsapi(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_spare.match(match_value.spare(), legacy)){ TTCN_Logger::log_logmatch_info(".spare"); single_value->field_spare.log_match(match_value.spare(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_authorized__apn__ambr__uplink.match(match_value.authorized__apn__ambr__uplink(), legacy)){ TTCN_Logger::log_logmatch_info(".authorized_apn_ambr_uplink"); single_value->field_authorized__apn__ambr__uplink.log_match(match_value.authorized__apn__ambr__uplink(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_authorized__apn__ambr__downlink.match(match_value.authorized__apn__ambr__downlink(), legacy)){ TTCN_Logger::log_logmatch_info(".authorized_apn_ambr_downlink"); single_value->field_authorized__apn__ambr__downlink.log_match(match_value.authorized__apn__ambr__downlink(), 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("{ type_gtpc := "); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::log_event_str(", nsapi := "); single_value->field_nsapi.log_match(match_value.nsapi(), legacy); TTCN_Logger::log_event_str(", spare := "); single_value->field_spare.log_match(match_value.spare(), legacy); TTCN_Logger::log_event_str(", authorized_apn_ambr_uplink := "); single_value->field_authorized__apn__ambr__uplink.log_match(match_value.authorized__apn__ambr__uplink(), legacy); TTCN_Logger::log_event_str(", authorized_apn_ambr_downlink := "); single_value->field_authorized__apn__ambr__downlink.log_match(match_value.authorized__apn__ambr__downlink(), 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 APN__AMBR__NSAPI_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_type__gtpc.encode_text(text_buf); single_value->field_lengthf.encode_text(text_buf); single_value->field_nsapi.encode_text(text_buf); single_value->field_spare.encode_text(text_buf); single_value->field_authorized__apn__ambr__uplink.encode_text(text_buf); single_value->field_authorized__apn__ambr__downlink.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 @GTPC_Types.APN_AMBR_NSAPI."); } } void APN__AMBR__NSAPI_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_type__gtpc.decode_text(text_buf); single_value->field_lengthf.decode_text(text_buf); single_value->field_nsapi.decode_text(text_buf); single_value->field_spare.decode_text(text_buf); single_value->field_authorized__apn__ambr__uplink.decode_text(text_buf); single_value->field_authorized__apn__ambr__downlink.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 APN__AMBR__NSAPI_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 @GTPC_Types.APN_AMBR_NSAPI."); } } void APN__AMBR__NSAPI_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: { APN__AMBR__NSAPI_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) nsapi().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) authorized__apn__ambr__uplink().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) authorized__apn__ambr__downlink().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nsapi")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsapi().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "spare")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "authorized_apn_ambr_uplink")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { authorized__apn__ambr__uplink().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "authorized_apn_ambr_downlink")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { authorized__apn__ambr__downlink().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.APN_AMBR_NSAPI: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { APN__AMBR__NSAPI_template* precondition = new APN__AMBR__NSAPI_template; precondition->set_param(*param.get_elem(0)); APN__AMBR__NSAPI_template* implied_template = new APN__AMBR__NSAPI_template; implied_template->set_param(*param.get_elem(1)); *this = APN__AMBR__NSAPI_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.APN_AMBR_NSAPI"); } is_ifpresent = param.get_ifpresent(); } void APN__AMBR__NSAPI_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_type__gtpc.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.APN_AMBR_NSAPI"); single_value->field_lengthf.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.APN_AMBR_NSAPI"); single_value->field_nsapi.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.APN_AMBR_NSAPI"); single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.APN_AMBR_NSAPI"); single_value->field_authorized__apn__ambr__uplink.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.APN_AMBR_NSAPI"); single_value->field_authorized__apn__ambr__downlink.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.APN_AMBR_NSAPI"); 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 : "@GTPC_Types.APN_AMBR_NSAPI"); } boolean APN__AMBR__NSAPI_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean APN__AMBR__NSAPI_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_explicitly__specified) : field_type__gtpc(par_type__gtpc), field_lengthf(par_lengthf), field_timerValue(par_timerValue), field_timerUnit(par_timerUnit), field_explicitly__specified(par_explicitly__specified) { } GGSN__BackOffTime::GGSN__BackOffTime(const GGSN__BackOffTime& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GTPC_Types.GGSN_BackOffTime."); if (other_value.type__gtpc().is_bound()) field_type__gtpc = other_value.type__gtpc(); else field_type__gtpc.clean_up(); if (other_value.lengthf().is_bound()) field_lengthf = other_value.lengthf(); else field_lengthf.clean_up(); if (other_value.timerValue().is_bound()) field_timerValue = other_value.timerValue(); else field_timerValue.clean_up(); if (other_value.timerUnit().is_bound()) field_timerUnit = other_value.timerUnit(); else field_timerUnit.clean_up(); if (other_value.explicitly__specified().is_bound()) field_explicitly__specified = other_value.explicitly__specified(); else field_explicitly__specified.clean_up(); } void GGSN__BackOffTime::clean_up() { field_type__gtpc.clean_up(); field_lengthf.clean_up(); field_timerValue.clean_up(); field_timerUnit.clean_up(); field_explicitly__specified.clean_up(); } const TTCN_Typedescriptor_t* GGSN__BackOffTime::get_descriptor() const { return &GGSN__BackOffTime_descr_; } GGSN__BackOffTime& GGSN__BackOffTime::operator=(const GGSN__BackOffTime& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GTPC_Types.GGSN_BackOffTime."); if (other_value.type__gtpc().is_bound()) field_type__gtpc = other_value.type__gtpc(); else field_type__gtpc.clean_up(); if (other_value.lengthf().is_bound()) field_lengthf = other_value.lengthf(); else field_lengthf.clean_up(); if (other_value.timerValue().is_bound()) field_timerValue = other_value.timerValue(); else field_timerValue.clean_up(); if (other_value.timerUnit().is_bound()) field_timerUnit = other_value.timerUnit(); else field_timerUnit.clean_up(); if (other_value.explicitly__specified().is_bound()) field_explicitly__specified = other_value.explicitly__specified(); else field_explicitly__specified.clean_up(); } return *this; } boolean GGSN__BackOffTime::operator==(const GGSN__BackOffTime& other_value) const { return field_type__gtpc==other_value.field_type__gtpc && field_lengthf==other_value.field_lengthf && field_timerValue==other_value.field_timerValue && field_timerUnit==other_value.field_timerUnit && field_explicitly__specified==other_value.field_explicitly__specified; } boolean GGSN__BackOffTime::is_bound() const { return (field_type__gtpc.is_bound()) || (field_lengthf.is_bound()) || (field_timerValue.is_bound()) || (field_timerUnit.is_bound()) || (OPTIONAL_OMIT == field_explicitly__specified.get_selection() || field_explicitly__specified.is_bound()); } boolean GGSN__BackOffTime::is_value() const { return field_type__gtpc.is_value() && field_lengthf.is_value() && field_timerValue.is_value() && field_timerUnit.is_value() && (OPTIONAL_OMIT == field_explicitly__specified.get_selection() || field_explicitly__specified.is_value()); } int GGSN__BackOffTime::size_of() const { int ret_val = 4; if (field_explicitly__specified.ispresent()) ret_val++; return ret_val; } void GGSN__BackOffTime::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ type_gtpc := "); field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); field_lengthf.log(); TTCN_Logger::log_event_str(", timerValue := "); field_timerValue.log(); TTCN_Logger::log_event_str(", timerUnit := "); field_timerUnit.log(); TTCN_Logger::log_event_str(", explicitly_specified := "); field_explicitly__specified.log(); TTCN_Logger::log_event_str(" }"); } void GGSN__BackOffTime::set_implicit_omit() { if (type__gtpc().is_bound()) type__gtpc().set_implicit_omit(); if (lengthf().is_bound()) lengthf().set_implicit_omit(); if (timerValue().is_bound()) timerValue().set_implicit_omit(); if (timerUnit().is_bound()) timerUnit().set_implicit_omit(); if (!explicitly__specified().is_bound()) explicitly__specified() = OMIT_VALUE; else explicitly__specified().set_implicit_omit(); } void GGSN__BackOffTime::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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) timerValue().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) timerUnit().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) explicitly__specified().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "timerValue")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { timerValue().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "timerUnit")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { timerUnit().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "explicitly_specified")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { explicitly__specified().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.GGSN_BackOffTime: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.GGSN_BackOffTime"); } } void GGSN__BackOffTime::encode_text(Text_Buf& text_buf) const { field_type__gtpc.encode_text(text_buf); field_lengthf.encode_text(text_buf); field_timerValue.encode_text(text_buf); field_timerUnit.encode_text(text_buf); field_explicitly__specified.encode_text(text_buf); } void GGSN__BackOffTime::decode_text(Text_Buf& text_buf) { field_type__gtpc.decode_text(text_buf); field_lengthf.decode_text(text_buf); field_timerValue.decode_text(text_buf); field_timerUnit.decode_text(text_buf); field_explicitly__specified.decode_text(text_buf); } void GGSN__BackOffTime::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 GGSN__BackOffTime::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 GGSN__BackOffTime::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; int value_of_length_field1 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_type__gtpc.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, GGSN__BackOffTime_lengthf_descr_.raw->forceomit); decoded_field_length = field_lengthf.RAW_decode(GGSN__BackOffTime_lengthf_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()); INTEGER tmp1 = field_lengthf.convert_to_Integer(GGSN__BackOffTime_lengthf_descr_); field_lengthf = tmp1; value_of_length_field1 += tmp1.get_long_long_val() * 8; RAW_Force_Omit field_2_force_omit(2, force_omit, General__Types::BIT5_descr_.raw->forceomit); decoded_field_length = field_timerValue.RAW_decode(General__Types::BIT5_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::BIT3_descr_.raw->forceomit); decoded_field_length = field_timerUnit.RAW_decode(General__Types::BIT3_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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_field1 -= decoded_field_length; if (limit > 0 && value_of_length_field1 > 0){ if (force_omit != NULL && (*force_omit)(4)) { field_explicitly__specified = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_4_force_omit(4, force_omit, OCTETSTRING_descr_.raw->forceomit); decoded_field_length = field_explicitly__specified().RAW_decode(OCTETSTRING_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, TRUE, -1, TRUE, &field_4_force_omit); if (decoded_field_length < 1) { field_explicitly__specified = 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()); value_of_length_field1 -= decoded_field_length; } } } else field_explicitly__specified=OMIT_VALUE; if (field_type__gtpc != os_45) return -1; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int GGSN__BackOffTime::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, GGSN__BackOffTime_lengthf_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, General__Types::BIT5_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::BIT3_descr_.raw); if (field_explicitly__specified.ispresent()) { myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, OCTETSTRING_descr_.raw); } else myleaf.body.node.nodes[4] = NULL; encoded_length += field_type__gtpc.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += 16; myleaf.body.node.nodes[1]->calc = CALC_LENGTH; myleaf.body.node.nodes[1]->coding_descr = &GGSN__BackOffTime_lengthf_descr_; myleaf.body.node.nodes[1]->calcof.lengthto.num_of_fields = 3; myleaf.body.node.nodes[1]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[1]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields = init_lengthto_fields_list(3); myleaf.body.node.nodes[1]->length = 16; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[2]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[2]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].level = myleaf.body.node.nodes[3]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].pos = myleaf.body.node.nodes[3]->curr_pos.pos; if (field_explicitly__specified.ispresent()) { myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].level = myleaf.body.node.nodes[4]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].pos = myleaf.body.node.nodes[4]->curr_pos.pos; } else { myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].level = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].pos = 0; } encoded_length += field_timerValue.RAW_encode(General__Types::BIT5_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_timerUnit.RAW_encode(General__Types::BIT3_descr_, *myleaf.body.node.nodes[3]); if (field_explicitly__specified.ispresent()) { encoded_length += field_explicitly__specified().RAW_encode(OCTETSTRING_descr_, *myleaf.body.node.nodes[4]); } if (field_type__gtpc != os_45) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={0}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ os_45.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 GGSN__BackOffTime_template::single_value_struct { OCTETSTRING_template field_type__gtpc; INTEGER_template field_lengthf; BITSTRING_template field_timerValue; BITSTRING_template field_timerUnit; OCTETSTRING_template field_explicitly__specified; }; void GGSN__BackOffTime_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_type__gtpc = ANY_VALUE; single_value->field_lengthf = ANY_VALUE; single_value->field_timerValue = ANY_VALUE; single_value->field_timerUnit = ANY_VALUE; single_value->field_explicitly__specified = ANY_OR_OMIT; } } } void GGSN__BackOffTime_template::copy_value(const GGSN__BackOffTime& other_value) { single_value = new single_value_struct; if (other_value.type__gtpc().is_bound()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (other_value.lengthf().is_bound()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (other_value.timerValue().is_bound()) { single_value->field_timerValue = other_value.timerValue(); } else { single_value->field_timerValue.clean_up(); } if (other_value.timerUnit().is_bound()) { single_value->field_timerUnit = other_value.timerUnit(); } else { single_value->field_timerUnit.clean_up(); } if (other_value.explicitly__specified().is_bound()) { if (other_value.explicitly__specified().ispresent()) single_value->field_explicitly__specified = other_value.explicitly__specified()(); else single_value->field_explicitly__specified = OMIT_VALUE; } else { single_value->field_explicitly__specified.clean_up(); } set_selection(SPECIFIC_VALUE); } void GGSN__BackOffTime_template::copy_template(const GGSN__BackOffTime_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.type__gtpc().get_selection()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lengthf().get_selection()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.timerValue().get_selection()) { single_value->field_timerValue = other_value.timerValue(); } else { single_value->field_timerValue.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.timerUnit().get_selection()) { single_value->field_timerUnit = other_value.timerUnit(); } else { single_value->field_timerUnit.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.explicitly__specified().get_selection()) { single_value->field_explicitly__specified = other_value.explicitly__specified(); } else { single_value->field_explicitly__specified.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 GGSN__BackOffTime_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 GGSN__BackOffTime_template(*other_value.implication_.precondition); implication_.implied_template = new GGSN__BackOffTime_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 @GTPC_Types.GGSN_BackOffTime."); break; } set_selection(other_value); } GGSN__BackOffTime_template::GGSN__BackOffTime_template() { } GGSN__BackOffTime_template::GGSN__BackOffTime_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } GGSN__BackOffTime_template::GGSN__BackOffTime_template(const GGSN__BackOffTime& other_value) { copy_value(other_value); } GGSN__BackOffTime_template::GGSN__BackOffTime_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const GGSN__BackOffTime&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.GGSN_BackOffTime from an unbound optional field."); } } GGSN__BackOffTime_template::GGSN__BackOffTime_template(GGSN__BackOffTime_template* p_precondition, GGSN__BackOffTime_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } GGSN__BackOffTime_template::GGSN__BackOffTime_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; } GGSN__BackOffTime_template::GGSN__BackOffTime_template(const GGSN__BackOffTime_template& other_value) : Base_Template() { copy_template(other_value); } GGSN__BackOffTime_template::~GGSN__BackOffTime_template() { clean_up(); } GGSN__BackOffTime_template& GGSN__BackOffTime_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } GGSN__BackOffTime_template& GGSN__BackOffTime_template::operator=(const GGSN__BackOffTime& other_value) { clean_up(); copy_value(other_value); return *this; } GGSN__BackOffTime_template& GGSN__BackOffTime_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const GGSN__BackOffTime&)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 @GTPC_Types.GGSN_BackOffTime."); } return *this; } GGSN__BackOffTime_template& GGSN__BackOffTime_template::operator=(const GGSN__BackOffTime_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean GGSN__BackOffTime_template::match(const GGSN__BackOffTime& 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.type__gtpc().is_bound()) return FALSE; if(!single_value->field_type__gtpc.match(other_value.type__gtpc(), legacy))return FALSE; if(!other_value.lengthf().is_bound()) return FALSE; if(!single_value->field_lengthf.match(other_value.lengthf(), legacy))return FALSE; if(!other_value.timerValue().is_bound()) return FALSE; if(!single_value->field_timerValue.match(other_value.timerValue(), legacy))return FALSE; if(!other_value.timerUnit().is_bound()) return FALSE; if(!single_value->field_timerUnit.match(other_value.timerUnit(), legacy))return FALSE; if(!other_value.explicitly__specified().is_bound()) return FALSE; if((other_value.explicitly__specified().ispresent() ? !single_value->field_explicitly__specified.match((const OCTETSTRING&)other_value.explicitly__specified(), legacy) : !single_value->field_explicitly__specified.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 @GTPC_Types.GGSN_BackOffTime."); } return FALSE; } boolean GGSN__BackOffTime_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_type__gtpc.is_bound() || single_value->field_lengthf.is_bound() || single_value->field_timerValue.is_bound() || single_value->field_timerUnit.is_bound() || (single_value->field_explicitly__specified.is_omit() || single_value->field_explicitly__specified.is_bound()); } boolean GGSN__BackOffTime_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_type__gtpc.is_value() && single_value->field_lengthf.is_value() && single_value->field_timerValue.is_value() && single_value->field_timerUnit.is_value() && (single_value->field_explicitly__specified.is_omit() || single_value->field_explicitly__specified.is_value()); } void GGSN__BackOffTime_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; } GGSN__BackOffTime GGSN__BackOffTime_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 @GTPC_Types.GGSN_BackOffTime."); GGSN__BackOffTime ret_val; if (single_value->field_type__gtpc.is_bound()) { ret_val.type__gtpc() = single_value->field_type__gtpc.valueof(); } if (single_value->field_lengthf.is_bound()) { ret_val.lengthf() = single_value->field_lengthf.valueof(); } if (single_value->field_timerValue.is_bound()) { ret_val.timerValue() = single_value->field_timerValue.valueof(); } if (single_value->field_timerUnit.is_bound()) { ret_val.timerUnit() = single_value->field_timerUnit.valueof(); } if (single_value->field_explicitly__specified.is_omit()) ret_val.explicitly__specified() = OMIT_VALUE; else if (single_value->field_explicitly__specified.is_bound()) { ret_val.explicitly__specified() = single_value->field_explicitly__specified.valueof(); } return ret_val; } void GGSN__BackOffTime_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 @GTPC_Types.GGSN_BackOffTime."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new GGSN__BackOffTime_template[list_length]; } GGSN__BackOffTime_template& GGSN__BackOffTime_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 @GTPC_Types.GGSN_BackOffTime."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.GGSN_BackOffTime."); return value_list.list_value[list_index]; } OCTETSTRING_template& GGSN__BackOffTime_template::type__gtpc() { set_specific(); return single_value->field_type__gtpc; } const OCTETSTRING_template& GGSN__BackOffTime_template::type__gtpc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field type_gtpc of a non-specific template of type @GTPC_Types.GGSN_BackOffTime."); return single_value->field_type__gtpc; } INTEGER_template& GGSN__BackOffTime_template::lengthf() { set_specific(); return single_value->field_lengthf; } const INTEGER_template& GGSN__BackOffTime_template::lengthf() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthf of a non-specific template of type @GTPC_Types.GGSN_BackOffTime."); return single_value->field_lengthf; } BITSTRING_template& GGSN__BackOffTime_template::timerValue() { set_specific(); return single_value->field_timerValue; } const BITSTRING_template& GGSN__BackOffTime_template::timerValue() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field timerValue of a non-specific template of type @GTPC_Types.GGSN_BackOffTime."); return single_value->field_timerValue; } BITSTRING_template& GGSN__BackOffTime_template::timerUnit() { set_specific(); return single_value->field_timerUnit; } const BITSTRING_template& GGSN__BackOffTime_template::timerUnit() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field timerUnit of a non-specific template of type @GTPC_Types.GGSN_BackOffTime."); return single_value->field_timerUnit; } OCTETSTRING_template& GGSN__BackOffTime_template::explicitly__specified() { set_specific(); return single_value->field_explicitly__specified; } const OCTETSTRING_template& GGSN__BackOffTime_template::explicitly__specified() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field explicitly_specified of a non-specific template of type @GTPC_Types.GGSN_BackOffTime."); return single_value->field_explicitly__specified; } int GGSN__BackOffTime_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.GGSN_BackOffTime which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 4; if (single_value->field_explicitly__specified.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 @GTPC_Types.GGSN_BackOffTime 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 @GTPC_Types.GGSN_BackOffTime containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.GGSN_BackOffTime containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.GGSN_BackOffTime containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.GGSN_BackOffTime containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.GGSN_BackOffTime containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.GGSN_BackOffTime containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.GGSN_BackOffTime containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.GGSN_BackOffTime."); } return 0; } void GGSN__BackOffTime_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ type_gtpc := "); single_value->field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log(); TTCN_Logger::log_event_str(", timerValue := "); single_value->field_timerValue.log(); TTCN_Logger::log_event_str(", timerUnit := "); single_value->field_timerUnit.log(); TTCN_Logger::log_event_str(", explicitly_specified := "); single_value->field_explicitly__specified.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 GGSN__BackOffTime_template::log_match(const GGSN__BackOffTime& 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_type__gtpc.match(match_value.type__gtpc(), legacy)){ TTCN_Logger::log_logmatch_info(".type_gtpc"); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lengthf.match(match_value.lengthf(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthf"); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_timerValue.match(match_value.timerValue(), legacy)){ TTCN_Logger::log_logmatch_info(".timerValue"); single_value->field_timerValue.log_match(match_value.timerValue(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_timerUnit.match(match_value.timerUnit(), legacy)){ TTCN_Logger::log_logmatch_info(".timerUnit"); single_value->field_timerUnit.log_match(match_value.timerUnit(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.explicitly__specified().ispresent()){ if(!single_value->field_explicitly__specified.match(match_value.explicitly__specified(), legacy)){ TTCN_Logger::log_logmatch_info(".explicitly_specified"); single_value->field_explicitly__specified.log_match(match_value.explicitly__specified(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_explicitly__specified.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".explicitly_specified := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_explicitly__specified.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("{ type_gtpc := "); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::log_event_str(", timerValue := "); single_value->field_timerValue.log_match(match_value.timerValue(), legacy); TTCN_Logger::log_event_str(", timerUnit := "); single_value->field_timerUnit.log_match(match_value.timerUnit(), legacy); TTCN_Logger::log_event_str(", explicitly_specified := "); if (match_value.explicitly__specified().ispresent()) { single_value->field_explicitly__specified.log_match(match_value.explicitly__specified(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_explicitly__specified.log(); if (single_value->field_explicitly__specified.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 GGSN__BackOffTime_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_type__gtpc.encode_text(text_buf); single_value->field_lengthf.encode_text(text_buf); single_value->field_timerValue.encode_text(text_buf); single_value->field_timerUnit.encode_text(text_buf); single_value->field_explicitly__specified.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 @GTPC_Types.GGSN_BackOffTime."); } } void GGSN__BackOffTime_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_type__gtpc.decode_text(text_buf); single_value->field_lengthf.decode_text(text_buf); single_value->field_timerValue.decode_text(text_buf); single_value->field_timerUnit.decode_text(text_buf); single_value->field_explicitly__specified.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 GGSN__BackOffTime_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 @GTPC_Types.GGSN_BackOffTime."); } } void GGSN__BackOffTime_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: { GGSN__BackOffTime_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) timerValue().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) timerUnit().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) explicitly__specified().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "timerValue")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { timerValue().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "timerUnit")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { timerUnit().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "explicitly_specified")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { explicitly__specified().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.GGSN_BackOffTime: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { GGSN__BackOffTime_template* precondition = new GGSN__BackOffTime_template; precondition->set_param(*param.get_elem(0)); GGSN__BackOffTime_template* implied_template = new GGSN__BackOffTime_template; implied_template->set_param(*param.get_elem(1)); *this = GGSN__BackOffTime_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.GGSN_BackOffTime"); } is_ifpresent = param.get_ifpresent(); } void GGSN__BackOffTime_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_type__gtpc.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.GGSN_BackOffTime"); single_value->field_lengthf.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.GGSN_BackOffTime"); single_value->field_timerValue.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.GGSN_BackOffTime"); single_value->field_timerUnit.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.GGSN_BackOffTime"); single_value->field_explicitly__specified.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.GGSN_BackOffTime"); 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 : "@GTPC_Types.GGSN_BackOffTime"); } boolean GGSN__BackOffTime_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean GGSN__BackOffTime_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_explicitly__specified) : field_type__gtpc(par_type__gtpc), field_lengthf(par_lengthf), field_lapi(par_lapi), field_spare(par_spare), field_explicitly__specified(par_explicitly__specified) { } SignallingPriorityIndication::SignallingPriorityIndication(const SignallingPriorityIndication& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GTPC_Types.SignallingPriorityIndication."); if (other_value.type__gtpc().is_bound()) field_type__gtpc = other_value.type__gtpc(); else field_type__gtpc.clean_up(); if (other_value.lengthf().is_bound()) field_lengthf = other_value.lengthf(); else field_lengthf.clean_up(); if (other_value.lapi().is_bound()) field_lapi = other_value.lapi(); else field_lapi.clean_up(); if (other_value.spare().is_bound()) field_spare = other_value.spare(); else field_spare.clean_up(); if (other_value.explicitly__specified().is_bound()) field_explicitly__specified = other_value.explicitly__specified(); else field_explicitly__specified.clean_up(); } void SignallingPriorityIndication::clean_up() { field_type__gtpc.clean_up(); field_lengthf.clean_up(); field_lapi.clean_up(); field_spare.clean_up(); field_explicitly__specified.clean_up(); } const TTCN_Typedescriptor_t* SignallingPriorityIndication::get_descriptor() const { return &SignallingPriorityIndication_descr_; } SignallingPriorityIndication& SignallingPriorityIndication::operator=(const SignallingPriorityIndication& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GTPC_Types.SignallingPriorityIndication."); if (other_value.type__gtpc().is_bound()) field_type__gtpc = other_value.type__gtpc(); else field_type__gtpc.clean_up(); if (other_value.lengthf().is_bound()) field_lengthf = other_value.lengthf(); else field_lengthf.clean_up(); if (other_value.lapi().is_bound()) field_lapi = other_value.lapi(); else field_lapi.clean_up(); if (other_value.spare().is_bound()) field_spare = other_value.spare(); else field_spare.clean_up(); if (other_value.explicitly__specified().is_bound()) field_explicitly__specified = other_value.explicitly__specified(); else field_explicitly__specified.clean_up(); } return *this; } boolean SignallingPriorityIndication::operator==(const SignallingPriorityIndication& other_value) const { return field_type__gtpc==other_value.field_type__gtpc && field_lengthf==other_value.field_lengthf && field_lapi==other_value.field_lapi && field_spare==other_value.field_spare && field_explicitly__specified==other_value.field_explicitly__specified; } boolean SignallingPriorityIndication::is_bound() const { return (field_type__gtpc.is_bound()) || (field_lengthf.is_bound()) || (field_lapi.is_bound()) || (field_spare.is_bound()) || (OPTIONAL_OMIT == field_explicitly__specified.get_selection() || field_explicitly__specified.is_bound()); } boolean SignallingPriorityIndication::is_value() const { return field_type__gtpc.is_value() && field_lengthf.is_value() && field_lapi.is_value() && field_spare.is_value() && (OPTIONAL_OMIT == field_explicitly__specified.get_selection() || field_explicitly__specified.is_value()); } int SignallingPriorityIndication::size_of() const { int ret_val = 4; if (field_explicitly__specified.ispresent()) ret_val++; return ret_val; } void SignallingPriorityIndication::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ type_gtpc := "); field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); field_lengthf.log(); TTCN_Logger::log_event_str(", lapi := "); field_lapi.log(); TTCN_Logger::log_event_str(", spare := "); field_spare.log(); TTCN_Logger::log_event_str(", explicitly_specified := "); field_explicitly__specified.log(); TTCN_Logger::log_event_str(" }"); } void SignallingPriorityIndication::set_implicit_omit() { if (type__gtpc().is_bound()) type__gtpc().set_implicit_omit(); if (lengthf().is_bound()) lengthf().set_implicit_omit(); if (lapi().is_bound()) lapi().set_implicit_omit(); if (spare().is_bound()) spare().set_implicit_omit(); if (!explicitly__specified().is_bound()) explicitly__specified() = OMIT_VALUE; else explicitly__specified().set_implicit_omit(); } void SignallingPriorityIndication::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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lapi().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) explicitly__specified().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lapi")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lapi().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "spare")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "explicitly_specified")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { explicitly__specified().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.SignallingPriorityIndication: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.SignallingPriorityIndication"); } } void SignallingPriorityIndication::encode_text(Text_Buf& text_buf) const { field_type__gtpc.encode_text(text_buf); field_lengthf.encode_text(text_buf); field_lapi.encode_text(text_buf); field_spare.encode_text(text_buf); field_explicitly__specified.encode_text(text_buf); } void SignallingPriorityIndication::decode_text(Text_Buf& text_buf) { field_type__gtpc.decode_text(text_buf); field_lengthf.decode_text(text_buf); field_lapi.decode_text(text_buf); field_spare.decode_text(text_buf); field_explicitly__specified.decode_text(text_buf); } void SignallingPriorityIndication::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 SignallingPriorityIndication::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 SignallingPriorityIndication::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; int value_of_length_field1 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_type__gtpc.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, SignallingPriorityIndication_lengthf_descr_.raw->forceomit); decoded_field_length = field_lengthf.RAW_decode(SignallingPriorityIndication_lengthf_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()); INTEGER tmp1 = field_lengthf.convert_to_Integer(SignallingPriorityIndication_lengthf_descr_); field_lengthf = tmp1; value_of_length_field1 += tmp1.get_long_long_val() * 8; RAW_Force_Omit field_2_force_omit(2, force_omit, General__Types::BIT1_descr_.raw->forceomit); decoded_field_length = field_lapi.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::BIT7_descr_.raw->forceomit); decoded_field_length = field_spare.RAW_decode(General__Types::BIT7_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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_field1 -= decoded_field_length; if (limit > 0 && value_of_length_field1 > 0){ if (force_omit != NULL && (*force_omit)(4)) { field_explicitly__specified = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_4_force_omit(4, force_omit, OCTETSTRING_descr_.raw->forceomit); decoded_field_length = field_explicitly__specified().RAW_decode(OCTETSTRING_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, TRUE, -1, TRUE, &field_4_force_omit); if (decoded_field_length < 1) { field_explicitly__specified = 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()); value_of_length_field1 -= decoded_field_length; } } } else field_explicitly__specified=OMIT_VALUE; if (field_type__gtpc != os_38) return -1; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int SignallingPriorityIndication::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, SignallingPriorityIndication_lengthf_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, General__Types::BIT1_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::BIT7_descr_.raw); if (field_explicitly__specified.ispresent()) { myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, OCTETSTRING_descr_.raw); } else myleaf.body.node.nodes[4] = NULL; encoded_length += field_type__gtpc.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += 16; myleaf.body.node.nodes[1]->calc = CALC_LENGTH; myleaf.body.node.nodes[1]->coding_descr = &SignallingPriorityIndication_lengthf_descr_; myleaf.body.node.nodes[1]->calcof.lengthto.num_of_fields = 3; myleaf.body.node.nodes[1]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[1]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields = init_lengthto_fields_list(3); myleaf.body.node.nodes[1]->length = 16; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[2]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[2]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].level = myleaf.body.node.nodes[3]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].pos = myleaf.body.node.nodes[3]->curr_pos.pos; if (field_explicitly__specified.ispresent()) { myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].level = myleaf.body.node.nodes[4]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].pos = myleaf.body.node.nodes[4]->curr_pos.pos; } else { myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].level = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].pos = 0; } encoded_length += field_lapi.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_spare.RAW_encode(General__Types::BIT7_descr_, *myleaf.body.node.nodes[3]); if (field_explicitly__specified.ispresent()) { encoded_length += field_explicitly__specified().RAW_encode(OCTETSTRING_descr_, *myleaf.body.node.nodes[4]); } if (field_type__gtpc != os_38) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={0}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ os_38.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 SignallingPriorityIndication_template::single_value_struct { OCTETSTRING_template field_type__gtpc; INTEGER_template field_lengthf; BITSTRING_template field_lapi; BITSTRING_template field_spare; OCTETSTRING_template field_explicitly__specified; }; void SignallingPriorityIndication_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_type__gtpc = ANY_VALUE; single_value->field_lengthf = ANY_VALUE; single_value->field_lapi = ANY_VALUE; single_value->field_spare = ANY_VALUE; single_value->field_explicitly__specified = ANY_OR_OMIT; } } } void SignallingPriorityIndication_template::copy_value(const SignallingPriorityIndication& other_value) { single_value = new single_value_struct; if (other_value.type__gtpc().is_bound()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (other_value.lengthf().is_bound()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (other_value.lapi().is_bound()) { single_value->field_lapi = other_value.lapi(); } else { single_value->field_lapi.clean_up(); } if (other_value.spare().is_bound()) { single_value->field_spare = other_value.spare(); } else { single_value->field_spare.clean_up(); } if (other_value.explicitly__specified().is_bound()) { if (other_value.explicitly__specified().ispresent()) single_value->field_explicitly__specified = other_value.explicitly__specified()(); else single_value->field_explicitly__specified = OMIT_VALUE; } else { single_value->field_explicitly__specified.clean_up(); } set_selection(SPECIFIC_VALUE); } void SignallingPriorityIndication_template::copy_template(const SignallingPriorityIndication_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.type__gtpc().get_selection()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lengthf().get_selection()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lapi().get_selection()) { single_value->field_lapi = other_value.lapi(); } else { single_value->field_lapi.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.spare().get_selection()) { single_value->field_spare = other_value.spare(); } else { single_value->field_spare.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.explicitly__specified().get_selection()) { single_value->field_explicitly__specified = other_value.explicitly__specified(); } else { single_value->field_explicitly__specified.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 SignallingPriorityIndication_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 SignallingPriorityIndication_template(*other_value.implication_.precondition); implication_.implied_template = new SignallingPriorityIndication_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 @GTPC_Types.SignallingPriorityIndication."); break; } set_selection(other_value); } SignallingPriorityIndication_template::SignallingPriorityIndication_template() { } SignallingPriorityIndication_template::SignallingPriorityIndication_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } SignallingPriorityIndication_template::SignallingPriorityIndication_template(const SignallingPriorityIndication& other_value) { copy_value(other_value); } SignallingPriorityIndication_template::SignallingPriorityIndication_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SignallingPriorityIndication&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.SignallingPriorityIndication from an unbound optional field."); } } SignallingPriorityIndication_template::SignallingPriorityIndication_template(SignallingPriorityIndication_template* p_precondition, SignallingPriorityIndication_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } SignallingPriorityIndication_template::SignallingPriorityIndication_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; } SignallingPriorityIndication_template::SignallingPriorityIndication_template(const SignallingPriorityIndication_template& other_value) : Base_Template() { copy_template(other_value); } SignallingPriorityIndication_template::~SignallingPriorityIndication_template() { clean_up(); } SignallingPriorityIndication_template& SignallingPriorityIndication_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } SignallingPriorityIndication_template& SignallingPriorityIndication_template::operator=(const SignallingPriorityIndication& other_value) { clean_up(); copy_value(other_value); return *this; } SignallingPriorityIndication_template& SignallingPriorityIndication_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SignallingPriorityIndication&)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 @GTPC_Types.SignallingPriorityIndication."); } return *this; } SignallingPriorityIndication_template& SignallingPriorityIndication_template::operator=(const SignallingPriorityIndication_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean SignallingPriorityIndication_template::match(const SignallingPriorityIndication& 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.type__gtpc().is_bound()) return FALSE; if(!single_value->field_type__gtpc.match(other_value.type__gtpc(), legacy))return FALSE; if(!other_value.lengthf().is_bound()) return FALSE; if(!single_value->field_lengthf.match(other_value.lengthf(), legacy))return FALSE; if(!other_value.lapi().is_bound()) return FALSE; if(!single_value->field_lapi.match(other_value.lapi(), legacy))return FALSE; if(!other_value.spare().is_bound()) return FALSE; if(!single_value->field_spare.match(other_value.spare(), legacy))return FALSE; if(!other_value.explicitly__specified().is_bound()) return FALSE; if((other_value.explicitly__specified().ispresent() ? !single_value->field_explicitly__specified.match((const OCTETSTRING&)other_value.explicitly__specified(), legacy) : !single_value->field_explicitly__specified.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 @GTPC_Types.SignallingPriorityIndication."); } return FALSE; } boolean SignallingPriorityIndication_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_type__gtpc.is_bound() || single_value->field_lengthf.is_bound() || single_value->field_lapi.is_bound() || single_value->field_spare.is_bound() || (single_value->field_explicitly__specified.is_omit() || single_value->field_explicitly__specified.is_bound()); } boolean SignallingPriorityIndication_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_type__gtpc.is_value() && single_value->field_lengthf.is_value() && single_value->field_lapi.is_value() && single_value->field_spare.is_value() && (single_value->field_explicitly__specified.is_omit() || single_value->field_explicitly__specified.is_value()); } void SignallingPriorityIndication_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; } SignallingPriorityIndication SignallingPriorityIndication_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 @GTPC_Types.SignallingPriorityIndication."); SignallingPriorityIndication ret_val; if (single_value->field_type__gtpc.is_bound()) { ret_val.type__gtpc() = single_value->field_type__gtpc.valueof(); } if (single_value->field_lengthf.is_bound()) { ret_val.lengthf() = single_value->field_lengthf.valueof(); } if (single_value->field_lapi.is_bound()) { ret_val.lapi() = single_value->field_lapi.valueof(); } if (single_value->field_spare.is_bound()) { ret_val.spare() = single_value->field_spare.valueof(); } if (single_value->field_explicitly__specified.is_omit()) ret_val.explicitly__specified() = OMIT_VALUE; else if (single_value->field_explicitly__specified.is_bound()) { ret_val.explicitly__specified() = single_value->field_explicitly__specified.valueof(); } return ret_val; } void SignallingPriorityIndication_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 @GTPC_Types.SignallingPriorityIndication."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new SignallingPriorityIndication_template[list_length]; } SignallingPriorityIndication_template& SignallingPriorityIndication_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 @GTPC_Types.SignallingPriorityIndication."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.SignallingPriorityIndication."); return value_list.list_value[list_index]; } OCTETSTRING_template& SignallingPriorityIndication_template::type__gtpc() { set_specific(); return single_value->field_type__gtpc; } const OCTETSTRING_template& SignallingPriorityIndication_template::type__gtpc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field type_gtpc of a non-specific template of type @GTPC_Types.SignallingPriorityIndication."); return single_value->field_type__gtpc; } INTEGER_template& SignallingPriorityIndication_template::lengthf() { set_specific(); return single_value->field_lengthf; } const INTEGER_template& SignallingPriorityIndication_template::lengthf() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthf of a non-specific template of type @GTPC_Types.SignallingPriorityIndication."); return single_value->field_lengthf; } BITSTRING_template& SignallingPriorityIndication_template::lapi() { set_specific(); return single_value->field_lapi; } const BITSTRING_template& SignallingPriorityIndication_template::lapi() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lapi of a non-specific template of type @GTPC_Types.SignallingPriorityIndication."); return single_value->field_lapi; } BITSTRING_template& SignallingPriorityIndication_template::spare() { set_specific(); return single_value->field_spare; } const BITSTRING_template& SignallingPriorityIndication_template::spare() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field spare of a non-specific template of type @GTPC_Types.SignallingPriorityIndication."); return single_value->field_spare; } OCTETSTRING_template& SignallingPriorityIndication_template::explicitly__specified() { set_specific(); return single_value->field_explicitly__specified; } const OCTETSTRING_template& SignallingPriorityIndication_template::explicitly__specified() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field explicitly_specified of a non-specific template of type @GTPC_Types.SignallingPriorityIndication."); return single_value->field_explicitly__specified; } int SignallingPriorityIndication_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.SignallingPriorityIndication which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 4; if (single_value->field_explicitly__specified.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 @GTPC_Types.SignallingPriorityIndication 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 @GTPC_Types.SignallingPriorityIndication containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.SignallingPriorityIndication containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.SignallingPriorityIndication containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.SignallingPriorityIndication containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.SignallingPriorityIndication containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.SignallingPriorityIndication containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.SignallingPriorityIndication containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.SignallingPriorityIndication."); } return 0; } void SignallingPriorityIndication_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ type_gtpc := "); single_value->field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log(); TTCN_Logger::log_event_str(", lapi := "); single_value->field_lapi.log(); TTCN_Logger::log_event_str(", spare := "); single_value->field_spare.log(); TTCN_Logger::log_event_str(", explicitly_specified := "); single_value->field_explicitly__specified.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 SignallingPriorityIndication_template::log_match(const SignallingPriorityIndication& 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_type__gtpc.match(match_value.type__gtpc(), legacy)){ TTCN_Logger::log_logmatch_info(".type_gtpc"); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lengthf.match(match_value.lengthf(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthf"); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lapi.match(match_value.lapi(), legacy)){ TTCN_Logger::log_logmatch_info(".lapi"); single_value->field_lapi.log_match(match_value.lapi(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_spare.match(match_value.spare(), legacy)){ TTCN_Logger::log_logmatch_info(".spare"); single_value->field_spare.log_match(match_value.spare(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.explicitly__specified().ispresent()){ if(!single_value->field_explicitly__specified.match(match_value.explicitly__specified(), legacy)){ TTCN_Logger::log_logmatch_info(".explicitly_specified"); single_value->field_explicitly__specified.log_match(match_value.explicitly__specified(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_explicitly__specified.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".explicitly_specified := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_explicitly__specified.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("{ type_gtpc := "); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::log_event_str(", lapi := "); single_value->field_lapi.log_match(match_value.lapi(), legacy); TTCN_Logger::log_event_str(", spare := "); single_value->field_spare.log_match(match_value.spare(), legacy); TTCN_Logger::log_event_str(", explicitly_specified := "); if (match_value.explicitly__specified().ispresent()) { single_value->field_explicitly__specified.log_match(match_value.explicitly__specified(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_explicitly__specified.log(); if (single_value->field_explicitly__specified.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 SignallingPriorityIndication_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_type__gtpc.encode_text(text_buf); single_value->field_lengthf.encode_text(text_buf); single_value->field_lapi.encode_text(text_buf); single_value->field_spare.encode_text(text_buf); single_value->field_explicitly__specified.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 @GTPC_Types.SignallingPriorityIndication."); } } void SignallingPriorityIndication_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_type__gtpc.decode_text(text_buf); single_value->field_lengthf.decode_text(text_buf); single_value->field_lapi.decode_text(text_buf); single_value->field_spare.decode_text(text_buf); single_value->field_explicitly__specified.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 SignallingPriorityIndication_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 @GTPC_Types.SignallingPriorityIndication."); } } void SignallingPriorityIndication_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: { SignallingPriorityIndication_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) lapi().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) explicitly__specified().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lapi")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lapi().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "spare")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "explicitly_specified")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { explicitly__specified().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.SignallingPriorityIndication: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { SignallingPriorityIndication_template* precondition = new SignallingPriorityIndication_template; precondition->set_param(*param.get_elem(0)); SignallingPriorityIndication_template* implied_template = new SignallingPriorityIndication_template; implied_template->set_param(*param.get_elem(1)); *this = SignallingPriorityIndication_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.SignallingPriorityIndication"); } is_ifpresent = param.get_ifpresent(); } void SignallingPriorityIndication_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_type__gtpc.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.SignallingPriorityIndication"); single_value->field_lengthf.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.SignallingPriorityIndication"); single_value->field_lapi.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.SignallingPriorityIndication"); single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.SignallingPriorityIndication"); single_value->field_explicitly__specified.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.SignallingPriorityIndication"); 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 : "@GTPC_Types.SignallingPriorityIndication"); } boolean SignallingPriorityIndication_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean SignallingPriorityIndication_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_explicitly__specified) : field_type__gtpc(par_type__gtpc), field_lengthf(par_lengthf), field_nsapi(par_nsapi), field_spare1(par_spare1), field_lapi(par_lapi), field_spare2(par_spare2), field_explicitly__specified(par_explicitly__specified) { } SignallingPriorityIndication__NSAPI::SignallingPriorityIndication__NSAPI(const SignallingPriorityIndication__NSAPI& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GTPC_Types.SignallingPriorityIndication_NSAPI."); if (other_value.type__gtpc().is_bound()) field_type__gtpc = other_value.type__gtpc(); else field_type__gtpc.clean_up(); if (other_value.lengthf().is_bound()) field_lengthf = other_value.lengthf(); else field_lengthf.clean_up(); if (other_value.nsapi().is_bound()) field_nsapi = other_value.nsapi(); else field_nsapi.clean_up(); if (other_value.spare1().is_bound()) field_spare1 = other_value.spare1(); else field_spare1.clean_up(); if (other_value.lapi().is_bound()) field_lapi = other_value.lapi(); else field_lapi.clean_up(); if (other_value.spare2().is_bound()) field_spare2 = other_value.spare2(); else field_spare2.clean_up(); if (other_value.explicitly__specified().is_bound()) field_explicitly__specified = other_value.explicitly__specified(); else field_explicitly__specified.clean_up(); } void SignallingPriorityIndication__NSAPI::clean_up() { field_type__gtpc.clean_up(); field_lengthf.clean_up(); field_nsapi.clean_up(); field_spare1.clean_up(); field_lapi.clean_up(); field_spare2.clean_up(); field_explicitly__specified.clean_up(); } const TTCN_Typedescriptor_t* SignallingPriorityIndication__NSAPI::get_descriptor() const { return &SignallingPriorityIndication__NSAPI_descr_; } SignallingPriorityIndication__NSAPI& SignallingPriorityIndication__NSAPI::operator=(const SignallingPriorityIndication__NSAPI& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GTPC_Types.SignallingPriorityIndication_NSAPI."); if (other_value.type__gtpc().is_bound()) field_type__gtpc = other_value.type__gtpc(); else field_type__gtpc.clean_up(); if (other_value.lengthf().is_bound()) field_lengthf = other_value.lengthf(); else field_lengthf.clean_up(); if (other_value.nsapi().is_bound()) field_nsapi = other_value.nsapi(); else field_nsapi.clean_up(); if (other_value.spare1().is_bound()) field_spare1 = other_value.spare1(); else field_spare1.clean_up(); if (other_value.lapi().is_bound()) field_lapi = other_value.lapi(); else field_lapi.clean_up(); if (other_value.spare2().is_bound()) field_spare2 = other_value.spare2(); else field_spare2.clean_up(); if (other_value.explicitly__specified().is_bound()) field_explicitly__specified = other_value.explicitly__specified(); else field_explicitly__specified.clean_up(); } return *this; } boolean SignallingPriorityIndication__NSAPI::operator==(const SignallingPriorityIndication__NSAPI& other_value) const { return field_type__gtpc==other_value.field_type__gtpc && field_lengthf==other_value.field_lengthf && field_nsapi==other_value.field_nsapi && field_spare1==other_value.field_spare1 && field_lapi==other_value.field_lapi && field_spare2==other_value.field_spare2 && field_explicitly__specified==other_value.field_explicitly__specified; } boolean SignallingPriorityIndication__NSAPI::is_bound() const { return (field_type__gtpc.is_bound()) || (field_lengthf.is_bound()) || (field_nsapi.is_bound()) || (field_spare1.is_bound()) || (field_lapi.is_bound()) || (field_spare2.is_bound()) || (OPTIONAL_OMIT == field_explicitly__specified.get_selection() || field_explicitly__specified.is_bound()); } boolean SignallingPriorityIndication__NSAPI::is_value() const { return field_type__gtpc.is_value() && field_lengthf.is_value() && field_nsapi.is_value() && field_spare1.is_value() && field_lapi.is_value() && field_spare2.is_value() && (OPTIONAL_OMIT == field_explicitly__specified.get_selection() || field_explicitly__specified.is_value()); } int SignallingPriorityIndication__NSAPI::size_of() const { int ret_val = 6; if (field_explicitly__specified.ispresent()) ret_val++; return ret_val; } void SignallingPriorityIndication__NSAPI::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ type_gtpc := "); field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); field_lengthf.log(); TTCN_Logger::log_event_str(", nsapi := "); field_nsapi.log(); TTCN_Logger::log_event_str(", spare1 := "); field_spare1.log(); TTCN_Logger::log_event_str(", lapi := "); field_lapi.log(); TTCN_Logger::log_event_str(", spare2 := "); field_spare2.log(); TTCN_Logger::log_event_str(", explicitly_specified := "); field_explicitly__specified.log(); TTCN_Logger::log_event_str(" }"); } void SignallingPriorityIndication__NSAPI::set_implicit_omit() { if (type__gtpc().is_bound()) type__gtpc().set_implicit_omit(); if (lengthf().is_bound()) lengthf().set_implicit_omit(); if (nsapi().is_bound()) nsapi().set_implicit_omit(); if (spare1().is_bound()) spare1().set_implicit_omit(); if (lapi().is_bound()) lapi().set_implicit_omit(); if (spare2().is_bound()) spare2().set_implicit_omit(); if (!explicitly__specified().is_bound()) explicitly__specified() = OMIT_VALUE; else explicitly__specified().set_implicit_omit(); } void SignallingPriorityIndication__NSAPI::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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) nsapi().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) spare1().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) lapi().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) spare2().set_param(*param.get_elem(5)); if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) explicitly__specified().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nsapi")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsapi().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "spare1")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare1().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lapi")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lapi().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "spare2")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare2().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "explicitly_specified")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { explicitly__specified().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.SignallingPriorityIndication_NSAPI: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.SignallingPriorityIndication_NSAPI"); } } void SignallingPriorityIndication__NSAPI::encode_text(Text_Buf& text_buf) const { field_type__gtpc.encode_text(text_buf); field_lengthf.encode_text(text_buf); field_nsapi.encode_text(text_buf); field_spare1.encode_text(text_buf); field_lapi.encode_text(text_buf); field_spare2.encode_text(text_buf); field_explicitly__specified.encode_text(text_buf); } void SignallingPriorityIndication__NSAPI::decode_text(Text_Buf& text_buf) { field_type__gtpc.decode_text(text_buf); field_lengthf.decode_text(text_buf); field_nsapi.decode_text(text_buf); field_spare1.decode_text(text_buf); field_lapi.decode_text(text_buf); field_spare2.decode_text(text_buf); field_explicitly__specified.decode_text(text_buf); } void SignallingPriorityIndication__NSAPI::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 SignallingPriorityIndication__NSAPI::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 SignallingPriorityIndication__NSAPI::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; int value_of_length_field1 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_type__gtpc.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, SignallingPriorityIndication__NSAPI_lengthf_descr_.raw->forceomit); decoded_field_length = field_lengthf.RAW_decode(SignallingPriorityIndication__NSAPI_lengthf_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()); INTEGER tmp1 = field_lengthf.convert_to_Integer(SignallingPriorityIndication__NSAPI_lengthf_descr_); field_lengthf = tmp1; value_of_length_field1 += tmp1.get_long_long_val() * 8; RAW_Force_Omit field_2_force_omit(2, force_omit, General__Types::BIT1_descr_.raw->forceomit); decoded_field_length = field_nsapi.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::BIT7_descr_.raw->forceomit); decoded_field_length = field_spare1.RAW_decode(General__Types::BIT7_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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_field1 -= decoded_field_length; RAW_Force_Omit field_4_force_omit(4, force_omit, General__Types::BIT1_descr_.raw->forceomit); decoded_field_length = field_lapi.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, no_err, -1, TRUE, &field_4_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_5_force_omit(5, force_omit, General__Types::BIT7_descr_.raw->forceomit); decoded_field_length = field_spare2.RAW_decode(General__Types::BIT7_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, no_err, -1, TRUE, &field_5_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); value_of_length_field1 -= decoded_field_length; if (limit > 0 && value_of_length_field1 > 0){ if (force_omit != NULL && (*force_omit)(6)) { field_explicitly__specified = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_6_force_omit(6, force_omit, OCTETSTRING_descr_.raw->forceomit); decoded_field_length = field_explicitly__specified().RAW_decode(OCTETSTRING_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, TRUE, -1, TRUE, &field_6_force_omit); if (decoded_field_length < 1) { field_explicitly__specified = 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()); value_of_length_field1 -= decoded_field_length; } } } else field_explicitly__specified=OMIT_VALUE; if (field_type__gtpc != os_76) return -1; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int SignallingPriorityIndication__NSAPI::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, SignallingPriorityIndication__NSAPI_lengthf_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, General__Types::BIT1_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::BIT7_descr_.raw); myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, General__Types::BIT1_descr_.raw); myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, General__Types::BIT7_descr_.raw); if (field_explicitly__specified.ispresent()) { myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, OCTETSTRING_descr_.raw); } else myleaf.body.node.nodes[6] = NULL; encoded_length += field_type__gtpc.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += 16; myleaf.body.node.nodes[1]->calc = CALC_LENGTH; myleaf.body.node.nodes[1]->coding_descr = &SignallingPriorityIndication__NSAPI_lengthf_descr_; myleaf.body.node.nodes[1]->calcof.lengthto.num_of_fields = 5; myleaf.body.node.nodes[1]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[1]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields = init_lengthto_fields_list(5); myleaf.body.node.nodes[1]->length = 16; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[2]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[2]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].level = myleaf.body.node.nodes[3]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].pos = myleaf.body.node.nodes[3]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].level = myleaf.body.node.nodes[4]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].pos = myleaf.body.node.nodes[4]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[3].level = myleaf.body.node.nodes[5]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[3].pos = myleaf.body.node.nodes[5]->curr_pos.pos; if (field_explicitly__specified.ispresent()) { myleaf.body.node.nodes[1]->calcof.lengthto.fields[4].level = myleaf.body.node.nodes[6]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[4].pos = myleaf.body.node.nodes[6]->curr_pos.pos; } else { myleaf.body.node.nodes[1]->calcof.lengthto.fields[4].level = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields[4].pos = 0; } encoded_length += field_nsapi.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_spare1.RAW_encode(General__Types::BIT7_descr_, *myleaf.body.node.nodes[3]); encoded_length += field_lapi.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[4]); encoded_length += field_spare2.RAW_encode(General__Types::BIT7_descr_, *myleaf.body.node.nodes[5]); if (field_explicitly__specified.ispresent()) { encoded_length += field_explicitly__specified().RAW_encode(OCTETSTRING_descr_, *myleaf.body.node.nodes[6]); } if (field_type__gtpc != os_76) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={0}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ os_76.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 SignallingPriorityIndication__NSAPI_template::single_value_struct { OCTETSTRING_template field_type__gtpc; INTEGER_template field_lengthf; BITSTRING_template field_nsapi; BITSTRING_template field_spare1; BITSTRING_template field_lapi; BITSTRING_template field_spare2; OCTETSTRING_template field_explicitly__specified; }; void SignallingPriorityIndication__NSAPI_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_type__gtpc = ANY_VALUE; single_value->field_lengthf = ANY_VALUE; single_value->field_nsapi = ANY_VALUE; single_value->field_spare1 = ANY_VALUE; single_value->field_lapi = ANY_VALUE; single_value->field_spare2 = ANY_VALUE; single_value->field_explicitly__specified = ANY_OR_OMIT; } } } void SignallingPriorityIndication__NSAPI_template::copy_value(const SignallingPriorityIndication__NSAPI& other_value) { single_value = new single_value_struct; if (other_value.type__gtpc().is_bound()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (other_value.lengthf().is_bound()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (other_value.nsapi().is_bound()) { single_value->field_nsapi = other_value.nsapi(); } else { single_value->field_nsapi.clean_up(); } if (other_value.spare1().is_bound()) { single_value->field_spare1 = other_value.spare1(); } else { single_value->field_spare1.clean_up(); } if (other_value.lapi().is_bound()) { single_value->field_lapi = other_value.lapi(); } else { single_value->field_lapi.clean_up(); } if (other_value.spare2().is_bound()) { single_value->field_spare2 = other_value.spare2(); } else { single_value->field_spare2.clean_up(); } if (other_value.explicitly__specified().is_bound()) { if (other_value.explicitly__specified().ispresent()) single_value->field_explicitly__specified = other_value.explicitly__specified()(); else single_value->field_explicitly__specified = OMIT_VALUE; } else { single_value->field_explicitly__specified.clean_up(); } set_selection(SPECIFIC_VALUE); } void SignallingPriorityIndication__NSAPI_template::copy_template(const SignallingPriorityIndication__NSAPI_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.type__gtpc().get_selection()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lengthf().get_selection()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.nsapi().get_selection()) { single_value->field_nsapi = other_value.nsapi(); } else { single_value->field_nsapi.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.spare1().get_selection()) { single_value->field_spare1 = other_value.spare1(); } else { single_value->field_spare1.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lapi().get_selection()) { single_value->field_lapi = other_value.lapi(); } else { single_value->field_lapi.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.spare2().get_selection()) { single_value->field_spare2 = other_value.spare2(); } else { single_value->field_spare2.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.explicitly__specified().get_selection()) { single_value->field_explicitly__specified = other_value.explicitly__specified(); } else { single_value->field_explicitly__specified.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 SignallingPriorityIndication__NSAPI_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 SignallingPriorityIndication__NSAPI_template(*other_value.implication_.precondition); implication_.implied_template = new SignallingPriorityIndication__NSAPI_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 @GTPC_Types.SignallingPriorityIndication_NSAPI."); break; } set_selection(other_value); } SignallingPriorityIndication__NSAPI_template::SignallingPriorityIndication__NSAPI_template() { } SignallingPriorityIndication__NSAPI_template::SignallingPriorityIndication__NSAPI_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } SignallingPriorityIndication__NSAPI_template::SignallingPriorityIndication__NSAPI_template(const SignallingPriorityIndication__NSAPI& other_value) { copy_value(other_value); } SignallingPriorityIndication__NSAPI_template::SignallingPriorityIndication__NSAPI_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SignallingPriorityIndication__NSAPI&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.SignallingPriorityIndication_NSAPI from an unbound optional field."); } } SignallingPriorityIndication__NSAPI_template::SignallingPriorityIndication__NSAPI_template(SignallingPriorityIndication__NSAPI_template* p_precondition, SignallingPriorityIndication__NSAPI_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } SignallingPriorityIndication__NSAPI_template::SignallingPriorityIndication__NSAPI_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; } SignallingPriorityIndication__NSAPI_template::SignallingPriorityIndication__NSAPI_template(const SignallingPriorityIndication__NSAPI_template& other_value) : Base_Template() { copy_template(other_value); } SignallingPriorityIndication__NSAPI_template::~SignallingPriorityIndication__NSAPI_template() { clean_up(); } SignallingPriorityIndication__NSAPI_template& SignallingPriorityIndication__NSAPI_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } SignallingPriorityIndication__NSAPI_template& SignallingPriorityIndication__NSAPI_template::operator=(const SignallingPriorityIndication__NSAPI& other_value) { clean_up(); copy_value(other_value); return *this; } SignallingPriorityIndication__NSAPI_template& SignallingPriorityIndication__NSAPI_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SignallingPriorityIndication__NSAPI&)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 @GTPC_Types.SignallingPriorityIndication_NSAPI."); } return *this; } SignallingPriorityIndication__NSAPI_template& SignallingPriorityIndication__NSAPI_template::operator=(const SignallingPriorityIndication__NSAPI_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean SignallingPriorityIndication__NSAPI_template::match(const SignallingPriorityIndication__NSAPI& 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.type__gtpc().is_bound()) return FALSE; if(!single_value->field_type__gtpc.match(other_value.type__gtpc(), legacy))return FALSE; if(!other_value.lengthf().is_bound()) return FALSE; if(!single_value->field_lengthf.match(other_value.lengthf(), legacy))return FALSE; if(!other_value.nsapi().is_bound()) return FALSE; if(!single_value->field_nsapi.match(other_value.nsapi(), legacy))return FALSE; if(!other_value.spare1().is_bound()) return FALSE; if(!single_value->field_spare1.match(other_value.spare1(), legacy))return FALSE; if(!other_value.lapi().is_bound()) return FALSE; if(!single_value->field_lapi.match(other_value.lapi(), legacy))return FALSE; if(!other_value.spare2().is_bound()) return FALSE; if(!single_value->field_spare2.match(other_value.spare2(), legacy))return FALSE; if(!other_value.explicitly__specified().is_bound()) return FALSE; if((other_value.explicitly__specified().ispresent() ? !single_value->field_explicitly__specified.match((const OCTETSTRING&)other_value.explicitly__specified(), legacy) : !single_value->field_explicitly__specified.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 @GTPC_Types.SignallingPriorityIndication_NSAPI."); } return FALSE; } boolean SignallingPriorityIndication__NSAPI_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_type__gtpc.is_bound() || single_value->field_lengthf.is_bound() || single_value->field_nsapi.is_bound() || single_value->field_spare1.is_bound() || single_value->field_lapi.is_bound() || single_value->field_spare2.is_bound() || (single_value->field_explicitly__specified.is_omit() || single_value->field_explicitly__specified.is_bound()); } boolean SignallingPriorityIndication__NSAPI_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_type__gtpc.is_value() && single_value->field_lengthf.is_value() && single_value->field_nsapi.is_value() && single_value->field_spare1.is_value() && single_value->field_lapi.is_value() && single_value->field_spare2.is_value() && (single_value->field_explicitly__specified.is_omit() || single_value->field_explicitly__specified.is_value()); } void SignallingPriorityIndication__NSAPI_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; } SignallingPriorityIndication__NSAPI SignallingPriorityIndication__NSAPI_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 @GTPC_Types.SignallingPriorityIndication_NSAPI."); SignallingPriorityIndication__NSAPI ret_val; if (single_value->field_type__gtpc.is_bound()) { ret_val.type__gtpc() = single_value->field_type__gtpc.valueof(); } if (single_value->field_lengthf.is_bound()) { ret_val.lengthf() = single_value->field_lengthf.valueof(); } if (single_value->field_nsapi.is_bound()) { ret_val.nsapi() = single_value->field_nsapi.valueof(); } if (single_value->field_spare1.is_bound()) { ret_val.spare1() = single_value->field_spare1.valueof(); } if (single_value->field_lapi.is_bound()) { ret_val.lapi() = single_value->field_lapi.valueof(); } if (single_value->field_spare2.is_bound()) { ret_val.spare2() = single_value->field_spare2.valueof(); } if (single_value->field_explicitly__specified.is_omit()) ret_val.explicitly__specified() = OMIT_VALUE; else if (single_value->field_explicitly__specified.is_bound()) { ret_val.explicitly__specified() = single_value->field_explicitly__specified.valueof(); } return ret_val; } void SignallingPriorityIndication__NSAPI_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 @GTPC_Types.SignallingPriorityIndication_NSAPI."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new SignallingPriorityIndication__NSAPI_template[list_length]; } SignallingPriorityIndication__NSAPI_template& SignallingPriorityIndication__NSAPI_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 @GTPC_Types.SignallingPriorityIndication_NSAPI."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.SignallingPriorityIndication_NSAPI."); return value_list.list_value[list_index]; } OCTETSTRING_template& SignallingPriorityIndication__NSAPI_template::type__gtpc() { set_specific(); return single_value->field_type__gtpc; } const OCTETSTRING_template& SignallingPriorityIndication__NSAPI_template::type__gtpc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field type_gtpc of a non-specific template of type @GTPC_Types.SignallingPriorityIndication_NSAPI."); return single_value->field_type__gtpc; } INTEGER_template& SignallingPriorityIndication__NSAPI_template::lengthf() { set_specific(); return single_value->field_lengthf; } const INTEGER_template& SignallingPriorityIndication__NSAPI_template::lengthf() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthf of a non-specific template of type @GTPC_Types.SignallingPriorityIndication_NSAPI."); return single_value->field_lengthf; } BITSTRING_template& SignallingPriorityIndication__NSAPI_template::nsapi() { set_specific(); return single_value->field_nsapi; } const BITSTRING_template& SignallingPriorityIndication__NSAPI_template::nsapi() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nsapi of a non-specific template of type @GTPC_Types.SignallingPriorityIndication_NSAPI."); return single_value->field_nsapi; } BITSTRING_template& SignallingPriorityIndication__NSAPI_template::spare1() { set_specific(); return single_value->field_spare1; } const BITSTRING_template& SignallingPriorityIndication__NSAPI_template::spare1() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field spare1 of a non-specific template of type @GTPC_Types.SignallingPriorityIndication_NSAPI."); return single_value->field_spare1; } BITSTRING_template& SignallingPriorityIndication__NSAPI_template::lapi() { set_specific(); return single_value->field_lapi; } const BITSTRING_template& SignallingPriorityIndication__NSAPI_template::lapi() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lapi of a non-specific template of type @GTPC_Types.SignallingPriorityIndication_NSAPI."); return single_value->field_lapi; } BITSTRING_template& SignallingPriorityIndication__NSAPI_template::spare2() { set_specific(); return single_value->field_spare2; } const BITSTRING_template& SignallingPriorityIndication__NSAPI_template::spare2() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field spare2 of a non-specific template of type @GTPC_Types.SignallingPriorityIndication_NSAPI."); return single_value->field_spare2; } OCTETSTRING_template& SignallingPriorityIndication__NSAPI_template::explicitly__specified() { set_specific(); return single_value->field_explicitly__specified; } const OCTETSTRING_template& SignallingPriorityIndication__NSAPI_template::explicitly__specified() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field explicitly_specified of a non-specific template of type @GTPC_Types.SignallingPriorityIndication_NSAPI."); return single_value->field_explicitly__specified; } int SignallingPriorityIndication__NSAPI_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.SignallingPriorityIndication_NSAPI which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 6; if (single_value->field_explicitly__specified.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 @GTPC_Types.SignallingPriorityIndication_NSAPI 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 @GTPC_Types.SignallingPriorityIndication_NSAPI containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.SignallingPriorityIndication_NSAPI containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.SignallingPriorityIndication_NSAPI containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.SignallingPriorityIndication_NSAPI containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.SignallingPriorityIndication_NSAPI containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.SignallingPriorityIndication_NSAPI containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.SignallingPriorityIndication_NSAPI containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.SignallingPriorityIndication_NSAPI."); } return 0; } void SignallingPriorityIndication__NSAPI_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ type_gtpc := "); single_value->field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log(); TTCN_Logger::log_event_str(", nsapi := "); single_value->field_nsapi.log(); TTCN_Logger::log_event_str(", spare1 := "); single_value->field_spare1.log(); TTCN_Logger::log_event_str(", lapi := "); single_value->field_lapi.log(); TTCN_Logger::log_event_str(", spare2 := "); single_value->field_spare2.log(); TTCN_Logger::log_event_str(", explicitly_specified := "); single_value->field_explicitly__specified.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 SignallingPriorityIndication__NSAPI_template::log_match(const SignallingPriorityIndication__NSAPI& 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_type__gtpc.match(match_value.type__gtpc(), legacy)){ TTCN_Logger::log_logmatch_info(".type_gtpc"); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lengthf.match(match_value.lengthf(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthf"); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_nsapi.match(match_value.nsapi(), legacy)){ TTCN_Logger::log_logmatch_info(".nsapi"); single_value->field_nsapi.log_match(match_value.nsapi(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_spare1.match(match_value.spare1(), legacy)){ TTCN_Logger::log_logmatch_info(".spare1"); single_value->field_spare1.log_match(match_value.spare1(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lapi.match(match_value.lapi(), legacy)){ TTCN_Logger::log_logmatch_info(".lapi"); single_value->field_lapi.log_match(match_value.lapi(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_spare2.match(match_value.spare2(), legacy)){ TTCN_Logger::log_logmatch_info(".spare2"); single_value->field_spare2.log_match(match_value.spare2(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.explicitly__specified().ispresent()){ if(!single_value->field_explicitly__specified.match(match_value.explicitly__specified(), legacy)){ TTCN_Logger::log_logmatch_info(".explicitly_specified"); single_value->field_explicitly__specified.log_match(match_value.explicitly__specified(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_explicitly__specified.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".explicitly_specified := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_explicitly__specified.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("{ type_gtpc := "); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::log_event_str(", nsapi := "); single_value->field_nsapi.log_match(match_value.nsapi(), legacy); TTCN_Logger::log_event_str(", spare1 := "); single_value->field_spare1.log_match(match_value.spare1(), legacy); TTCN_Logger::log_event_str(", lapi := "); single_value->field_lapi.log_match(match_value.lapi(), legacy); TTCN_Logger::log_event_str(", spare2 := "); single_value->field_spare2.log_match(match_value.spare2(), legacy); TTCN_Logger::log_event_str(", explicitly_specified := "); if (match_value.explicitly__specified().ispresent()) { single_value->field_explicitly__specified.log_match(match_value.explicitly__specified(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_explicitly__specified.log(); if (single_value->field_explicitly__specified.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 SignallingPriorityIndication__NSAPI_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_type__gtpc.encode_text(text_buf); single_value->field_lengthf.encode_text(text_buf); single_value->field_nsapi.encode_text(text_buf); single_value->field_spare1.encode_text(text_buf); single_value->field_lapi.encode_text(text_buf); single_value->field_spare2.encode_text(text_buf); single_value->field_explicitly__specified.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 @GTPC_Types.SignallingPriorityIndication_NSAPI."); } } void SignallingPriorityIndication__NSAPI_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_type__gtpc.decode_text(text_buf); single_value->field_lengthf.decode_text(text_buf); single_value->field_nsapi.decode_text(text_buf); single_value->field_spare1.decode_text(text_buf); single_value->field_lapi.decode_text(text_buf); single_value->field_spare2.decode_text(text_buf); single_value->field_explicitly__specified.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 SignallingPriorityIndication__NSAPI_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 @GTPC_Types.SignallingPriorityIndication_NSAPI."); } } void SignallingPriorityIndication__NSAPI_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: { SignallingPriorityIndication__NSAPI_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) nsapi().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) spare1().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) lapi().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) spare2().set_param(*param.get_elem(5)); if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) explicitly__specified().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nsapi")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsapi().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "spare1")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare1().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lapi")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lapi().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "spare2")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare2().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "explicitly_specified")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { explicitly__specified().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.SignallingPriorityIndication_NSAPI: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { SignallingPriorityIndication__NSAPI_template* precondition = new SignallingPriorityIndication__NSAPI_template; precondition->set_param(*param.get_elem(0)); SignallingPriorityIndication__NSAPI_template* implied_template = new SignallingPriorityIndication__NSAPI_template; implied_template->set_param(*param.get_elem(1)); *this = SignallingPriorityIndication__NSAPI_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.SignallingPriorityIndication_NSAPI"); } is_ifpresent = param.get_ifpresent(); } void SignallingPriorityIndication__NSAPI_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_type__gtpc.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.SignallingPriorityIndication_NSAPI"); single_value->field_lengthf.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.SignallingPriorityIndication_NSAPI"); single_value->field_nsapi.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.SignallingPriorityIndication_NSAPI"); single_value->field_spare1.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.SignallingPriorityIndication_NSAPI"); single_value->field_lapi.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.SignallingPriorityIndication_NSAPI"); single_value->field_spare2.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.SignallingPriorityIndication_NSAPI"); single_value->field_explicitly__specified.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.SignallingPriorityIndication_NSAPI"); 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 : "@GTPC_Types.SignallingPriorityIndication_NSAPI"); } boolean SignallingPriorityIndication__NSAPI_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean SignallingPriorityIndication__NSAPI_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) flag().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "flag")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { flag().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.Higher_Bitrates_Than_16Mbps_Flag: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.Higher_Bitrates_Than_16Mbps_Flag"); } } void Higher__Bitrates__Than__16Mbps__Flag::encode_text(Text_Buf& text_buf) const { field_type__gtpc.encode_text(text_buf); field_lengthf.encode_text(text_buf); field_flag.encode_text(text_buf); } void Higher__Bitrates__Than__16Mbps__Flag::decode_text(Text_Buf& text_buf) { field_type__gtpc.decode_text(text_buf); field_lengthf.decode_text(text_buf); field_flag.decode_text(text_buf); } void Higher__Bitrates__Than__16Mbps__Flag::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 Higher__Bitrates__Than__16Mbps__Flag::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 Higher__Bitrates__Than__16Mbps__Flag::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; int value_of_length_field1 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_type__gtpc.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, Higher__Bitrates__Than__16Mbps__Flag_lengthf_descr_.raw->forceomit); decoded_field_length = field_lengthf.RAW_decode(Higher__Bitrates__Than__16Mbps__Flag_lengthf_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()); INTEGER tmp1 = field_lengthf.convert_to_Integer(Higher__Bitrates__Than__16Mbps__Flag_lengthf_descr_); field_lengthf = tmp1; value_of_length_field1 += tmp1.get_long_long_val() * 8; RAW_Force_Omit field_2_force_omit(2, force_omit, General__Types::LIN1_descr_.raw->forceomit); decoded_field_length = field_flag.RAW_decode(General__Types::LIN1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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()); value_of_length_field1 -= decoded_field_length; if (field_type__gtpc != os_77) return -1; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int Higher__Bitrates__Than__16Mbps__Flag::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, Higher__Bitrates__Than__16Mbps__Flag_lengthf_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, General__Types::LIN1_descr_.raw); encoded_length += field_type__gtpc.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += 16; myleaf.body.node.nodes[1]->calc = CALC_LENGTH; myleaf.body.node.nodes[1]->coding_descr = &Higher__Bitrates__Than__16Mbps__Flag_lengthf_descr_; myleaf.body.node.nodes[1]->calcof.lengthto.num_of_fields = 1; myleaf.body.node.nodes[1]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[1]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields = init_lengthto_fields_list(1); myleaf.body.node.nodes[1]->length = 16; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[2]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[2]->curr_pos.pos; encoded_length += field_flag.RAW_encode(General__Types::LIN1_descr_, *myleaf.body.node.nodes[2]); if (field_type__gtpc != os_77) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={0}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ os_77.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 Higher__Bitrates__Than__16Mbps__Flag_template::single_value_struct { OCTETSTRING_template field_type__gtpc; INTEGER_template field_lengthf; INTEGER_template field_flag; }; void Higher__Bitrates__Than__16Mbps__Flag_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_type__gtpc = ANY_VALUE; single_value->field_lengthf = ANY_VALUE; single_value->field_flag = ANY_VALUE; } } } void Higher__Bitrates__Than__16Mbps__Flag_template::copy_value(const Higher__Bitrates__Than__16Mbps__Flag& other_value) { single_value = new single_value_struct; if (other_value.type__gtpc().is_bound()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (other_value.lengthf().is_bound()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (other_value.flag().is_bound()) { single_value->field_flag = other_value.flag(); } else { single_value->field_flag.clean_up(); } set_selection(SPECIFIC_VALUE); } void Higher__Bitrates__Than__16Mbps__Flag_template::copy_template(const Higher__Bitrates__Than__16Mbps__Flag_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.type__gtpc().get_selection()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lengthf().get_selection()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.flag().get_selection()) { single_value->field_flag = other_value.flag(); } else { single_value->field_flag.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 Higher__Bitrates__Than__16Mbps__Flag_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 Higher__Bitrates__Than__16Mbps__Flag_template(*other_value.implication_.precondition); implication_.implied_template = new Higher__Bitrates__Than__16Mbps__Flag_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 @GTPC_Types.Higher_Bitrates_Than_16Mbps_Flag."); break; } set_selection(other_value); } Higher__Bitrates__Than__16Mbps__Flag_template::Higher__Bitrates__Than__16Mbps__Flag_template() { } Higher__Bitrates__Than__16Mbps__Flag_template::Higher__Bitrates__Than__16Mbps__Flag_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } Higher__Bitrates__Than__16Mbps__Flag_template::Higher__Bitrates__Than__16Mbps__Flag_template(const Higher__Bitrates__Than__16Mbps__Flag& other_value) { copy_value(other_value); } Higher__Bitrates__Than__16Mbps__Flag_template::Higher__Bitrates__Than__16Mbps__Flag_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const Higher__Bitrates__Than__16Mbps__Flag&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.Higher_Bitrates_Than_16Mbps_Flag from an unbound optional field."); } } Higher__Bitrates__Than__16Mbps__Flag_template::Higher__Bitrates__Than__16Mbps__Flag_template(Higher__Bitrates__Than__16Mbps__Flag_template* p_precondition, Higher__Bitrates__Than__16Mbps__Flag_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } Higher__Bitrates__Than__16Mbps__Flag_template::Higher__Bitrates__Than__16Mbps__Flag_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; } Higher__Bitrates__Than__16Mbps__Flag_template::Higher__Bitrates__Than__16Mbps__Flag_template(const Higher__Bitrates__Than__16Mbps__Flag_template& other_value) : Base_Template() { copy_template(other_value); } Higher__Bitrates__Than__16Mbps__Flag_template::~Higher__Bitrates__Than__16Mbps__Flag_template() { clean_up(); } Higher__Bitrates__Than__16Mbps__Flag_template& Higher__Bitrates__Than__16Mbps__Flag_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } Higher__Bitrates__Than__16Mbps__Flag_template& Higher__Bitrates__Than__16Mbps__Flag_template::operator=(const Higher__Bitrates__Than__16Mbps__Flag& other_value) { clean_up(); copy_value(other_value); return *this; } Higher__Bitrates__Than__16Mbps__Flag_template& Higher__Bitrates__Than__16Mbps__Flag_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const Higher__Bitrates__Than__16Mbps__Flag&)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 @GTPC_Types.Higher_Bitrates_Than_16Mbps_Flag."); } return *this; } Higher__Bitrates__Than__16Mbps__Flag_template& Higher__Bitrates__Than__16Mbps__Flag_template::operator=(const Higher__Bitrates__Than__16Mbps__Flag_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean Higher__Bitrates__Than__16Mbps__Flag_template::match(const Higher__Bitrates__Than__16Mbps__Flag& 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.type__gtpc().is_bound()) return FALSE; if(!single_value->field_type__gtpc.match(other_value.type__gtpc(), legacy))return FALSE; if(!other_value.lengthf().is_bound()) return FALSE; if(!single_value->field_lengthf.match(other_value.lengthf(), legacy))return FALSE; if(!other_value.flag().is_bound()) return FALSE; if(!single_value->field_flag.match(other_value.flag(), 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 @GTPC_Types.Higher_Bitrates_Than_16Mbps_Flag."); } return FALSE; } boolean Higher__Bitrates__Than__16Mbps__Flag_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_type__gtpc.is_bound() || single_value->field_lengthf.is_bound() || single_value->field_flag.is_bound(); } boolean Higher__Bitrates__Than__16Mbps__Flag_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_type__gtpc.is_value() && single_value->field_lengthf.is_value() && single_value->field_flag.is_value(); } void Higher__Bitrates__Than__16Mbps__Flag_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; } Higher__Bitrates__Than__16Mbps__Flag Higher__Bitrates__Than__16Mbps__Flag_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 @GTPC_Types.Higher_Bitrates_Than_16Mbps_Flag."); Higher__Bitrates__Than__16Mbps__Flag ret_val; if (single_value->field_type__gtpc.is_bound()) { ret_val.type__gtpc() = single_value->field_type__gtpc.valueof(); } if (single_value->field_lengthf.is_bound()) { ret_val.lengthf() = single_value->field_lengthf.valueof(); } if (single_value->field_flag.is_bound()) { ret_val.flag() = single_value->field_flag.valueof(); } return ret_val; } void Higher__Bitrates__Than__16Mbps__Flag_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 @GTPC_Types.Higher_Bitrates_Than_16Mbps_Flag."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new Higher__Bitrates__Than__16Mbps__Flag_template[list_length]; } Higher__Bitrates__Than__16Mbps__Flag_template& Higher__Bitrates__Than__16Mbps__Flag_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 @GTPC_Types.Higher_Bitrates_Than_16Mbps_Flag."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.Higher_Bitrates_Than_16Mbps_Flag."); return value_list.list_value[list_index]; } OCTETSTRING_template& Higher__Bitrates__Than__16Mbps__Flag_template::type__gtpc() { set_specific(); return single_value->field_type__gtpc; } const OCTETSTRING_template& Higher__Bitrates__Than__16Mbps__Flag_template::type__gtpc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field type_gtpc of a non-specific template of type @GTPC_Types.Higher_Bitrates_Than_16Mbps_Flag."); return single_value->field_type__gtpc; } INTEGER_template& Higher__Bitrates__Than__16Mbps__Flag_template::lengthf() { set_specific(); return single_value->field_lengthf; } const INTEGER_template& Higher__Bitrates__Than__16Mbps__Flag_template::lengthf() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthf of a non-specific template of type @GTPC_Types.Higher_Bitrates_Than_16Mbps_Flag."); return single_value->field_lengthf; } INTEGER_template& Higher__Bitrates__Than__16Mbps__Flag_template::flag() { set_specific(); return single_value->field_flag; } const INTEGER_template& Higher__Bitrates__Than__16Mbps__Flag_template::flag() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field flag of a non-specific template of type @GTPC_Types.Higher_Bitrates_Than_16Mbps_Flag."); return single_value->field_flag; } int Higher__Bitrates__Than__16Mbps__Flag_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.Higher_Bitrates_Than_16Mbps_Flag 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 @GTPC_Types.Higher_Bitrates_Than_16Mbps_Flag 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 @GTPC_Types.Higher_Bitrates_Than_16Mbps_Flag containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.Higher_Bitrates_Than_16Mbps_Flag containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.Higher_Bitrates_Than_16Mbps_Flag containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.Higher_Bitrates_Than_16Mbps_Flag containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.Higher_Bitrates_Than_16Mbps_Flag containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.Higher_Bitrates_Than_16Mbps_Flag containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.Higher_Bitrates_Than_16Mbps_Flag containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.Higher_Bitrates_Than_16Mbps_Flag."); } return 0; } void Higher__Bitrates__Than__16Mbps__Flag_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ type_gtpc := "); single_value->field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log(); TTCN_Logger::log_event_str(", flag := "); single_value->field_flag.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 Higher__Bitrates__Than__16Mbps__Flag_template::log_match(const Higher__Bitrates__Than__16Mbps__Flag& 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_type__gtpc.match(match_value.type__gtpc(), legacy)){ TTCN_Logger::log_logmatch_info(".type_gtpc"); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lengthf.match(match_value.lengthf(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthf"); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_flag.match(match_value.flag(), legacy)){ TTCN_Logger::log_logmatch_info(".flag"); single_value->field_flag.log_match(match_value.flag(), 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("{ type_gtpc := "); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::log_event_str(", flag := "); single_value->field_flag.log_match(match_value.flag(), 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 Higher__Bitrates__Than__16Mbps__Flag_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_type__gtpc.encode_text(text_buf); single_value->field_lengthf.encode_text(text_buf); single_value->field_flag.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 @GTPC_Types.Higher_Bitrates_Than_16Mbps_Flag."); } } void Higher__Bitrates__Than__16Mbps__Flag_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_type__gtpc.decode_text(text_buf); single_value->field_lengthf.decode_text(text_buf); single_value->field_flag.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 Higher__Bitrates__Than__16Mbps__Flag_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 @GTPC_Types.Higher_Bitrates_Than_16Mbps_Flag."); } } void Higher__Bitrates__Than__16Mbps__Flag_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: { Higher__Bitrates__Than__16Mbps__Flag_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) flag().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "flag")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { flag().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.Higher_Bitrates_Than_16Mbps_Flag: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { Higher__Bitrates__Than__16Mbps__Flag_template* precondition = new Higher__Bitrates__Than__16Mbps__Flag_template; precondition->set_param(*param.get_elem(0)); Higher__Bitrates__Than__16Mbps__Flag_template* implied_template = new Higher__Bitrates__Than__16Mbps__Flag_template; implied_template->set_param(*param.get_elem(1)); *this = Higher__Bitrates__Than__16Mbps__Flag_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.Higher_Bitrates_Than_16Mbps_Flag"); } is_ifpresent = param.get_ifpresent(); } void Higher__Bitrates__Than__16Mbps__Flag_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_type__gtpc.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.Higher_Bitrates_Than_16Mbps_Flag"); single_value->field_lengthf.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.Higher_Bitrates_Than_16Mbps_Flag"); single_value->field_flag.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.Higher_Bitrates_Than_16Mbps_Flag"); 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 : "@GTPC_Types.Higher_Bitrates_Than_16Mbps_Flag"); } boolean Higher__Bitrates__Than__16Mbps__Flag_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean Higher__Bitrates__Than__16Mbps__Flag_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_explicitly__specified) : field_type__gtpc(par_type__gtpc), field_lengthf(par_lengthf), field_mobile__station__classmark2__len(par_mobile__station__classmark2__len), field_mobile__station__classmark2(par_mobile__station__classmark2), field_mobile__station__classmark3__len(par_mobile__station__classmark3__len), field_mobile__station__classmark3(par_mobile__station__classmark3), field_supported__codec__list__len(par_supported__codec__list__len), field_supported__codec__list(par_supported__codec__list), field_explicitly__specified(par_explicitly__specified) { } SRVCC__MM__Context::SRVCC__MM__Context(const SRVCC__MM__Context& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GTPC_Types.SRVCC_MM_Context."); if (other_value.type__gtpc().is_bound()) field_type__gtpc = other_value.type__gtpc(); else field_type__gtpc.clean_up(); if (other_value.lengthf().is_bound()) field_lengthf = other_value.lengthf(); else field_lengthf.clean_up(); if (other_value.mobile__station__classmark2__len().is_bound()) field_mobile__station__classmark2__len = other_value.mobile__station__classmark2__len(); else field_mobile__station__classmark2__len.clean_up(); if (other_value.mobile__station__classmark2().is_bound()) field_mobile__station__classmark2 = other_value.mobile__station__classmark2(); else field_mobile__station__classmark2.clean_up(); if (other_value.mobile__station__classmark3__len().is_bound()) field_mobile__station__classmark3__len = other_value.mobile__station__classmark3__len(); else field_mobile__station__classmark3__len.clean_up(); if (other_value.mobile__station__classmark3().is_bound()) field_mobile__station__classmark3 = other_value.mobile__station__classmark3(); else field_mobile__station__classmark3.clean_up(); if (other_value.supported__codec__list__len().is_bound()) field_supported__codec__list__len = other_value.supported__codec__list__len(); else field_supported__codec__list__len.clean_up(); if (other_value.supported__codec__list().is_bound()) field_supported__codec__list = other_value.supported__codec__list(); else field_supported__codec__list.clean_up(); if (other_value.explicitly__specified().is_bound()) field_explicitly__specified = other_value.explicitly__specified(); else field_explicitly__specified.clean_up(); } void SRVCC__MM__Context::clean_up() { field_type__gtpc.clean_up(); field_lengthf.clean_up(); field_mobile__station__classmark2__len.clean_up(); field_mobile__station__classmark2.clean_up(); field_mobile__station__classmark3__len.clean_up(); field_mobile__station__classmark3.clean_up(); field_supported__codec__list__len.clean_up(); field_supported__codec__list.clean_up(); field_explicitly__specified.clean_up(); } const TTCN_Typedescriptor_t* SRVCC__MM__Context::get_descriptor() const { return &SRVCC__MM__Context_descr_; } SRVCC__MM__Context& SRVCC__MM__Context::operator=(const SRVCC__MM__Context& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GTPC_Types.SRVCC_MM_Context."); if (other_value.type__gtpc().is_bound()) field_type__gtpc = other_value.type__gtpc(); else field_type__gtpc.clean_up(); if (other_value.lengthf().is_bound()) field_lengthf = other_value.lengthf(); else field_lengthf.clean_up(); if (other_value.mobile__station__classmark2__len().is_bound()) field_mobile__station__classmark2__len = other_value.mobile__station__classmark2__len(); else field_mobile__station__classmark2__len.clean_up(); if (other_value.mobile__station__classmark2().is_bound()) field_mobile__station__classmark2 = other_value.mobile__station__classmark2(); else field_mobile__station__classmark2.clean_up(); if (other_value.mobile__station__classmark3__len().is_bound()) field_mobile__station__classmark3__len = other_value.mobile__station__classmark3__len(); else field_mobile__station__classmark3__len.clean_up(); if (other_value.mobile__station__classmark3().is_bound()) field_mobile__station__classmark3 = other_value.mobile__station__classmark3(); else field_mobile__station__classmark3.clean_up(); if (other_value.supported__codec__list__len().is_bound()) field_supported__codec__list__len = other_value.supported__codec__list__len(); else field_supported__codec__list__len.clean_up(); if (other_value.supported__codec__list().is_bound()) field_supported__codec__list = other_value.supported__codec__list(); else field_supported__codec__list.clean_up(); if (other_value.explicitly__specified().is_bound()) field_explicitly__specified = other_value.explicitly__specified(); else field_explicitly__specified.clean_up(); } return *this; } boolean SRVCC__MM__Context::operator==(const SRVCC__MM__Context& other_value) const { return field_type__gtpc==other_value.field_type__gtpc && field_lengthf==other_value.field_lengthf && field_mobile__station__classmark2__len==other_value.field_mobile__station__classmark2__len && field_mobile__station__classmark2==other_value.field_mobile__station__classmark2 && field_mobile__station__classmark3__len==other_value.field_mobile__station__classmark3__len && field_mobile__station__classmark3==other_value.field_mobile__station__classmark3 && field_supported__codec__list__len==other_value.field_supported__codec__list__len && field_supported__codec__list==other_value.field_supported__codec__list && field_explicitly__specified==other_value.field_explicitly__specified; } boolean SRVCC__MM__Context::is_bound() const { return (field_type__gtpc.is_bound()) || (field_lengthf.is_bound()) || (field_mobile__station__classmark2__len.is_bound()) || (field_mobile__station__classmark2.is_bound()) || (field_mobile__station__classmark3__len.is_bound()) || (field_mobile__station__classmark3.is_bound()) || (field_supported__codec__list__len.is_bound()) || (field_supported__codec__list.is_bound()) || (OPTIONAL_OMIT == field_explicitly__specified.get_selection() || field_explicitly__specified.is_bound()); } boolean SRVCC__MM__Context::is_value() const { return field_type__gtpc.is_value() && field_lengthf.is_value() && field_mobile__station__classmark2__len.is_value() && field_mobile__station__classmark2.is_value() && field_mobile__station__classmark3__len.is_value() && field_mobile__station__classmark3.is_value() && field_supported__codec__list__len.is_value() && field_supported__codec__list.is_value() && (OPTIONAL_OMIT == field_explicitly__specified.get_selection() || field_explicitly__specified.is_value()); } int SRVCC__MM__Context::size_of() const { int ret_val = 8; if (field_explicitly__specified.ispresent()) ret_val++; return ret_val; } void SRVCC__MM__Context::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ type_gtpc := "); field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); field_lengthf.log(); TTCN_Logger::log_event_str(", mobile_station_classmark2_len := "); field_mobile__station__classmark2__len.log(); TTCN_Logger::log_event_str(", mobile_station_classmark2 := "); field_mobile__station__classmark2.log(); TTCN_Logger::log_event_str(", mobile_station_classmark3_len := "); field_mobile__station__classmark3__len.log(); TTCN_Logger::log_event_str(", mobile_station_classmark3 := "); field_mobile__station__classmark3.log(); TTCN_Logger::log_event_str(", supported_codec_list_len := "); field_supported__codec__list__len.log(); TTCN_Logger::log_event_str(", supported_codec_list := "); field_supported__codec__list.log(); TTCN_Logger::log_event_str(", explicitly_specified := "); field_explicitly__specified.log(); TTCN_Logger::log_event_str(" }"); } void SRVCC__MM__Context::set_implicit_omit() { if (type__gtpc().is_bound()) type__gtpc().set_implicit_omit(); if (lengthf().is_bound()) lengthf().set_implicit_omit(); if (mobile__station__classmark2__len().is_bound()) mobile__station__classmark2__len().set_implicit_omit(); if (mobile__station__classmark2().is_bound()) mobile__station__classmark2().set_implicit_omit(); if (mobile__station__classmark3__len().is_bound()) mobile__station__classmark3__len().set_implicit_omit(); if (mobile__station__classmark3().is_bound()) mobile__station__classmark3().set_implicit_omit(); if (supported__codec__list__len().is_bound()) supported__codec__list__len().set_implicit_omit(); if (supported__codec__list().is_bound()) supported__codec__list().set_implicit_omit(); if (!explicitly__specified().is_bound()) explicitly__specified() = OMIT_VALUE; else explicitly__specified().set_implicit_omit(); } void SRVCC__MM__Context::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "record value"); switch (param.get_type()) { case Module_Param::MP_Value_List: if (90 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) mobile__station__classmark2__len().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) mobile__station__classmark2().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) mobile__station__classmark3__len().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) mobile__station__classmark3().set_param(*param.get_elem(5)); if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) supported__codec__list__len().set_param(*param.get_elem(6)); if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) supported__codec__list().set_param(*param.get_elem(7)); if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) explicitly__specified().set_param(*param.get_elem(8)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mobile_station_classmark2_len")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mobile__station__classmark2__len().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mobile_station_classmark2")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mobile__station__classmark2().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mobile_station_classmark3_len")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mobile__station__classmark3__len().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mobile_station_classmark3")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mobile__station__classmark3().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "supported_codec_list_len")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { supported__codec__list__len().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "supported_codec_list")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { supported__codec__list().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "explicitly_specified")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { explicitly__specified().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.SRVCC_MM_Context: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.SRVCC_MM_Context"); } } void SRVCC__MM__Context::encode_text(Text_Buf& text_buf) const { field_type__gtpc.encode_text(text_buf); field_lengthf.encode_text(text_buf); field_mobile__station__classmark2__len.encode_text(text_buf); field_mobile__station__classmark2.encode_text(text_buf); field_mobile__station__classmark3__len.encode_text(text_buf); field_mobile__station__classmark3.encode_text(text_buf); field_supported__codec__list__len.encode_text(text_buf); field_supported__codec__list.encode_text(text_buf); field_explicitly__specified.encode_text(text_buf); } void SRVCC__MM__Context::decode_text(Text_Buf& text_buf) { field_type__gtpc.decode_text(text_buf); field_lengthf.decode_text(text_buf); field_mobile__station__classmark2__len.decode_text(text_buf); field_mobile__station__classmark2.decode_text(text_buf); field_mobile__station__classmark3__len.decode_text(text_buf); field_mobile__station__classmark3.decode_text(text_buf); field_supported__codec__list__len.decode_text(text_buf); field_supported__codec__list.decode_text(text_buf); field_explicitly__specified.decode_text(text_buf); } void SRVCC__MM__Context::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 SRVCC__MM__Context::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 SRVCC__MM__Context::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; int value_of_length_field1 = 0; int value_of_length_field2 = 0; int value_of_length_field4 = 0; int value_of_length_field6 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_type__gtpc.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, SRVCC__MM__Context_lengthf_descr_.raw->forceomit); decoded_field_length = field_lengthf.RAW_decode(SRVCC__MM__Context_lengthf_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()); INTEGER tmp1 = field_lengthf.convert_to_Integer(SRVCC__MM__Context_lengthf_descr_); field_lengthf = tmp1; value_of_length_field1 += tmp1.get_long_long_val() * 8; RAW_Force_Omit field_2_force_omit(2, force_omit, SRVCC__MM__Context_mobile__station__classmark2__len_descr_.raw->forceomit); decoded_field_length = field_mobile__station__classmark2__len.RAW_decode(SRVCC__MM__Context_mobile__station__classmark2__len_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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()); INTEGER tmp2 = field_mobile__station__classmark2__len.convert_to_Integer(SRVCC__MM__Context_mobile__station__classmark2__len_descr_); field_mobile__station__classmark2__len = tmp2; value_of_length_field2 += tmp2.get_long_long_val() * 8; value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_3_force_omit(3, force_omit, OCTETSTRING_descr_.raw->forceomit); decoded_field_length = field_mobile__station__classmark2.RAW_decode(OCTETSTRING_descr_, p_buf, min_of_ints(3, limit, value_of_length_field1, 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_field1 -= decoded_field_length; value_of_length_field2 -= decoded_field_length; RAW_Force_Omit field_4_force_omit(4, force_omit, SRVCC__MM__Context_mobile__station__classmark3__len_descr_.raw->forceomit); decoded_field_length = field_mobile__station__classmark3__len.RAW_decode(SRVCC__MM__Context_mobile__station__classmark3__len_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, no_err, -1, TRUE, &field_4_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); INTEGER tmp4 = field_mobile__station__classmark3__len.convert_to_Integer(SRVCC__MM__Context_mobile__station__classmark3__len_descr_); field_mobile__station__classmark3__len = tmp4; value_of_length_field4 += tmp4.get_long_long_val() * 8; value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_5_force_omit(5, force_omit, OCTETSTRING_descr_.raw->forceomit); decoded_field_length = field_mobile__station__classmark3.RAW_decode(OCTETSTRING_descr_, p_buf, min_of_ints(3, limit, value_of_length_field1, value_of_length_field4), local_top_order, no_err, -1, TRUE, &field_5_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); value_of_length_field1 -= decoded_field_length; value_of_length_field4 -= decoded_field_length; RAW_Force_Omit field_6_force_omit(6, force_omit, SRVCC__MM__Context_supported__codec__list__len_descr_.raw->forceomit); decoded_field_length = field_supported__codec__list__len.RAW_decode(SRVCC__MM__Context_supported__codec__list__len_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, no_err, -1, TRUE, &field_6_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); INTEGER tmp6 = field_supported__codec__list__len.convert_to_Integer(SRVCC__MM__Context_supported__codec__list__len_descr_); field_supported__codec__list__len = tmp6; value_of_length_field6 += tmp6.get_long_long_val() * 8; value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_7_force_omit(7, force_omit, OCTETSTRING_descr_.raw->forceomit); decoded_field_length = field_supported__codec__list.RAW_decode(OCTETSTRING_descr_, p_buf, min_of_ints(3, limit, value_of_length_field1, value_of_length_field6), local_top_order, no_err, -1, TRUE, &field_7_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); value_of_length_field1 -= decoded_field_length; value_of_length_field6 -= decoded_field_length; if (limit > 0 && value_of_length_field1 > 0){ if (force_omit != NULL && (*force_omit)(8)) { field_explicitly__specified = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_8_force_omit(8, force_omit, OCTETSTRING_descr_.raw->forceomit); decoded_field_length = field_explicitly__specified().RAW_decode(OCTETSTRING_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, TRUE, -1, TRUE, &field_8_force_omit); if (decoded_field_length < 1) { field_explicitly__specified = 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()); value_of_length_field1 -= decoded_field_length; } } } else field_explicitly__specified=OMIT_VALUE; if (field_type__gtpc != os_94) return -1; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int SRVCC__MM__Context::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const { if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value."); int encoded_length = 0; myleaf.isleaf = FALSE; myleaf.body.node.num_of_nodes = 9; myleaf.body.node.nodes = init_nodes_of_enc_tree(9); myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, General__Types::OCT1_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, SRVCC__MM__Context_lengthf_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, SRVCC__MM__Context_mobile__station__classmark2__len_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, OCTETSTRING_descr_.raw); myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, SRVCC__MM__Context_mobile__station__classmark3__len_descr_.raw); myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, OCTETSTRING_descr_.raw); myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, SRVCC__MM__Context_supported__codec__list__len_descr_.raw); myleaf.body.node.nodes[7] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 7, OCTETSTRING_descr_.raw); if (field_explicitly__specified.ispresent()) { myleaf.body.node.nodes[8] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 8, OCTETSTRING_descr_.raw); } else myleaf.body.node.nodes[8] = NULL; encoded_length += field_type__gtpc.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += 16; myleaf.body.node.nodes[1]->calc = CALC_LENGTH; myleaf.body.node.nodes[1]->coding_descr = &SRVCC__MM__Context_lengthf_descr_; myleaf.body.node.nodes[1]->calcof.lengthto.num_of_fields = 7; myleaf.body.node.nodes[1]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[1]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields = init_lengthto_fields_list(7); myleaf.body.node.nodes[1]->length = 16; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[2]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[2]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].level = myleaf.body.node.nodes[3]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].pos = myleaf.body.node.nodes[3]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].level = myleaf.body.node.nodes[4]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].pos = myleaf.body.node.nodes[4]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[3].level = myleaf.body.node.nodes[5]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[3].pos = myleaf.body.node.nodes[5]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[4].level = myleaf.body.node.nodes[6]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[4].pos = myleaf.body.node.nodes[6]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[5].level = myleaf.body.node.nodes[7]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[5].pos = myleaf.body.node.nodes[7]->curr_pos.pos; if (field_explicitly__specified.ispresent()) { myleaf.body.node.nodes[1]->calcof.lengthto.fields[6].level = myleaf.body.node.nodes[8]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[6].pos = myleaf.body.node.nodes[8]->curr_pos.pos; } else { myleaf.body.node.nodes[1]->calcof.lengthto.fields[6].level = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields[6].pos = 0; } encoded_length += 8; myleaf.body.node.nodes[2]->calc = CALC_LENGTH; myleaf.body.node.nodes[2]->coding_descr = &SRVCC__MM__Context_mobile__station__classmark2__len_descr_; myleaf.body.node.nodes[2]->calcof.lengthto.num_of_fields = 1; myleaf.body.node.nodes[2]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[2]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[2]->calcof.lengthto.fields = init_lengthto_fields_list(1); myleaf.body.node.nodes[2]->length = 8; myleaf.body.node.nodes[2]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[3]->curr_pos.level; myleaf.body.node.nodes[2]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[3]->curr_pos.pos; encoded_length += field_mobile__station__classmark2.RAW_encode(OCTETSTRING_descr_, *myleaf.body.node.nodes[3]); encoded_length += 8; myleaf.body.node.nodes[4]->calc = CALC_LENGTH; myleaf.body.node.nodes[4]->coding_descr = &SRVCC__MM__Context_mobile__station__classmark3__len_descr_; myleaf.body.node.nodes[4]->calcof.lengthto.num_of_fields = 1; myleaf.body.node.nodes[4]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[4]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[4]->calcof.lengthto.fields = init_lengthto_fields_list(1); myleaf.body.node.nodes[4]->length = 8; myleaf.body.node.nodes[4]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[5]->curr_pos.level; myleaf.body.node.nodes[4]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[5]->curr_pos.pos; encoded_length += field_mobile__station__classmark3.RAW_encode(OCTETSTRING_descr_, *myleaf.body.node.nodes[5]); encoded_length += 8; myleaf.body.node.nodes[6]->calc = CALC_LENGTH; myleaf.body.node.nodes[6]->coding_descr = &SRVCC__MM__Context_supported__codec__list__len_descr_; myleaf.body.node.nodes[6]->calcof.lengthto.num_of_fields = 1; myleaf.body.node.nodes[6]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[6]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[6]->calcof.lengthto.fields = init_lengthto_fields_list(1); myleaf.body.node.nodes[6]->length = 8; myleaf.body.node.nodes[6]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[7]->curr_pos.level; myleaf.body.node.nodes[6]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[7]->curr_pos.pos; encoded_length += field_supported__codec__list.RAW_encode(OCTETSTRING_descr_, *myleaf.body.node.nodes[7]); if (field_explicitly__specified.ispresent()) { encoded_length += field_explicitly__specified().RAW_encode(OCTETSTRING_descr_, *myleaf.body.node.nodes[8]); } if (field_type__gtpc != os_94) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={0}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ os_94.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 SRVCC__MM__Context_template::single_value_struct { OCTETSTRING_template field_type__gtpc; INTEGER_template field_lengthf; INTEGER_template field_mobile__station__classmark2__len; OCTETSTRING_template field_mobile__station__classmark2; INTEGER_template field_mobile__station__classmark3__len; OCTETSTRING_template field_mobile__station__classmark3; INTEGER_template field_supported__codec__list__len; OCTETSTRING_template field_supported__codec__list; OCTETSTRING_template field_explicitly__specified; }; void SRVCC__MM__Context_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_type__gtpc = ANY_VALUE; single_value->field_lengthf = ANY_VALUE; single_value->field_mobile__station__classmark2__len = ANY_VALUE; single_value->field_mobile__station__classmark2 = ANY_VALUE; single_value->field_mobile__station__classmark3__len = ANY_VALUE; single_value->field_mobile__station__classmark3 = ANY_VALUE; single_value->field_supported__codec__list__len = ANY_VALUE; single_value->field_supported__codec__list = ANY_VALUE; single_value->field_explicitly__specified = ANY_OR_OMIT; } } } void SRVCC__MM__Context_template::copy_value(const SRVCC__MM__Context& other_value) { single_value = new single_value_struct; if (other_value.type__gtpc().is_bound()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (other_value.lengthf().is_bound()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (other_value.mobile__station__classmark2__len().is_bound()) { single_value->field_mobile__station__classmark2__len = other_value.mobile__station__classmark2__len(); } else { single_value->field_mobile__station__classmark2__len.clean_up(); } if (other_value.mobile__station__classmark2().is_bound()) { single_value->field_mobile__station__classmark2 = other_value.mobile__station__classmark2(); } else { single_value->field_mobile__station__classmark2.clean_up(); } if (other_value.mobile__station__classmark3__len().is_bound()) { single_value->field_mobile__station__classmark3__len = other_value.mobile__station__classmark3__len(); } else { single_value->field_mobile__station__classmark3__len.clean_up(); } if (other_value.mobile__station__classmark3().is_bound()) { single_value->field_mobile__station__classmark3 = other_value.mobile__station__classmark3(); } else { single_value->field_mobile__station__classmark3.clean_up(); } if (other_value.supported__codec__list__len().is_bound()) { single_value->field_supported__codec__list__len = other_value.supported__codec__list__len(); } else { single_value->field_supported__codec__list__len.clean_up(); } if (other_value.supported__codec__list().is_bound()) { single_value->field_supported__codec__list = other_value.supported__codec__list(); } else { single_value->field_supported__codec__list.clean_up(); } if (other_value.explicitly__specified().is_bound()) { if (other_value.explicitly__specified().ispresent()) single_value->field_explicitly__specified = other_value.explicitly__specified()(); else single_value->field_explicitly__specified = OMIT_VALUE; } else { single_value->field_explicitly__specified.clean_up(); } set_selection(SPECIFIC_VALUE); } void SRVCC__MM__Context_template::copy_template(const SRVCC__MM__Context_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.type__gtpc().get_selection()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lengthf().get_selection()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.mobile__station__classmark2__len().get_selection()) { single_value->field_mobile__station__classmark2__len = other_value.mobile__station__classmark2__len(); } else { single_value->field_mobile__station__classmark2__len.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.mobile__station__classmark2().get_selection()) { single_value->field_mobile__station__classmark2 = other_value.mobile__station__classmark2(); } else { single_value->field_mobile__station__classmark2.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.mobile__station__classmark3__len().get_selection()) { single_value->field_mobile__station__classmark3__len = other_value.mobile__station__classmark3__len(); } else { single_value->field_mobile__station__classmark3__len.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.mobile__station__classmark3().get_selection()) { single_value->field_mobile__station__classmark3 = other_value.mobile__station__classmark3(); } else { single_value->field_mobile__station__classmark3.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.supported__codec__list__len().get_selection()) { single_value->field_supported__codec__list__len = other_value.supported__codec__list__len(); } else { single_value->field_supported__codec__list__len.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.supported__codec__list().get_selection()) { single_value->field_supported__codec__list = other_value.supported__codec__list(); } else { single_value->field_supported__codec__list.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.explicitly__specified().get_selection()) { single_value->field_explicitly__specified = other_value.explicitly__specified(); } else { single_value->field_explicitly__specified.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 SRVCC__MM__Context_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 SRVCC__MM__Context_template(*other_value.implication_.precondition); implication_.implied_template = new SRVCC__MM__Context_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 @GTPC_Types.SRVCC_MM_Context."); break; } set_selection(other_value); } SRVCC__MM__Context_template::SRVCC__MM__Context_template() { } SRVCC__MM__Context_template::SRVCC__MM__Context_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } SRVCC__MM__Context_template::SRVCC__MM__Context_template(const SRVCC__MM__Context& other_value) { copy_value(other_value); } SRVCC__MM__Context_template::SRVCC__MM__Context_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SRVCC__MM__Context&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.SRVCC_MM_Context from an unbound optional field."); } } SRVCC__MM__Context_template::SRVCC__MM__Context_template(SRVCC__MM__Context_template* p_precondition, SRVCC__MM__Context_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } SRVCC__MM__Context_template::SRVCC__MM__Context_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; } SRVCC__MM__Context_template::SRVCC__MM__Context_template(const SRVCC__MM__Context_template& other_value) : Base_Template() { copy_template(other_value); } SRVCC__MM__Context_template::~SRVCC__MM__Context_template() { clean_up(); } SRVCC__MM__Context_template& SRVCC__MM__Context_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } SRVCC__MM__Context_template& SRVCC__MM__Context_template::operator=(const SRVCC__MM__Context& other_value) { clean_up(); copy_value(other_value); return *this; } SRVCC__MM__Context_template& SRVCC__MM__Context_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SRVCC__MM__Context&)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 @GTPC_Types.SRVCC_MM_Context."); } return *this; } SRVCC__MM__Context_template& SRVCC__MM__Context_template::operator=(const SRVCC__MM__Context_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean SRVCC__MM__Context_template::match(const SRVCC__MM__Context& 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.type__gtpc().is_bound()) return FALSE; if(!single_value->field_type__gtpc.match(other_value.type__gtpc(), legacy))return FALSE; if(!other_value.lengthf().is_bound()) return FALSE; if(!single_value->field_lengthf.match(other_value.lengthf(), legacy))return FALSE; if(!other_value.mobile__station__classmark2__len().is_bound()) return FALSE; if(!single_value->field_mobile__station__classmark2__len.match(other_value.mobile__station__classmark2__len(), legacy))return FALSE; if(!other_value.mobile__station__classmark2().is_bound()) return FALSE; if(!single_value->field_mobile__station__classmark2.match(other_value.mobile__station__classmark2(), legacy))return FALSE; if(!other_value.mobile__station__classmark3__len().is_bound()) return FALSE; if(!single_value->field_mobile__station__classmark3__len.match(other_value.mobile__station__classmark3__len(), legacy))return FALSE; if(!other_value.mobile__station__classmark3().is_bound()) return FALSE; if(!single_value->field_mobile__station__classmark3.match(other_value.mobile__station__classmark3(), legacy))return FALSE; if(!other_value.supported__codec__list__len().is_bound()) return FALSE; if(!single_value->field_supported__codec__list__len.match(other_value.supported__codec__list__len(), legacy))return FALSE; if(!other_value.supported__codec__list().is_bound()) return FALSE; if(!single_value->field_supported__codec__list.match(other_value.supported__codec__list(), legacy))return FALSE; if(!other_value.explicitly__specified().is_bound()) return FALSE; if((other_value.explicitly__specified().ispresent() ? !single_value->field_explicitly__specified.match((const OCTETSTRING&)other_value.explicitly__specified(), legacy) : !single_value->field_explicitly__specified.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 @GTPC_Types.SRVCC_MM_Context."); } return FALSE; } boolean SRVCC__MM__Context_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_type__gtpc.is_bound() || single_value->field_lengthf.is_bound() || single_value->field_mobile__station__classmark2__len.is_bound() || single_value->field_mobile__station__classmark2.is_bound() || single_value->field_mobile__station__classmark3__len.is_bound() || single_value->field_mobile__station__classmark3.is_bound() || single_value->field_supported__codec__list__len.is_bound() || single_value->field_supported__codec__list.is_bound() || (single_value->field_explicitly__specified.is_omit() || single_value->field_explicitly__specified.is_bound()); } boolean SRVCC__MM__Context_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_type__gtpc.is_value() && single_value->field_lengthf.is_value() && single_value->field_mobile__station__classmark2__len.is_value() && single_value->field_mobile__station__classmark2.is_value() && single_value->field_mobile__station__classmark3__len.is_value() && single_value->field_mobile__station__classmark3.is_value() && single_value->field_supported__codec__list__len.is_value() && single_value->field_supported__codec__list.is_value() && (single_value->field_explicitly__specified.is_omit() || single_value->field_explicitly__specified.is_value()); } void SRVCC__MM__Context_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; } SRVCC__MM__Context SRVCC__MM__Context_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 @GTPC_Types.SRVCC_MM_Context."); SRVCC__MM__Context ret_val; if (single_value->field_type__gtpc.is_bound()) { ret_val.type__gtpc() = single_value->field_type__gtpc.valueof(); } if (single_value->field_lengthf.is_bound()) { ret_val.lengthf() = single_value->field_lengthf.valueof(); } if (single_value->field_mobile__station__classmark2__len.is_bound()) { ret_val.mobile__station__classmark2__len() = single_value->field_mobile__station__classmark2__len.valueof(); } if (single_value->field_mobile__station__classmark2.is_bound()) { ret_val.mobile__station__classmark2() = single_value->field_mobile__station__classmark2.valueof(); } if (single_value->field_mobile__station__classmark3__len.is_bound()) { ret_val.mobile__station__classmark3__len() = single_value->field_mobile__station__classmark3__len.valueof(); } if (single_value->field_mobile__station__classmark3.is_bound()) { ret_val.mobile__station__classmark3() = single_value->field_mobile__station__classmark3.valueof(); } if (single_value->field_supported__codec__list__len.is_bound()) { ret_val.supported__codec__list__len() = single_value->field_supported__codec__list__len.valueof(); } if (single_value->field_supported__codec__list.is_bound()) { ret_val.supported__codec__list() = single_value->field_supported__codec__list.valueof(); } if (single_value->field_explicitly__specified.is_omit()) ret_val.explicitly__specified() = OMIT_VALUE; else if (single_value->field_explicitly__specified.is_bound()) { ret_val.explicitly__specified() = single_value->field_explicitly__specified.valueof(); } return ret_val; } void SRVCC__MM__Context_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 @GTPC_Types.SRVCC_MM_Context."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new SRVCC__MM__Context_template[list_length]; } SRVCC__MM__Context_template& SRVCC__MM__Context_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 @GTPC_Types.SRVCC_MM_Context."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.SRVCC_MM_Context."); return value_list.list_value[list_index]; } OCTETSTRING_template& SRVCC__MM__Context_template::type__gtpc() { set_specific(); return single_value->field_type__gtpc; } const OCTETSTRING_template& SRVCC__MM__Context_template::type__gtpc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field type_gtpc of a non-specific template of type @GTPC_Types.SRVCC_MM_Context."); return single_value->field_type__gtpc; } INTEGER_template& SRVCC__MM__Context_template::lengthf() { set_specific(); return single_value->field_lengthf; } const INTEGER_template& SRVCC__MM__Context_template::lengthf() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthf of a non-specific template of type @GTPC_Types.SRVCC_MM_Context."); return single_value->field_lengthf; } INTEGER_template& SRVCC__MM__Context_template::mobile__station__classmark2__len() { set_specific(); return single_value->field_mobile__station__classmark2__len; } const INTEGER_template& SRVCC__MM__Context_template::mobile__station__classmark2__len() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field mobile_station_classmark2_len of a non-specific template of type @GTPC_Types.SRVCC_MM_Context."); return single_value->field_mobile__station__classmark2__len; } OCTETSTRING_template& SRVCC__MM__Context_template::mobile__station__classmark2() { set_specific(); return single_value->field_mobile__station__classmark2; } const OCTETSTRING_template& SRVCC__MM__Context_template::mobile__station__classmark2() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field mobile_station_classmark2 of a non-specific template of type @GTPC_Types.SRVCC_MM_Context."); return single_value->field_mobile__station__classmark2; } INTEGER_template& SRVCC__MM__Context_template::mobile__station__classmark3__len() { set_specific(); return single_value->field_mobile__station__classmark3__len; } const INTEGER_template& SRVCC__MM__Context_template::mobile__station__classmark3__len() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field mobile_station_classmark3_len of a non-specific template of type @GTPC_Types.SRVCC_MM_Context."); return single_value->field_mobile__station__classmark3__len; } OCTETSTRING_template& SRVCC__MM__Context_template::mobile__station__classmark3() { set_specific(); return single_value->field_mobile__station__classmark3; } const OCTETSTRING_template& SRVCC__MM__Context_template::mobile__station__classmark3() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field mobile_station_classmark3 of a non-specific template of type @GTPC_Types.SRVCC_MM_Context."); return single_value->field_mobile__station__classmark3; } INTEGER_template& SRVCC__MM__Context_template::supported__codec__list__len() { set_specific(); return single_value->field_supported__codec__list__len; } const INTEGER_template& SRVCC__MM__Context_template::supported__codec__list__len() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field supported_codec_list_len of a non-specific template of type @GTPC_Types.SRVCC_MM_Context."); return single_value->field_supported__codec__list__len; } OCTETSTRING_template& SRVCC__MM__Context_template::supported__codec__list() { set_specific(); return single_value->field_supported__codec__list; } const OCTETSTRING_template& SRVCC__MM__Context_template::supported__codec__list() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field supported_codec_list of a non-specific template of type @GTPC_Types.SRVCC_MM_Context."); return single_value->field_supported__codec__list; } OCTETSTRING_template& SRVCC__MM__Context_template::explicitly__specified() { set_specific(); return single_value->field_explicitly__specified; } const OCTETSTRING_template& SRVCC__MM__Context_template::explicitly__specified() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field explicitly_specified of a non-specific template of type @GTPC_Types.SRVCC_MM_Context."); return single_value->field_explicitly__specified; } int SRVCC__MM__Context_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.SRVCC_MM_Context which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 8; if (single_value->field_explicitly__specified.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 @GTPC_Types.SRVCC_MM_Context 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 @GTPC_Types.SRVCC_MM_Context containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.SRVCC_MM_Context containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.SRVCC_MM_Context containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.SRVCC_MM_Context containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.SRVCC_MM_Context containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.SRVCC_MM_Context containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.SRVCC_MM_Context containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.SRVCC_MM_Context."); } return 0; } void SRVCC__MM__Context_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ type_gtpc := "); single_value->field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log(); TTCN_Logger::log_event_str(", mobile_station_classmark2_len := "); single_value->field_mobile__station__classmark2__len.log(); TTCN_Logger::log_event_str(", mobile_station_classmark2 := "); single_value->field_mobile__station__classmark2.log(); TTCN_Logger::log_event_str(", mobile_station_classmark3_len := "); single_value->field_mobile__station__classmark3__len.log(); TTCN_Logger::log_event_str(", mobile_station_classmark3 := "); single_value->field_mobile__station__classmark3.log(); TTCN_Logger::log_event_str(", supported_codec_list_len := "); single_value->field_supported__codec__list__len.log(); TTCN_Logger::log_event_str(", supported_codec_list := "); single_value->field_supported__codec__list.log(); TTCN_Logger::log_event_str(", explicitly_specified := "); single_value->field_explicitly__specified.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 SRVCC__MM__Context_template::log_match(const SRVCC__MM__Context& 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_type__gtpc.match(match_value.type__gtpc(), legacy)){ TTCN_Logger::log_logmatch_info(".type_gtpc"); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lengthf.match(match_value.lengthf(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthf"); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_mobile__station__classmark2__len.match(match_value.mobile__station__classmark2__len(), legacy)){ TTCN_Logger::log_logmatch_info(".mobile_station_classmark2_len"); single_value->field_mobile__station__classmark2__len.log_match(match_value.mobile__station__classmark2__len(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_mobile__station__classmark2.match(match_value.mobile__station__classmark2(), legacy)){ TTCN_Logger::log_logmatch_info(".mobile_station_classmark2"); single_value->field_mobile__station__classmark2.log_match(match_value.mobile__station__classmark2(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_mobile__station__classmark3__len.match(match_value.mobile__station__classmark3__len(), legacy)){ TTCN_Logger::log_logmatch_info(".mobile_station_classmark3_len"); single_value->field_mobile__station__classmark3__len.log_match(match_value.mobile__station__classmark3__len(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_mobile__station__classmark3.match(match_value.mobile__station__classmark3(), legacy)){ TTCN_Logger::log_logmatch_info(".mobile_station_classmark3"); single_value->field_mobile__station__classmark3.log_match(match_value.mobile__station__classmark3(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_supported__codec__list__len.match(match_value.supported__codec__list__len(), legacy)){ TTCN_Logger::log_logmatch_info(".supported_codec_list_len"); single_value->field_supported__codec__list__len.log_match(match_value.supported__codec__list__len(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_supported__codec__list.match(match_value.supported__codec__list(), legacy)){ TTCN_Logger::log_logmatch_info(".supported_codec_list"); single_value->field_supported__codec__list.log_match(match_value.supported__codec__list(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.explicitly__specified().ispresent()){ if(!single_value->field_explicitly__specified.match(match_value.explicitly__specified(), legacy)){ TTCN_Logger::log_logmatch_info(".explicitly_specified"); single_value->field_explicitly__specified.log_match(match_value.explicitly__specified(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_explicitly__specified.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".explicitly_specified := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_explicitly__specified.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("{ type_gtpc := "); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::log_event_str(", mobile_station_classmark2_len := "); single_value->field_mobile__station__classmark2__len.log_match(match_value.mobile__station__classmark2__len(), legacy); TTCN_Logger::log_event_str(", mobile_station_classmark2 := "); single_value->field_mobile__station__classmark2.log_match(match_value.mobile__station__classmark2(), legacy); TTCN_Logger::log_event_str(", mobile_station_classmark3_len := "); single_value->field_mobile__station__classmark3__len.log_match(match_value.mobile__station__classmark3__len(), legacy); TTCN_Logger::log_event_str(", mobile_station_classmark3 := "); single_value->field_mobile__station__classmark3.log_match(match_value.mobile__station__classmark3(), legacy); TTCN_Logger::log_event_str(", supported_codec_list_len := "); single_value->field_supported__codec__list__len.log_match(match_value.supported__codec__list__len(), legacy); TTCN_Logger::log_event_str(", supported_codec_list := "); single_value->field_supported__codec__list.log_match(match_value.supported__codec__list(), legacy); TTCN_Logger::log_event_str(", explicitly_specified := "); if (match_value.explicitly__specified().ispresent()) { single_value->field_explicitly__specified.log_match(match_value.explicitly__specified(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_explicitly__specified.log(); if (single_value->field_explicitly__specified.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 SRVCC__MM__Context_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_type__gtpc.encode_text(text_buf); single_value->field_lengthf.encode_text(text_buf); single_value->field_mobile__station__classmark2__len.encode_text(text_buf); single_value->field_mobile__station__classmark2.encode_text(text_buf); single_value->field_mobile__station__classmark3__len.encode_text(text_buf); single_value->field_mobile__station__classmark3.encode_text(text_buf); single_value->field_supported__codec__list__len.encode_text(text_buf); single_value->field_supported__codec__list.encode_text(text_buf); single_value->field_explicitly__specified.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 @GTPC_Types.SRVCC_MM_Context."); } } void SRVCC__MM__Context_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_type__gtpc.decode_text(text_buf); single_value->field_lengthf.decode_text(text_buf); single_value->field_mobile__station__classmark2__len.decode_text(text_buf); single_value->field_mobile__station__classmark2.decode_text(text_buf); single_value->field_mobile__station__classmark3__len.decode_text(text_buf); single_value->field_mobile__station__classmark3.decode_text(text_buf); single_value->field_supported__codec__list__len.decode_text(text_buf); single_value->field_supported__codec__list.decode_text(text_buf); single_value->field_explicitly__specified.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 SRVCC__MM__Context_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 @GTPC_Types.SRVCC_MM_Context."); } } void SRVCC__MM__Context_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: { SRVCC__MM__Context_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) mobile__station__classmark2__len().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) mobile__station__classmark2().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) mobile__station__classmark3__len().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) mobile__station__classmark3().set_param(*param.get_elem(5)); if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) supported__codec__list__len().set_param(*param.get_elem(6)); if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) supported__codec__list().set_param(*param.get_elem(7)); if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) explicitly__specified().set_param(*param.get_elem(8)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mobile_station_classmark2_len")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mobile__station__classmark2__len().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mobile_station_classmark2")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mobile__station__classmark2().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mobile_station_classmark3_len")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mobile__station__classmark3__len().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mobile_station_classmark3")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mobile__station__classmark3().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "supported_codec_list_len")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { supported__codec__list__len().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "supported_codec_list")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { supported__codec__list().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "explicitly_specified")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { explicitly__specified().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.SRVCC_MM_Context: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { SRVCC__MM__Context_template* precondition = new SRVCC__MM__Context_template; precondition->set_param(*param.get_elem(0)); SRVCC__MM__Context_template* implied_template = new SRVCC__MM__Context_template; implied_template->set_param(*param.get_elem(1)); *this = SRVCC__MM__Context_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.SRVCC_MM_Context"); } is_ifpresent = param.get_ifpresent(); } void SRVCC__MM__Context_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_type__gtpc.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.SRVCC_MM_Context"); single_value->field_lengthf.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.SRVCC_MM_Context"); single_value->field_mobile__station__classmark2__len.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.SRVCC_MM_Context"); single_value->field_mobile__station__classmark2.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.SRVCC_MM_Context"); single_value->field_mobile__station__classmark3__len.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.SRVCC_MM_Context"); single_value->field_mobile__station__classmark3.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.SRVCC_MM_Context"); single_value->field_supported__codec__list__len.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.SRVCC_MM_Context"); single_value->field_supported__codec__list.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.SRVCC_MM_Context"); single_value->field_explicitly__specified.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.SRVCC_MM_Context"); 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 : "@GTPC_Types.SRVCC_MM_Context"); } boolean SRVCC__MM__Context_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean SRVCC__MM__Context_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_explicitly__specified) : field_type__gtpc(par_type__gtpc), field_lengthf(par_lengthf), field_ics(par_ics), field_spare(par_spare), field_explicitly__specified(par_explicitly__specified) { } SRVCC__Flags::SRVCC__Flags(const SRVCC__Flags& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GTPC_Types.SRVCC_Flags."); if (other_value.type__gtpc().is_bound()) field_type__gtpc = other_value.type__gtpc(); else field_type__gtpc.clean_up(); if (other_value.lengthf().is_bound()) field_lengthf = other_value.lengthf(); else field_lengthf.clean_up(); if (other_value.ics().is_bound()) field_ics = other_value.ics(); else field_ics.clean_up(); if (other_value.spare().is_bound()) field_spare = other_value.spare(); else field_spare.clean_up(); if (other_value.explicitly__specified().is_bound()) field_explicitly__specified = other_value.explicitly__specified(); else field_explicitly__specified.clean_up(); } void SRVCC__Flags::clean_up() { field_type__gtpc.clean_up(); field_lengthf.clean_up(); field_ics.clean_up(); field_spare.clean_up(); field_explicitly__specified.clean_up(); } const TTCN_Typedescriptor_t* SRVCC__Flags::get_descriptor() const { return &SRVCC__Flags_descr_; } SRVCC__Flags& SRVCC__Flags::operator=(const SRVCC__Flags& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GTPC_Types.SRVCC_Flags."); if (other_value.type__gtpc().is_bound()) field_type__gtpc = other_value.type__gtpc(); else field_type__gtpc.clean_up(); if (other_value.lengthf().is_bound()) field_lengthf = other_value.lengthf(); else field_lengthf.clean_up(); if (other_value.ics().is_bound()) field_ics = other_value.ics(); else field_ics.clean_up(); if (other_value.spare().is_bound()) field_spare = other_value.spare(); else field_spare.clean_up(); if (other_value.explicitly__specified().is_bound()) field_explicitly__specified = other_value.explicitly__specified(); else field_explicitly__specified.clean_up(); } return *this; } boolean SRVCC__Flags::operator==(const SRVCC__Flags& other_value) const { return field_type__gtpc==other_value.field_type__gtpc && field_lengthf==other_value.field_lengthf && field_ics==other_value.field_ics && field_spare==other_value.field_spare && field_explicitly__specified==other_value.field_explicitly__specified; } boolean SRVCC__Flags::is_bound() const { return (field_type__gtpc.is_bound()) || (field_lengthf.is_bound()) || (field_ics.is_bound()) || (field_spare.is_bound()) || (OPTIONAL_OMIT == field_explicitly__specified.get_selection() || field_explicitly__specified.is_bound()); } boolean SRVCC__Flags::is_value() const { return field_type__gtpc.is_value() && field_lengthf.is_value() && field_ics.is_value() && field_spare.is_value() && (OPTIONAL_OMIT == field_explicitly__specified.get_selection() || field_explicitly__specified.is_value()); } int SRVCC__Flags::size_of() const { int ret_val = 4; if (field_explicitly__specified.ispresent()) ret_val++; return ret_val; } void SRVCC__Flags::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ type_gtpc := "); field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); field_lengthf.log(); TTCN_Logger::log_event_str(", ics := "); field_ics.log(); TTCN_Logger::log_event_str(", spare := "); field_spare.log(); TTCN_Logger::log_event_str(", explicitly_specified := "); field_explicitly__specified.log(); TTCN_Logger::log_event_str(" }"); } void SRVCC__Flags::set_implicit_omit() { if (type__gtpc().is_bound()) type__gtpc().set_implicit_omit(); if (lengthf().is_bound()) lengthf().set_implicit_omit(); if (ics().is_bound()) ics().set_implicit_omit(); if (spare().is_bound()) spare().set_implicit_omit(); if (!explicitly__specified().is_bound()) explicitly__specified() = OMIT_VALUE; else explicitly__specified().set_implicit_omit(); } void SRVCC__Flags::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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) ics().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) explicitly__specified().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ics")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ics().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "spare")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "explicitly_specified")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { explicitly__specified().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.SRVCC_Flags: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.SRVCC_Flags"); } } void SRVCC__Flags::encode_text(Text_Buf& text_buf) const { field_type__gtpc.encode_text(text_buf); field_lengthf.encode_text(text_buf); field_ics.encode_text(text_buf); field_spare.encode_text(text_buf); field_explicitly__specified.encode_text(text_buf); } void SRVCC__Flags::decode_text(Text_Buf& text_buf) { field_type__gtpc.decode_text(text_buf); field_lengthf.decode_text(text_buf); field_ics.decode_text(text_buf); field_spare.decode_text(text_buf); field_explicitly__specified.decode_text(text_buf); } void SRVCC__Flags::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 SRVCC__Flags::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 SRVCC__Flags::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; int value_of_length_field1 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_type__gtpc.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, SRVCC__Flags_lengthf_descr_.raw->forceomit); decoded_field_length = field_lengthf.RAW_decode(SRVCC__Flags_lengthf_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()); INTEGER tmp1 = field_lengthf.convert_to_Integer(SRVCC__Flags_lengthf_descr_); field_lengthf = tmp1; value_of_length_field1 += tmp1.get_long_long_val() * 8; RAW_Force_Omit field_2_force_omit(2, force_omit, General__Types::BIT1_descr_.raw->forceomit); decoded_field_length = field_ics.RAW_decode(General__Types::BIT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::BIT7_descr_.raw->forceomit); decoded_field_length = field_spare.RAW_decode(General__Types::BIT7_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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_field1 -= decoded_field_length; if (limit > 0 && value_of_length_field1 > 0){ if (force_omit != NULL && (*force_omit)(4)) { field_explicitly__specified = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_4_force_omit(4, force_omit, OCTETSTRING_descr_.raw->forceomit); decoded_field_length = field_explicitly__specified().RAW_decode(OCTETSTRING_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, TRUE, -1, TRUE, &field_4_force_omit); if (decoded_field_length < 1) { field_explicitly__specified = 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()); value_of_length_field1 -= decoded_field_length; } } } else field_explicitly__specified=OMIT_VALUE; if (field_type__gtpc != os_95) return -1; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int SRVCC__Flags::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, SRVCC__Flags_lengthf_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, General__Types::BIT1_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::BIT7_descr_.raw); if (field_explicitly__specified.ispresent()) { myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, OCTETSTRING_descr_.raw); } else myleaf.body.node.nodes[4] = NULL; encoded_length += field_type__gtpc.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += 16; myleaf.body.node.nodes[1]->calc = CALC_LENGTH; myleaf.body.node.nodes[1]->coding_descr = &SRVCC__Flags_lengthf_descr_; myleaf.body.node.nodes[1]->calcof.lengthto.num_of_fields = 3; myleaf.body.node.nodes[1]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[1]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields = init_lengthto_fields_list(3); myleaf.body.node.nodes[1]->length = 16; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[2]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[2]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].level = myleaf.body.node.nodes[3]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].pos = myleaf.body.node.nodes[3]->curr_pos.pos; if (field_explicitly__specified.ispresent()) { myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].level = myleaf.body.node.nodes[4]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].pos = myleaf.body.node.nodes[4]->curr_pos.pos; } else { myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].level = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].pos = 0; } encoded_length += field_ics.RAW_encode(General__Types::BIT1_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_spare.RAW_encode(General__Types::BIT7_descr_, *myleaf.body.node.nodes[3]); if (field_explicitly__specified.ispresent()) { encoded_length += field_explicitly__specified().RAW_encode(OCTETSTRING_descr_, *myleaf.body.node.nodes[4]); } if (field_type__gtpc != os_95) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={0}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ os_95.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 SRVCC__Flags_template::single_value_struct { OCTETSTRING_template field_type__gtpc; INTEGER_template field_lengthf; BITSTRING_template field_ics; BITSTRING_template field_spare; OCTETSTRING_template field_explicitly__specified; }; void SRVCC__Flags_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_type__gtpc = ANY_VALUE; single_value->field_lengthf = ANY_VALUE; single_value->field_ics = ANY_VALUE; single_value->field_spare = ANY_VALUE; single_value->field_explicitly__specified = ANY_OR_OMIT; } } } void SRVCC__Flags_template::copy_value(const SRVCC__Flags& other_value) { single_value = new single_value_struct; if (other_value.type__gtpc().is_bound()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (other_value.lengthf().is_bound()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (other_value.ics().is_bound()) { single_value->field_ics = other_value.ics(); } else { single_value->field_ics.clean_up(); } if (other_value.spare().is_bound()) { single_value->field_spare = other_value.spare(); } else { single_value->field_spare.clean_up(); } if (other_value.explicitly__specified().is_bound()) { if (other_value.explicitly__specified().ispresent()) single_value->field_explicitly__specified = other_value.explicitly__specified()(); else single_value->field_explicitly__specified = OMIT_VALUE; } else { single_value->field_explicitly__specified.clean_up(); } set_selection(SPECIFIC_VALUE); } void SRVCC__Flags_template::copy_template(const SRVCC__Flags_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.type__gtpc().get_selection()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lengthf().get_selection()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.ics().get_selection()) { single_value->field_ics = other_value.ics(); } else { single_value->field_ics.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.spare().get_selection()) { single_value->field_spare = other_value.spare(); } else { single_value->field_spare.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.explicitly__specified().get_selection()) { single_value->field_explicitly__specified = other_value.explicitly__specified(); } else { single_value->field_explicitly__specified.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 SRVCC__Flags_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 SRVCC__Flags_template(*other_value.implication_.precondition); implication_.implied_template = new SRVCC__Flags_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 @GTPC_Types.SRVCC_Flags."); break; } set_selection(other_value); } SRVCC__Flags_template::SRVCC__Flags_template() { } SRVCC__Flags_template::SRVCC__Flags_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } SRVCC__Flags_template::SRVCC__Flags_template(const SRVCC__Flags& other_value) { copy_value(other_value); } SRVCC__Flags_template::SRVCC__Flags_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SRVCC__Flags&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.SRVCC_Flags from an unbound optional field."); } } SRVCC__Flags_template::SRVCC__Flags_template(SRVCC__Flags_template* p_precondition, SRVCC__Flags_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } SRVCC__Flags_template::SRVCC__Flags_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; } SRVCC__Flags_template::SRVCC__Flags_template(const SRVCC__Flags_template& other_value) : Base_Template() { copy_template(other_value); } SRVCC__Flags_template::~SRVCC__Flags_template() { clean_up(); } SRVCC__Flags_template& SRVCC__Flags_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } SRVCC__Flags_template& SRVCC__Flags_template::operator=(const SRVCC__Flags& other_value) { clean_up(); copy_value(other_value); return *this; } SRVCC__Flags_template& SRVCC__Flags_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SRVCC__Flags&)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 @GTPC_Types.SRVCC_Flags."); } return *this; } SRVCC__Flags_template& SRVCC__Flags_template::operator=(const SRVCC__Flags_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean SRVCC__Flags_template::match(const SRVCC__Flags& 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.type__gtpc().is_bound()) return FALSE; if(!single_value->field_type__gtpc.match(other_value.type__gtpc(), legacy))return FALSE; if(!other_value.lengthf().is_bound()) return FALSE; if(!single_value->field_lengthf.match(other_value.lengthf(), legacy))return FALSE; if(!other_value.ics().is_bound()) return FALSE; if(!single_value->field_ics.match(other_value.ics(), legacy))return FALSE; if(!other_value.spare().is_bound()) return FALSE; if(!single_value->field_spare.match(other_value.spare(), legacy))return FALSE; if(!other_value.explicitly__specified().is_bound()) return FALSE; if((other_value.explicitly__specified().ispresent() ? !single_value->field_explicitly__specified.match((const OCTETSTRING&)other_value.explicitly__specified(), legacy) : !single_value->field_explicitly__specified.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 @GTPC_Types.SRVCC_Flags."); } return FALSE; } boolean SRVCC__Flags_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_type__gtpc.is_bound() || single_value->field_lengthf.is_bound() || single_value->field_ics.is_bound() || single_value->field_spare.is_bound() || (single_value->field_explicitly__specified.is_omit() || single_value->field_explicitly__specified.is_bound()); } boolean SRVCC__Flags_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_type__gtpc.is_value() && single_value->field_lengthf.is_value() && single_value->field_ics.is_value() && single_value->field_spare.is_value() && (single_value->field_explicitly__specified.is_omit() || single_value->field_explicitly__specified.is_value()); } void SRVCC__Flags_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; } SRVCC__Flags SRVCC__Flags_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 @GTPC_Types.SRVCC_Flags."); SRVCC__Flags ret_val; if (single_value->field_type__gtpc.is_bound()) { ret_val.type__gtpc() = single_value->field_type__gtpc.valueof(); } if (single_value->field_lengthf.is_bound()) { ret_val.lengthf() = single_value->field_lengthf.valueof(); } if (single_value->field_ics.is_bound()) { ret_val.ics() = single_value->field_ics.valueof(); } if (single_value->field_spare.is_bound()) { ret_val.spare() = single_value->field_spare.valueof(); } if (single_value->field_explicitly__specified.is_omit()) ret_val.explicitly__specified() = OMIT_VALUE; else if (single_value->field_explicitly__specified.is_bound()) { ret_val.explicitly__specified() = single_value->field_explicitly__specified.valueof(); } return ret_val; } void SRVCC__Flags_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 @GTPC_Types.SRVCC_Flags."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new SRVCC__Flags_template[list_length]; } SRVCC__Flags_template& SRVCC__Flags_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 @GTPC_Types.SRVCC_Flags."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.SRVCC_Flags."); return value_list.list_value[list_index]; } OCTETSTRING_template& SRVCC__Flags_template::type__gtpc() { set_specific(); return single_value->field_type__gtpc; } const OCTETSTRING_template& SRVCC__Flags_template::type__gtpc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field type_gtpc of a non-specific template of type @GTPC_Types.SRVCC_Flags."); return single_value->field_type__gtpc; } INTEGER_template& SRVCC__Flags_template::lengthf() { set_specific(); return single_value->field_lengthf; } const INTEGER_template& SRVCC__Flags_template::lengthf() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthf of a non-specific template of type @GTPC_Types.SRVCC_Flags."); return single_value->field_lengthf; } BITSTRING_template& SRVCC__Flags_template::ics() { set_specific(); return single_value->field_ics; } const BITSTRING_template& SRVCC__Flags_template::ics() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ics of a non-specific template of type @GTPC_Types.SRVCC_Flags."); return single_value->field_ics; } BITSTRING_template& SRVCC__Flags_template::spare() { set_specific(); return single_value->field_spare; } const BITSTRING_template& SRVCC__Flags_template::spare() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field spare of a non-specific template of type @GTPC_Types.SRVCC_Flags."); return single_value->field_spare; } OCTETSTRING_template& SRVCC__Flags_template::explicitly__specified() { set_specific(); return single_value->field_explicitly__specified; } const OCTETSTRING_template& SRVCC__Flags_template::explicitly__specified() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field explicitly_specified of a non-specific template of type @GTPC_Types.SRVCC_Flags."); return single_value->field_explicitly__specified; } int SRVCC__Flags_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.SRVCC_Flags which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 4; if (single_value->field_explicitly__specified.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 @GTPC_Types.SRVCC_Flags 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 @GTPC_Types.SRVCC_Flags containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.SRVCC_Flags containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.SRVCC_Flags containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.SRVCC_Flags containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.SRVCC_Flags containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.SRVCC_Flags containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.SRVCC_Flags containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.SRVCC_Flags."); } return 0; } void SRVCC__Flags_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ type_gtpc := "); single_value->field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log(); TTCN_Logger::log_event_str(", ics := "); single_value->field_ics.log(); TTCN_Logger::log_event_str(", spare := "); single_value->field_spare.log(); TTCN_Logger::log_event_str(", explicitly_specified := "); single_value->field_explicitly__specified.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 SRVCC__Flags_template::log_match(const SRVCC__Flags& 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_type__gtpc.match(match_value.type__gtpc(), legacy)){ TTCN_Logger::log_logmatch_info(".type_gtpc"); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lengthf.match(match_value.lengthf(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthf"); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_ics.match(match_value.ics(), legacy)){ TTCN_Logger::log_logmatch_info(".ics"); single_value->field_ics.log_match(match_value.ics(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_spare.match(match_value.spare(), legacy)){ TTCN_Logger::log_logmatch_info(".spare"); single_value->field_spare.log_match(match_value.spare(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.explicitly__specified().ispresent()){ if(!single_value->field_explicitly__specified.match(match_value.explicitly__specified(), legacy)){ TTCN_Logger::log_logmatch_info(".explicitly_specified"); single_value->field_explicitly__specified.log_match(match_value.explicitly__specified(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_explicitly__specified.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".explicitly_specified := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_explicitly__specified.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("{ type_gtpc := "); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::log_event_str(", ics := "); single_value->field_ics.log_match(match_value.ics(), legacy); TTCN_Logger::log_event_str(", spare := "); single_value->field_spare.log_match(match_value.spare(), legacy); TTCN_Logger::log_event_str(", explicitly_specified := "); if (match_value.explicitly__specified().ispresent()) { single_value->field_explicitly__specified.log_match(match_value.explicitly__specified(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_explicitly__specified.log(); if (single_value->field_explicitly__specified.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 SRVCC__Flags_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_type__gtpc.encode_text(text_buf); single_value->field_lengthf.encode_text(text_buf); single_value->field_ics.encode_text(text_buf); single_value->field_spare.encode_text(text_buf); single_value->field_explicitly__specified.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 @GTPC_Types.SRVCC_Flags."); } } void SRVCC__Flags_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_type__gtpc.decode_text(text_buf); single_value->field_lengthf.decode_text(text_buf); single_value->field_ics.decode_text(text_buf); single_value->field_spare.decode_text(text_buf); single_value->field_explicitly__specified.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 SRVCC__Flags_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 @GTPC_Types.SRVCC_Flags."); } } void SRVCC__Flags_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: { SRVCC__Flags_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) ics().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) explicitly__specified().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ics")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ics().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "spare")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "explicitly_specified")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { explicitly__specified().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.SRVCC_Flags: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { SRVCC__Flags_template* precondition = new SRVCC__Flags_template; precondition->set_param(*param.get_elem(0)); SRVCC__Flags_template* implied_template = new SRVCC__Flags_template; implied_template->set_param(*param.get_elem(1)); *this = SRVCC__Flags_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.SRVCC_Flags"); } is_ifpresent = param.get_ifpresent(); } void SRVCC__Flags_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_type__gtpc.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.SRVCC_Flags"); single_value->field_lengthf.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.SRVCC_Flags"); single_value->field_ics.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.SRVCC_Flags"); single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.SRVCC_Flags"); single_value->field_explicitly__specified.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.SRVCC_Flags"); 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 : "@GTPC_Types.SRVCC_Flags"); } boolean SRVCC__Flags_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean SRVCC__Flags_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) nanpi().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) digits().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nanpi")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nanpi().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "digits")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { digits().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.STN_SR: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.STN_SR"); } } void STN__SR::encode_text(Text_Buf& text_buf) const { field_type__gtpc.encode_text(text_buf); field_lengthf.encode_text(text_buf); field_nanpi.encode_text(text_buf); field_digits.encode_text(text_buf); } void STN__SR::decode_text(Text_Buf& text_buf) { field_type__gtpc.decode_text(text_buf); field_lengthf.decode_text(text_buf); field_nanpi.decode_text(text_buf); field_digits.decode_text(text_buf); } void STN__SR::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 STN__SR::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 STN__SR::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; int value_of_length_field1 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_type__gtpc.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, STN__SR_lengthf_descr_.raw->forceomit); decoded_field_length = field_lengthf.RAW_decode(STN__SR_lengthf_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()); INTEGER tmp1 = field_lengthf.convert_to_Integer(STN__SR_lengthf_descr_); field_lengthf = tmp1; value_of_length_field1 += tmp1.get_long_long_val() * 8; RAW_Force_Omit field_2_force_omit(2, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_nanpi.RAW_decode(General__Types::OCT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_3_force_omit(3, force_omit, Digits_descr_.raw->forceomit); decoded_field_length = field_digits.RAW_decode(Digits_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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_field1 -= decoded_field_length; if (field_type__gtpc != os_96) return -1; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int STN__SR::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, STN__SR_lengthf_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, Digits_descr_.raw); encoded_length += field_type__gtpc.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += 16; myleaf.body.node.nodes[1]->calc = CALC_LENGTH; myleaf.body.node.nodes[1]->coding_descr = &STN__SR_lengthf_descr_; myleaf.body.node.nodes[1]->calcof.lengthto.num_of_fields = 2; myleaf.body.node.nodes[1]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[1]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields = init_lengthto_fields_list(2); myleaf.body.node.nodes[1]->length = 16; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[2]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[2]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].level = myleaf.body.node.nodes[3]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].pos = myleaf.body.node.nodes[3]->curr_pos.pos; encoded_length += field_nanpi.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_digits.RAW_encode(Digits_descr_, *myleaf.body.node.nodes[3]); if (field_type__gtpc != os_96) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={0}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ os_96.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 STN__SR_template::single_value_struct { OCTETSTRING_template field_type__gtpc; INTEGER_template field_lengthf; OCTETSTRING_template field_nanpi; Digits_template field_digits; }; void STN__SR_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_type__gtpc = ANY_VALUE; single_value->field_lengthf = ANY_VALUE; single_value->field_nanpi = ANY_VALUE; single_value->field_digits = ANY_VALUE; } } } void STN__SR_template::copy_value(const STN__SR& other_value) { single_value = new single_value_struct; if (other_value.type__gtpc().is_bound()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (other_value.lengthf().is_bound()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (other_value.nanpi().is_bound()) { single_value->field_nanpi = other_value.nanpi(); } else { single_value->field_nanpi.clean_up(); } if (other_value.digits().is_bound()) { single_value->field_digits = other_value.digits(); } else { single_value->field_digits.clean_up(); } set_selection(SPECIFIC_VALUE); } void STN__SR_template::copy_template(const STN__SR_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.type__gtpc().get_selection()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lengthf().get_selection()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.nanpi().get_selection()) { single_value->field_nanpi = other_value.nanpi(); } else { single_value->field_nanpi.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.digits().get_selection()) { single_value->field_digits = other_value.digits(); } else { single_value->field_digits.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 STN__SR_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 STN__SR_template(*other_value.implication_.precondition); implication_.implied_template = new STN__SR_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 @GTPC_Types.STN_SR."); break; } set_selection(other_value); } STN__SR_template::STN__SR_template() { } STN__SR_template::STN__SR_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } STN__SR_template::STN__SR_template(const STN__SR& other_value) { copy_value(other_value); } STN__SR_template::STN__SR_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const STN__SR&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.STN_SR from an unbound optional field."); } } STN__SR_template::STN__SR_template(STN__SR_template* p_precondition, STN__SR_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } STN__SR_template::STN__SR_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; } STN__SR_template::STN__SR_template(const STN__SR_template& other_value) : Base_Template() { copy_template(other_value); } STN__SR_template::~STN__SR_template() { clean_up(); } STN__SR_template& STN__SR_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } STN__SR_template& STN__SR_template::operator=(const STN__SR& other_value) { clean_up(); copy_value(other_value); return *this; } STN__SR_template& STN__SR_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const STN__SR&)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 @GTPC_Types.STN_SR."); } return *this; } STN__SR_template& STN__SR_template::operator=(const STN__SR_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean STN__SR_template::match(const STN__SR& 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.type__gtpc().is_bound()) return FALSE; if(!single_value->field_type__gtpc.match(other_value.type__gtpc(), legacy))return FALSE; if(!other_value.lengthf().is_bound()) return FALSE; if(!single_value->field_lengthf.match(other_value.lengthf(), legacy))return FALSE; if(!other_value.nanpi().is_bound()) return FALSE; if(!single_value->field_nanpi.match(other_value.nanpi(), legacy))return FALSE; if(!other_value.digits().is_bound()) return FALSE; if(!single_value->field_digits.match(other_value.digits(), 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 @GTPC_Types.STN_SR."); } return FALSE; } boolean STN__SR_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_type__gtpc.is_bound() || single_value->field_lengthf.is_bound() || single_value->field_nanpi.is_bound() || single_value->field_digits.is_bound(); } boolean STN__SR_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_type__gtpc.is_value() && single_value->field_lengthf.is_value() && single_value->field_nanpi.is_value() && single_value->field_digits.is_value(); } void STN__SR_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; } STN__SR STN__SR_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 @GTPC_Types.STN_SR."); STN__SR ret_val; if (single_value->field_type__gtpc.is_bound()) { ret_val.type__gtpc() = single_value->field_type__gtpc.valueof(); } if (single_value->field_lengthf.is_bound()) { ret_val.lengthf() = single_value->field_lengthf.valueof(); } if (single_value->field_nanpi.is_bound()) { ret_val.nanpi() = single_value->field_nanpi.valueof(); } if (single_value->field_digits.is_bound()) { ret_val.digits() = single_value->field_digits.valueof(); } return ret_val; } void STN__SR_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 @GTPC_Types.STN_SR."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new STN__SR_template[list_length]; } STN__SR_template& STN__SR_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 @GTPC_Types.STN_SR."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.STN_SR."); return value_list.list_value[list_index]; } OCTETSTRING_template& STN__SR_template::type__gtpc() { set_specific(); return single_value->field_type__gtpc; } const OCTETSTRING_template& STN__SR_template::type__gtpc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field type_gtpc of a non-specific template of type @GTPC_Types.STN_SR."); return single_value->field_type__gtpc; } INTEGER_template& STN__SR_template::lengthf() { set_specific(); return single_value->field_lengthf; } const INTEGER_template& STN__SR_template::lengthf() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthf of a non-specific template of type @GTPC_Types.STN_SR."); return single_value->field_lengthf; } OCTETSTRING_template& STN__SR_template::nanpi() { set_specific(); return single_value->field_nanpi; } const OCTETSTRING_template& STN__SR_template::nanpi() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nanpi of a non-specific template of type @GTPC_Types.STN_SR."); return single_value->field_nanpi; } Digits_template& STN__SR_template::digits() { set_specific(); return single_value->field_digits; } const Digits_template& STN__SR_template::digits() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field digits of a non-specific template of type @GTPC_Types.STN_SR."); return single_value->field_digits; } int STN__SR_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.STN_SR 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 @GTPC_Types.STN_SR 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 @GTPC_Types.STN_SR containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.STN_SR containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.STN_SR containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.STN_SR containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.STN_SR containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.STN_SR containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.STN_SR containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.STN_SR."); } return 0; } void STN__SR_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ type_gtpc := "); single_value->field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log(); TTCN_Logger::log_event_str(", nanpi := "); single_value->field_nanpi.log(); TTCN_Logger::log_event_str(", digits := "); single_value->field_digits.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 STN__SR_template::log_match(const STN__SR& 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_type__gtpc.match(match_value.type__gtpc(), legacy)){ TTCN_Logger::log_logmatch_info(".type_gtpc"); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lengthf.match(match_value.lengthf(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthf"); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_nanpi.match(match_value.nanpi(), legacy)){ TTCN_Logger::log_logmatch_info(".nanpi"); single_value->field_nanpi.log_match(match_value.nanpi(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_digits.match(match_value.digits(), legacy)){ TTCN_Logger::log_logmatch_info(".digits"); single_value->field_digits.log_match(match_value.digits(), 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("{ type_gtpc := "); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::log_event_str(", nanpi := "); single_value->field_nanpi.log_match(match_value.nanpi(), legacy); TTCN_Logger::log_event_str(", digits := "); single_value->field_digits.log_match(match_value.digits(), 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 STN__SR_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_type__gtpc.encode_text(text_buf); single_value->field_lengthf.encode_text(text_buf); single_value->field_nanpi.encode_text(text_buf); single_value->field_digits.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 @GTPC_Types.STN_SR."); } } void STN__SR_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_type__gtpc.decode_text(text_buf); single_value->field_lengthf.decode_text(text_buf); single_value->field_nanpi.decode_text(text_buf); single_value->field_digits.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 STN__SR_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 @GTPC_Types.STN_SR."); } } void STN__SR_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: { STN__SR_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) nanpi().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) digits().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nanpi")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nanpi().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "digits")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { digits().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.STN_SR: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { STN__SR_template* precondition = new STN__SR_template; precondition->set_param(*param.get_elem(0)); STN__SR_template* implied_template = new STN__SR_template; implied_template->set_param(*param.get_elem(1)); *this = STN__SR_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.STN_SR"); } is_ifpresent = param.get_ifpresent(); } void STN__SR_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_type__gtpc.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.STN_SR"); single_value->field_lengthf.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.STN_SR"); single_value->field_nanpi.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.STN_SR"); single_value->field_digits.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.STN_SR"); 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 : "@GTPC_Types.STN_SR"); } boolean STN__SR_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean STN__SR_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) msisdn().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "msisdn")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { msisdn().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.C_MSISDN: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.C_MSISDN"); } } void C__MSISDN::encode_text(Text_Buf& text_buf) const { field_type__gtpc.encode_text(text_buf); field_lengthf.encode_text(text_buf); field_msisdn.encode_text(text_buf); } void C__MSISDN::decode_text(Text_Buf& text_buf) { field_type__gtpc.decode_text(text_buf); field_lengthf.decode_text(text_buf); field_msisdn.decode_text(text_buf); } void C__MSISDN::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 C__MSISDN::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 C__MSISDN::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; int value_of_length_field1 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_type__gtpc.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, C__MSISDN_lengthf_descr_.raw->forceomit); decoded_field_length = field_lengthf.RAW_decode(C__MSISDN_lengthf_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()); INTEGER tmp1 = field_lengthf.convert_to_Integer(C__MSISDN_lengthf_descr_); field_lengthf = tmp1; value_of_length_field1 += tmp1.get_long_long_val() * 8; RAW_Force_Omit field_2_force_omit(2, force_omit, OCTETSTRING_descr_.raw->forceomit); decoded_field_length = field_msisdn.RAW_decode(OCTETSTRING_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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()); value_of_length_field1 -= decoded_field_length; if (field_type__gtpc != os_97) return -1; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int C__MSISDN::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, C__MSISDN_lengthf_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, OCTETSTRING_descr_.raw); encoded_length += field_type__gtpc.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += 16; myleaf.body.node.nodes[1]->calc = CALC_LENGTH; myleaf.body.node.nodes[1]->coding_descr = &C__MSISDN_lengthf_descr_; myleaf.body.node.nodes[1]->calcof.lengthto.num_of_fields = 1; myleaf.body.node.nodes[1]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[1]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields = init_lengthto_fields_list(1); myleaf.body.node.nodes[1]->length = 16; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[2]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[2]->curr_pos.pos; encoded_length += field_msisdn.RAW_encode(OCTETSTRING_descr_, *myleaf.body.node.nodes[2]); if (field_type__gtpc != os_97) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={0}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ os_97.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 C__MSISDN_template::single_value_struct { OCTETSTRING_template field_type__gtpc; INTEGER_template field_lengthf; OCTETSTRING_template field_msisdn; }; void C__MSISDN_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_type__gtpc = ANY_VALUE; single_value->field_lengthf = ANY_VALUE; single_value->field_msisdn = ANY_VALUE; } } } void C__MSISDN_template::copy_value(const C__MSISDN& other_value) { single_value = new single_value_struct; if (other_value.type__gtpc().is_bound()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (other_value.lengthf().is_bound()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (other_value.msisdn().is_bound()) { single_value->field_msisdn = other_value.msisdn(); } else { single_value->field_msisdn.clean_up(); } set_selection(SPECIFIC_VALUE); } void C__MSISDN_template::copy_template(const C__MSISDN_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.type__gtpc().get_selection()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lengthf().get_selection()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.msisdn().get_selection()) { single_value->field_msisdn = other_value.msisdn(); } else { single_value->field_msisdn.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 C__MSISDN_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 C__MSISDN_template(*other_value.implication_.precondition); implication_.implied_template = new C__MSISDN_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 @GTPC_Types.C_MSISDN."); break; } set_selection(other_value); } C__MSISDN_template::C__MSISDN_template() { } C__MSISDN_template::C__MSISDN_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } C__MSISDN_template::C__MSISDN_template(const C__MSISDN& other_value) { copy_value(other_value); } C__MSISDN_template::C__MSISDN_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const C__MSISDN&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.C_MSISDN from an unbound optional field."); } } C__MSISDN_template::C__MSISDN_template(C__MSISDN_template* p_precondition, C__MSISDN_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } C__MSISDN_template::C__MSISDN_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; } C__MSISDN_template::C__MSISDN_template(const C__MSISDN_template& other_value) : Base_Template() { copy_template(other_value); } C__MSISDN_template::~C__MSISDN_template() { clean_up(); } C__MSISDN_template& C__MSISDN_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } C__MSISDN_template& C__MSISDN_template::operator=(const C__MSISDN& other_value) { clean_up(); copy_value(other_value); return *this; } C__MSISDN_template& C__MSISDN_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const C__MSISDN&)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 @GTPC_Types.C_MSISDN."); } return *this; } C__MSISDN_template& C__MSISDN_template::operator=(const C__MSISDN_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean C__MSISDN_template::match(const C__MSISDN& 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.type__gtpc().is_bound()) return FALSE; if(!single_value->field_type__gtpc.match(other_value.type__gtpc(), legacy))return FALSE; if(!other_value.lengthf().is_bound()) return FALSE; if(!single_value->field_lengthf.match(other_value.lengthf(), legacy))return FALSE; if(!other_value.msisdn().is_bound()) return FALSE; if(!single_value->field_msisdn.match(other_value.msisdn(), 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 @GTPC_Types.C_MSISDN."); } return FALSE; } boolean C__MSISDN_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_type__gtpc.is_bound() || single_value->field_lengthf.is_bound() || single_value->field_msisdn.is_bound(); } boolean C__MSISDN_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_type__gtpc.is_value() && single_value->field_lengthf.is_value() && single_value->field_msisdn.is_value(); } void C__MSISDN_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; } C__MSISDN C__MSISDN_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 @GTPC_Types.C_MSISDN."); C__MSISDN ret_val; if (single_value->field_type__gtpc.is_bound()) { ret_val.type__gtpc() = single_value->field_type__gtpc.valueof(); } if (single_value->field_lengthf.is_bound()) { ret_val.lengthf() = single_value->field_lengthf.valueof(); } if (single_value->field_msisdn.is_bound()) { ret_val.msisdn() = single_value->field_msisdn.valueof(); } return ret_val; } void C__MSISDN_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 @GTPC_Types.C_MSISDN."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new C__MSISDN_template[list_length]; } C__MSISDN_template& C__MSISDN_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 @GTPC_Types.C_MSISDN."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.C_MSISDN."); return value_list.list_value[list_index]; } OCTETSTRING_template& C__MSISDN_template::type__gtpc() { set_specific(); return single_value->field_type__gtpc; } const OCTETSTRING_template& C__MSISDN_template::type__gtpc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field type_gtpc of a non-specific template of type @GTPC_Types.C_MSISDN."); return single_value->field_type__gtpc; } INTEGER_template& C__MSISDN_template::lengthf() { set_specific(); return single_value->field_lengthf; } const INTEGER_template& C__MSISDN_template::lengthf() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthf of a non-specific template of type @GTPC_Types.C_MSISDN."); return single_value->field_lengthf; } OCTETSTRING_template& C__MSISDN_template::msisdn() { set_specific(); return single_value->field_msisdn; } const OCTETSTRING_template& C__MSISDN_template::msisdn() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field msisdn of a non-specific template of type @GTPC_Types.C_MSISDN."); return single_value->field_msisdn; } int C__MSISDN_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.C_MSISDN 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 @GTPC_Types.C_MSISDN 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 @GTPC_Types.C_MSISDN containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.C_MSISDN containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.C_MSISDN containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.C_MSISDN containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.C_MSISDN containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.C_MSISDN containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.C_MSISDN containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.C_MSISDN."); } return 0; } void C__MSISDN_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ type_gtpc := "); single_value->field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log(); TTCN_Logger::log_event_str(", msisdn := "); single_value->field_msisdn.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 C__MSISDN_template::log_match(const C__MSISDN& 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_type__gtpc.match(match_value.type__gtpc(), legacy)){ TTCN_Logger::log_logmatch_info(".type_gtpc"); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lengthf.match(match_value.lengthf(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthf"); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_msisdn.match(match_value.msisdn(), legacy)){ TTCN_Logger::log_logmatch_info(".msisdn"); single_value->field_msisdn.log_match(match_value.msisdn(), 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("{ type_gtpc := "); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::log_event_str(", msisdn := "); single_value->field_msisdn.log_match(match_value.msisdn(), 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 C__MSISDN_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_type__gtpc.encode_text(text_buf); single_value->field_lengthf.encode_text(text_buf); single_value->field_msisdn.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 @GTPC_Types.C_MSISDN."); } } void C__MSISDN_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_type__gtpc.decode_text(text_buf); single_value->field_lengthf.decode_text(text_buf); single_value->field_msisdn.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 C__MSISDN_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 @GTPC_Types.C_MSISDN."); } } void C__MSISDN_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: { C__MSISDN_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) msisdn().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "msisdn")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { msisdn().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.C_MSISDN: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { C__MSISDN_template* precondition = new C__MSISDN_template; precondition->set_param(*param.get_elem(0)); C__MSISDN_template* implied_template = new C__MSISDN_template; implied_template->set_param(*param.get_elem(1)); *this = C__MSISDN_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.C_MSISDN"); } is_ifpresent = param.get_ifpresent(); } void C__MSISDN_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_type__gtpc.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.C_MSISDN"); single_value->field_lengthf.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.C_MSISDN"); single_value->field_msisdn.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.C_MSISDN"); 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 : "@GTPC_Types.C_MSISDN"); } boolean C__MSISDN_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean C__MSISDN_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_explicitly__specified) : field_type__gtpc(par_type__gtpc), field_lengthf(par_lengthf), field_extended__ranap__cause(par_extended__ranap__cause), field_explicitly__specified(par_explicitly__specified) { } Extended__RANAP__Cause::Extended__RANAP__Cause(const Extended__RANAP__Cause& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GTPC_Types.Extended_RANAP_Cause."); if (other_value.type__gtpc().is_bound()) field_type__gtpc = other_value.type__gtpc(); else field_type__gtpc.clean_up(); if (other_value.lengthf().is_bound()) field_lengthf = other_value.lengthf(); else field_lengthf.clean_up(); if (other_value.extended__ranap__cause().is_bound()) field_extended__ranap__cause = other_value.extended__ranap__cause(); else field_extended__ranap__cause.clean_up(); if (other_value.explicitly__specified().is_bound()) field_explicitly__specified = other_value.explicitly__specified(); else field_explicitly__specified.clean_up(); } void Extended__RANAP__Cause::clean_up() { field_type__gtpc.clean_up(); field_lengthf.clean_up(); field_extended__ranap__cause.clean_up(); field_explicitly__specified.clean_up(); } const TTCN_Typedescriptor_t* Extended__RANAP__Cause::get_descriptor() const { return &Extended__RANAP__Cause_descr_; } Extended__RANAP__Cause& Extended__RANAP__Cause::operator=(const Extended__RANAP__Cause& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GTPC_Types.Extended_RANAP_Cause."); if (other_value.type__gtpc().is_bound()) field_type__gtpc = other_value.type__gtpc(); else field_type__gtpc.clean_up(); if (other_value.lengthf().is_bound()) field_lengthf = other_value.lengthf(); else field_lengthf.clean_up(); if (other_value.extended__ranap__cause().is_bound()) field_extended__ranap__cause = other_value.extended__ranap__cause(); else field_extended__ranap__cause.clean_up(); if (other_value.explicitly__specified().is_bound()) field_explicitly__specified = other_value.explicitly__specified(); else field_explicitly__specified.clean_up(); } return *this; } boolean Extended__RANAP__Cause::operator==(const Extended__RANAP__Cause& other_value) const { return field_type__gtpc==other_value.field_type__gtpc && field_lengthf==other_value.field_lengthf && field_extended__ranap__cause==other_value.field_extended__ranap__cause && field_explicitly__specified==other_value.field_explicitly__specified; } boolean Extended__RANAP__Cause::is_bound() const { return (field_type__gtpc.is_bound()) || (field_lengthf.is_bound()) || (field_extended__ranap__cause.is_bound()) || (OPTIONAL_OMIT == field_explicitly__specified.get_selection() || field_explicitly__specified.is_bound()); } boolean Extended__RANAP__Cause::is_value() const { return field_type__gtpc.is_value() && field_lengthf.is_value() && field_extended__ranap__cause.is_value() && (OPTIONAL_OMIT == field_explicitly__specified.get_selection() || field_explicitly__specified.is_value()); } int Extended__RANAP__Cause::size_of() const { int ret_val = 3; if (field_explicitly__specified.ispresent()) ret_val++; return ret_val; } void Extended__RANAP__Cause::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ type_gtpc := "); field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); field_lengthf.log(); TTCN_Logger::log_event_str(", extended_ranap_cause := "); field_extended__ranap__cause.log(); TTCN_Logger::log_event_str(", explicitly_specified := "); field_explicitly__specified.log(); TTCN_Logger::log_event_str(" }"); } void Extended__RANAP__Cause::set_implicit_omit() { if (type__gtpc().is_bound()) type__gtpc().set_implicit_omit(); if (lengthf().is_bound()) lengthf().set_implicit_omit(); if (extended__ranap__cause().is_bound()) extended__ranap__cause().set_implicit_omit(); if (!explicitly__specified().is_bound()) explicitly__specified() = OMIT_VALUE; else explicitly__specified().set_implicit_omit(); } void Extended__RANAP__Cause::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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) extended__ranap__cause().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) explicitly__specified().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "extended_ranap_cause")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { extended__ranap__cause().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "explicitly_specified")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { explicitly__specified().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.Extended_RANAP_Cause: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.Extended_RANAP_Cause"); } } void Extended__RANAP__Cause::encode_text(Text_Buf& text_buf) const { field_type__gtpc.encode_text(text_buf); field_lengthf.encode_text(text_buf); field_extended__ranap__cause.encode_text(text_buf); field_explicitly__specified.encode_text(text_buf); } void Extended__RANAP__Cause::decode_text(Text_Buf& text_buf) { field_type__gtpc.decode_text(text_buf); field_lengthf.decode_text(text_buf); field_extended__ranap__cause.decode_text(text_buf); field_explicitly__specified.decode_text(text_buf); } void Extended__RANAP__Cause::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 Extended__RANAP__Cause::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 Extended__RANAP__Cause::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; int value_of_length_field1 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_type__gtpc.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, Extended__RANAP__Cause_lengthf_descr_.raw->forceomit); decoded_field_length = field_lengthf.RAW_decode(Extended__RANAP__Cause_lengthf_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()); INTEGER tmp1 = field_lengthf.convert_to_Integer(Extended__RANAP__Cause_lengthf_descr_); field_lengthf = tmp1; value_of_length_field1 += tmp1.get_long_long_val() * 8; RAW_Force_Omit field_2_force_omit(2, force_omit, Extended__RANAP__Cause_extended__ranap__cause_descr_.raw->forceomit); decoded_field_length = field_extended__ranap__cause.RAW_decode(Extended__RANAP__Cause_extended__ranap__cause_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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()); value_of_length_field1 -= decoded_field_length; if (limit > 0 && value_of_length_field1 > 0){ if (force_omit != NULL && (*force_omit)(3)) { field_explicitly__specified = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_3_force_omit(3, force_omit, OCTETSTRING_descr_.raw->forceomit); decoded_field_length = field_explicitly__specified().RAW_decode(OCTETSTRING_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, TRUE, -1, TRUE, &field_3_force_omit); if (decoded_field_length < 1) { field_explicitly__specified = 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()); value_of_length_field1 -= decoded_field_length; } } } else field_explicitly__specified=OMIT_VALUE; if (field_type__gtpc != os_98) return -1; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int Extended__RANAP__Cause::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, Extended__RANAP__Cause_lengthf_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, Extended__RANAP__Cause_extended__ranap__cause_descr_.raw); if (field_explicitly__specified.ispresent()) { myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, OCTETSTRING_descr_.raw); } else myleaf.body.node.nodes[3] = NULL; encoded_length += field_type__gtpc.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += 16; myleaf.body.node.nodes[1]->calc = CALC_LENGTH; myleaf.body.node.nodes[1]->coding_descr = &Extended__RANAP__Cause_lengthf_descr_; myleaf.body.node.nodes[1]->calcof.lengthto.num_of_fields = 2; myleaf.body.node.nodes[1]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[1]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields = init_lengthto_fields_list(2); myleaf.body.node.nodes[1]->length = 16; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[2]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[2]->curr_pos.pos; if (field_explicitly__specified.ispresent()) { myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].level = myleaf.body.node.nodes[3]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].pos = myleaf.body.node.nodes[3]->curr_pos.pos; } else { myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].level = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].pos = 0; } encoded_length += field_extended__ranap__cause.RAW_encode(Extended__RANAP__Cause_extended__ranap__cause_descr_, *myleaf.body.node.nodes[2]); if (field_explicitly__specified.ispresent()) { encoded_length += field_explicitly__specified().RAW_encode(OCTETSTRING_descr_, *myleaf.body.node.nodes[3]); } if (field_type__gtpc != os_98) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={0}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ os_98.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 Extended__RANAP__Cause_template::single_value_struct { OCTETSTRING_template field_type__gtpc; INTEGER_template field_lengthf; INTEGER_template field_extended__ranap__cause; OCTETSTRING_template field_explicitly__specified; }; void Extended__RANAP__Cause_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_type__gtpc = ANY_VALUE; single_value->field_lengthf = ANY_VALUE; single_value->field_extended__ranap__cause = ANY_VALUE; single_value->field_explicitly__specified = ANY_OR_OMIT; } } } void Extended__RANAP__Cause_template::copy_value(const Extended__RANAP__Cause& other_value) { single_value = new single_value_struct; if (other_value.type__gtpc().is_bound()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (other_value.lengthf().is_bound()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (other_value.extended__ranap__cause().is_bound()) { single_value->field_extended__ranap__cause = other_value.extended__ranap__cause(); } else { single_value->field_extended__ranap__cause.clean_up(); } if (other_value.explicitly__specified().is_bound()) { if (other_value.explicitly__specified().ispresent()) single_value->field_explicitly__specified = other_value.explicitly__specified()(); else single_value->field_explicitly__specified = OMIT_VALUE; } else { single_value->field_explicitly__specified.clean_up(); } set_selection(SPECIFIC_VALUE); } void Extended__RANAP__Cause_template::copy_template(const Extended__RANAP__Cause_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.type__gtpc().get_selection()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lengthf().get_selection()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.extended__ranap__cause().get_selection()) { single_value->field_extended__ranap__cause = other_value.extended__ranap__cause(); } else { single_value->field_extended__ranap__cause.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.explicitly__specified().get_selection()) { single_value->field_explicitly__specified = other_value.explicitly__specified(); } else { single_value->field_explicitly__specified.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 Extended__RANAP__Cause_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 Extended__RANAP__Cause_template(*other_value.implication_.precondition); implication_.implied_template = new Extended__RANAP__Cause_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 @GTPC_Types.Extended_RANAP_Cause."); break; } set_selection(other_value); } Extended__RANAP__Cause_template::Extended__RANAP__Cause_template() { } Extended__RANAP__Cause_template::Extended__RANAP__Cause_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } Extended__RANAP__Cause_template::Extended__RANAP__Cause_template(const Extended__RANAP__Cause& other_value) { copy_value(other_value); } Extended__RANAP__Cause_template::Extended__RANAP__Cause_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const Extended__RANAP__Cause&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.Extended_RANAP_Cause from an unbound optional field."); } } Extended__RANAP__Cause_template::Extended__RANAP__Cause_template(Extended__RANAP__Cause_template* p_precondition, Extended__RANAP__Cause_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } Extended__RANAP__Cause_template::Extended__RANAP__Cause_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; } Extended__RANAP__Cause_template::Extended__RANAP__Cause_template(const Extended__RANAP__Cause_template& other_value) : Base_Template() { copy_template(other_value); } Extended__RANAP__Cause_template::~Extended__RANAP__Cause_template() { clean_up(); } Extended__RANAP__Cause_template& Extended__RANAP__Cause_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } Extended__RANAP__Cause_template& Extended__RANAP__Cause_template::operator=(const Extended__RANAP__Cause& other_value) { clean_up(); copy_value(other_value); return *this; } Extended__RANAP__Cause_template& Extended__RANAP__Cause_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const Extended__RANAP__Cause&)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 @GTPC_Types.Extended_RANAP_Cause."); } return *this; } Extended__RANAP__Cause_template& Extended__RANAP__Cause_template::operator=(const Extended__RANAP__Cause_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean Extended__RANAP__Cause_template::match(const Extended__RANAP__Cause& 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.type__gtpc().is_bound()) return FALSE; if(!single_value->field_type__gtpc.match(other_value.type__gtpc(), legacy))return FALSE; if(!other_value.lengthf().is_bound()) return FALSE; if(!single_value->field_lengthf.match(other_value.lengthf(), legacy))return FALSE; if(!other_value.extended__ranap__cause().is_bound()) return FALSE; if(!single_value->field_extended__ranap__cause.match(other_value.extended__ranap__cause(), legacy))return FALSE; if(!other_value.explicitly__specified().is_bound()) return FALSE; if((other_value.explicitly__specified().ispresent() ? !single_value->field_explicitly__specified.match((const OCTETSTRING&)other_value.explicitly__specified(), legacy) : !single_value->field_explicitly__specified.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 @GTPC_Types.Extended_RANAP_Cause."); } return FALSE; } boolean Extended__RANAP__Cause_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_type__gtpc.is_bound() || single_value->field_lengthf.is_bound() || single_value->field_extended__ranap__cause.is_bound() || (single_value->field_explicitly__specified.is_omit() || single_value->field_explicitly__specified.is_bound()); } boolean Extended__RANAP__Cause_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_type__gtpc.is_value() && single_value->field_lengthf.is_value() && single_value->field_extended__ranap__cause.is_value() && (single_value->field_explicitly__specified.is_omit() || single_value->field_explicitly__specified.is_value()); } void Extended__RANAP__Cause_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; } Extended__RANAP__Cause Extended__RANAP__Cause_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 @GTPC_Types.Extended_RANAP_Cause."); Extended__RANAP__Cause ret_val; if (single_value->field_type__gtpc.is_bound()) { ret_val.type__gtpc() = single_value->field_type__gtpc.valueof(); } if (single_value->field_lengthf.is_bound()) { ret_val.lengthf() = single_value->field_lengthf.valueof(); } if (single_value->field_extended__ranap__cause.is_bound()) { ret_val.extended__ranap__cause() = single_value->field_extended__ranap__cause.valueof(); } if (single_value->field_explicitly__specified.is_omit()) ret_val.explicitly__specified() = OMIT_VALUE; else if (single_value->field_explicitly__specified.is_bound()) { ret_val.explicitly__specified() = single_value->field_explicitly__specified.valueof(); } return ret_val; } void Extended__RANAP__Cause_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 @GTPC_Types.Extended_RANAP_Cause."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new Extended__RANAP__Cause_template[list_length]; } Extended__RANAP__Cause_template& Extended__RANAP__Cause_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 @GTPC_Types.Extended_RANAP_Cause."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.Extended_RANAP_Cause."); return value_list.list_value[list_index]; } OCTETSTRING_template& Extended__RANAP__Cause_template::type__gtpc() { set_specific(); return single_value->field_type__gtpc; } const OCTETSTRING_template& Extended__RANAP__Cause_template::type__gtpc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field type_gtpc of a non-specific template of type @GTPC_Types.Extended_RANAP_Cause."); return single_value->field_type__gtpc; } INTEGER_template& Extended__RANAP__Cause_template::lengthf() { set_specific(); return single_value->field_lengthf; } const INTEGER_template& Extended__RANAP__Cause_template::lengthf() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthf of a non-specific template of type @GTPC_Types.Extended_RANAP_Cause."); return single_value->field_lengthf; } INTEGER_template& Extended__RANAP__Cause_template::extended__ranap__cause() { set_specific(); return single_value->field_extended__ranap__cause; } const INTEGER_template& Extended__RANAP__Cause_template::extended__ranap__cause() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field extended_ranap_cause of a non-specific template of type @GTPC_Types.Extended_RANAP_Cause."); return single_value->field_extended__ranap__cause; } OCTETSTRING_template& Extended__RANAP__Cause_template::explicitly__specified() { set_specific(); return single_value->field_explicitly__specified; } const OCTETSTRING_template& Extended__RANAP__Cause_template::explicitly__specified() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field explicitly_specified of a non-specific template of type @GTPC_Types.Extended_RANAP_Cause."); return single_value->field_explicitly__specified; } int Extended__RANAP__Cause_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.Extended_RANAP_Cause which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 3; if (single_value->field_explicitly__specified.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 @GTPC_Types.Extended_RANAP_Cause 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 @GTPC_Types.Extended_RANAP_Cause containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.Extended_RANAP_Cause containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.Extended_RANAP_Cause containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.Extended_RANAP_Cause containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.Extended_RANAP_Cause containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.Extended_RANAP_Cause containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.Extended_RANAP_Cause containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.Extended_RANAP_Cause."); } return 0; } void Extended__RANAP__Cause_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ type_gtpc := "); single_value->field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log(); TTCN_Logger::log_event_str(", extended_ranap_cause := "); single_value->field_extended__ranap__cause.log(); TTCN_Logger::log_event_str(", explicitly_specified := "); single_value->field_explicitly__specified.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 Extended__RANAP__Cause_template::log_match(const Extended__RANAP__Cause& 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_type__gtpc.match(match_value.type__gtpc(), legacy)){ TTCN_Logger::log_logmatch_info(".type_gtpc"); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lengthf.match(match_value.lengthf(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthf"); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_extended__ranap__cause.match(match_value.extended__ranap__cause(), legacy)){ TTCN_Logger::log_logmatch_info(".extended_ranap_cause"); single_value->field_extended__ranap__cause.log_match(match_value.extended__ranap__cause(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.explicitly__specified().ispresent()){ if(!single_value->field_explicitly__specified.match(match_value.explicitly__specified(), legacy)){ TTCN_Logger::log_logmatch_info(".explicitly_specified"); single_value->field_explicitly__specified.log_match(match_value.explicitly__specified(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_explicitly__specified.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".explicitly_specified := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_explicitly__specified.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("{ type_gtpc := "); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::log_event_str(", extended_ranap_cause := "); single_value->field_extended__ranap__cause.log_match(match_value.extended__ranap__cause(), legacy); TTCN_Logger::log_event_str(", explicitly_specified := "); if (match_value.explicitly__specified().ispresent()) { single_value->field_explicitly__specified.log_match(match_value.explicitly__specified(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_explicitly__specified.log(); if (single_value->field_explicitly__specified.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 Extended__RANAP__Cause_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_type__gtpc.encode_text(text_buf); single_value->field_lengthf.encode_text(text_buf); single_value->field_extended__ranap__cause.encode_text(text_buf); single_value->field_explicitly__specified.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 @GTPC_Types.Extended_RANAP_Cause."); } } void Extended__RANAP__Cause_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_type__gtpc.decode_text(text_buf); single_value->field_lengthf.decode_text(text_buf); single_value->field_extended__ranap__cause.decode_text(text_buf); single_value->field_explicitly__specified.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 Extended__RANAP__Cause_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 @GTPC_Types.Extended_RANAP_Cause."); } } void Extended__RANAP__Cause_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: { Extended__RANAP__Cause_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) extended__ranap__cause().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) explicitly__specified().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "extended_ranap_cause")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { extended__ranap__cause().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "explicitly_specified")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { explicitly__specified().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.Extended_RANAP_Cause: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { Extended__RANAP__Cause_template* precondition = new Extended__RANAP__Cause_template; precondition->set_param(*param.get_elem(0)); Extended__RANAP__Cause_template* implied_template = new Extended__RANAP__Cause_template; implied_template->set_param(*param.get_elem(1)); *this = Extended__RANAP__Cause_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.Extended_RANAP_Cause"); } is_ifpresent = param.get_ifpresent(); } void Extended__RANAP__Cause_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_type__gtpc.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.Extended_RANAP_Cause"); single_value->field_lengthf.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.Extended_RANAP_Cause"); single_value->field_extended__ranap__cause.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.Extended_RANAP_Cause"); single_value->field_explicitly__specified.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.Extended_RANAP_Cause"); 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 : "@GTPC_Types.Extended_RANAP_Cause"); } boolean Extended__RANAP__Cause_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean Extended__RANAP__Cause_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_macroENodeB__ID: return field_macroENodeB__ID->is_value(); default: TTCN_error("Invalid selection in union is_bound");} } void ENodeB__IDs::clean_up() { switch (union_selection) { case ALT_homeENodeB__ID: delete field_homeENodeB__ID; break; case ALT_macroENodeB__ID: delete field_macroENodeB__ID; break; default: break; } union_selection = UNBOUND_VALUE; } void ENodeB__IDs::log() const { switch (union_selection) { case ALT_homeENodeB__ID: TTCN_Logger::log_event_str("{ homeENodeB_ID := "); field_homeENodeB__ID->log(); TTCN_Logger::log_event_str(" }"); break; case ALT_macroENodeB__ID: TTCN_Logger::log_event_str("{ macroENodeB_ID := "); field_macroENodeB__ID->log(); TTCN_Logger::log_event_str(" }"); break; default: TTCN_Logger::log_event_unbound(); } } void ENodeB__IDs::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, "homeENodeB_ID")) { homeENodeB__ID().set_param(*mp_last); if (!homeENodeB__ID().is_bound()) clean_up(); return; } if (!strcmp(last_name, "macroENodeB_ID")) { macroENodeB__ID().set_param(*mp_last); if (!macroENodeB__ID().is_bound()) clean_up(); return; } mp_last->error("Field %s does not exist in type @GTPC_Types.ENodeB_IDs.", last_name); } void ENodeB__IDs::set_implicit_omit() { switch (union_selection) { case ALT_homeENodeB__ID: field_homeENodeB__ID->set_implicit_omit(); break; case ALT_macroENodeB__ID: field_macroENodeB__ID->set_implicit_omit(); break; default: break; } } void ENodeB__IDs::encode_text(Text_Buf& text_buf) const { text_buf.push_int(union_selection); switch (union_selection) { case ALT_homeENodeB__ID: field_homeENodeB__ID->encode_text(text_buf); break; case ALT_macroENodeB__ID: field_macroENodeB__ID->encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an unbound value of union type @GTPC_Types.ENodeB_IDs."); } } void ENodeB__IDs::decode_text(Text_Buf& text_buf) { switch ((union_selection_type)text_buf.pull_int().get_val()) { case ALT_homeENodeB__ID: homeENodeB__ID().decode_text(text_buf); break; case ALT_macroENodeB__ID: macroENodeB__ID().decode_text(text_buf); break; default: TTCN_error("Text decoder: Unrecognized union selector was received for type @GTPC_Types.ENodeB_IDs."); } } void ENodeB__IDs::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 ENodeB__IDs::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 ENodeB__IDs::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, HomeENodeB__ID_descr_.raw->forceomit); decoded_length = homeENodeB__ID().RAW_decode(HomeENodeB__ID_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, MacroENodeB__ID_descr_.raw->forceomit); decoded_length = macroENodeB__ID().RAW_decode(MacroENodeB__ID_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, HomeENodeB__ID_descr_.raw->forceomit); decoded_length = homeENodeB__ID().RAW_decode(HomeENodeB__ID_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, MacroENodeB__ID_descr_.raw->forceomit); decoded_length = macroENodeB__ID().RAW_decode(MacroENodeB__ID_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 ENodeB__IDs::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_homeENodeB__ID: myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 0, HomeENodeB__ID_descr_.raw); encoded_length = field_homeENodeB__ID->RAW_encode(HomeENodeB__ID_descr_, *myleaf.body.node.nodes[0]); myleaf.body.node.nodes[0]->coding_descr = &HomeENodeB__ID_descr_; break; case ALT_macroENodeB__ID: myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &myleaf.curr_pos, 1, MacroENodeB__ID_descr_.raw); encoded_length = field_macroENodeB__ID->RAW_encode(MacroENodeB__ID_descr_, *myleaf.body.node.nodes[1]); myleaf.body.node.nodes[1]->coding_descr = &MacroENodeB__ID_descr_; break; default: TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value."); } return encoded_length; } void ENodeB__IDs_template::copy_value(const ENodeB__IDs& other_value) { single_value.union_selection = other_value.get_selection(); switch (single_value.union_selection) { case ENodeB__IDs::ALT_homeENodeB__ID: single_value.field_homeENodeB__ID = new HomeENodeB__ID_template(other_value.homeENodeB__ID()); break; case ENodeB__IDs::ALT_macroENodeB__ID: single_value.field_macroENodeB__ID = new MacroENodeB__ID_template(other_value.macroENodeB__ID()); break; default: TTCN_error("Initializing a template with an unbound value of type @GTPC_Types.ENodeB_IDs."); } set_selection(SPECIFIC_VALUE); } void ENodeB__IDs_template::copy_template(const ENodeB__IDs_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 ENodeB__IDs::ALT_homeENodeB__ID: single_value.field_homeENodeB__ID = new HomeENodeB__ID_template(*other_value.single_value.field_homeENodeB__ID); break; case ENodeB__IDs::ALT_macroENodeB__ID: single_value.field_macroENodeB__ID = new MacroENodeB__ID_template(*other_value.single_value.field_macroENodeB__ID); break; default: TTCN_error("Internal error: Invalid union selector in a specific value when copying a template of type @GTPC_Types.ENodeB_IDs."); } 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 ENodeB__IDs_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 ENodeB__IDs_template(*other_value.implication_.precondition); implication_.implied_template = new ENodeB__IDs_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 @GTPC_Types.ENodeB_IDs."); } set_selection(other_value); } ENodeB__IDs_template::ENodeB__IDs_template() { } ENodeB__IDs_template::ENodeB__IDs_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } ENodeB__IDs_template::ENodeB__IDs_template(const ENodeB__IDs& other_value) { copy_value(other_value); } ENodeB__IDs_template::ENodeB__IDs_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const ENodeB__IDs&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of union type @GTPC_Types.ENodeB_IDs from an unbound optional field."); } } ENodeB__IDs_template::ENodeB__IDs_template(ENodeB__IDs_template* p_precondition, ENodeB__IDs_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } ENodeB__IDs_template::ENodeB__IDs_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; } ENodeB__IDs_template::ENodeB__IDs_template(const ENodeB__IDs_template& other_value) : Base_Template(){ copy_template(other_value); } ENodeB__IDs_template::~ENodeB__IDs_template() { clean_up(); } void ENodeB__IDs_template::clean_up() { switch (template_selection) { case SPECIFIC_VALUE: switch (single_value.union_selection) { case ENodeB__IDs::ALT_homeENodeB__ID: delete single_value.field_homeENodeB__ID; break; case ENodeB__IDs::ALT_macroENodeB__ID: delete single_value.field_macroENodeB__ID; 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; } ENodeB__IDs_template& ENodeB__IDs_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } ENodeB__IDs_template& ENodeB__IDs_template::operator=(const ENodeB__IDs& other_value) { clean_up(); copy_value(other_value); return *this; } ENodeB__IDs_template& ENodeB__IDs_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const ENodeB__IDs&)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 @GTPC_Types.ENodeB_IDs."); } return *this; } ENodeB__IDs_template& ENodeB__IDs_template::operator=(const ENodeB__IDs_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean ENodeB__IDs_template::match(const ENodeB__IDs& 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: { ENodeB__IDs::union_selection_type value_selection = other_value.get_selection(); if (value_selection == ENodeB__IDs::UNBOUND_VALUE) return FALSE; if (value_selection != single_value.union_selection) return FALSE; switch (value_selection) { case ENodeB__IDs::ALT_homeENodeB__ID: return single_value.field_homeENodeB__ID->match(other_value.homeENodeB__ID(), legacy); case ENodeB__IDs::ALT_macroENodeB__ID: return single_value.field_macroENodeB__ID->match(other_value.macroENodeB__ID(), legacy); default: TTCN_error("Internal error: Invalid selector in a specific value when matching a template of union type @GTPC_Types.ENodeB_IDs."); } } 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 @GTPC_Types.ENodeB_IDs."); } return FALSE; } boolean ENodeB__IDs_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; switch (single_value.union_selection) { case ENodeB__IDs::ALT_homeENodeB__ID: return single_value.field_homeENodeB__ID->is_value(); case ENodeB__IDs::ALT_macroENodeB__ID: return single_value.field_macroENodeB__ID->is_value(); default: TTCN_error("Internal error: Invalid selector in a specific value when performing is_value operation on a template of union type @GTPC_Types.ENodeB_IDs."); } } ENodeB__IDs ENodeB__IDs_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 @GTPC_Types.ENodeB_IDs."); ENodeB__IDs ret_val; switch (single_value.union_selection) { case ENodeB__IDs::ALT_homeENodeB__ID: ret_val.homeENodeB__ID() = single_value.field_homeENodeB__ID->valueof(); break; case ENodeB__IDs::ALT_macroENodeB__ID: ret_val.macroENodeB__ID() = single_value.field_macroENodeB__ID->valueof(); break; default: TTCN_error("Internal error: Invalid selector in a specific value when performing valueof operation on a template of union type @GTPC_Types.ENodeB_IDs."); } return ret_val; } ENodeB__IDs_template& ENodeB__IDs_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 @GTPC_Types.ENodeB_IDs."); if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of union type @GTPC_Types.ENodeB_IDs."); return value_list.list_value[list_index]; } void ENodeB__IDs_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 @GTPC_Types.ENodeB_IDs."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new ENodeB__IDs_template[list_length]; } HomeENodeB__ID_template& ENodeB__IDs_template::homeENodeB__ID() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != ENodeB__IDs::ALT_homeENodeB__ID) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_homeENodeB__ID = new HomeENodeB__ID_template(ANY_VALUE); else single_value.field_homeENodeB__ID = new HomeENodeB__ID_template; single_value.union_selection = ENodeB__IDs::ALT_homeENodeB__ID; set_selection(SPECIFIC_VALUE); } return *single_value.field_homeENodeB__ID; } const HomeENodeB__ID_template& ENodeB__IDs_template::homeENodeB__ID() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field homeENodeB_ID in a non-specific template of union type @GTPC_Types.ENodeB_IDs."); if (single_value.union_selection != ENodeB__IDs::ALT_homeENodeB__ID) TTCN_error("Accessing non-selected field homeENodeB_ID in a template of union type @GTPC_Types.ENodeB_IDs."); return *single_value.field_homeENodeB__ID; } MacroENodeB__ID_template& ENodeB__IDs_template::macroENodeB__ID() { if (template_selection != SPECIFIC_VALUE || single_value.union_selection != ENodeB__IDs::ALT_macroENodeB__ID) { template_sel old_selection = template_selection; clean_up(); if (old_selection == ANY_VALUE || old_selection == ANY_OR_OMIT) single_value.field_macroENodeB__ID = new MacroENodeB__ID_template(ANY_VALUE); else single_value.field_macroENodeB__ID = new MacroENodeB__ID_template; single_value.union_selection = ENodeB__IDs::ALT_macroENodeB__ID; set_selection(SPECIFIC_VALUE); } return *single_value.field_macroENodeB__ID; } const MacroENodeB__ID_template& ENodeB__IDs_template::macroENodeB__ID() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field macroENodeB_ID in a non-specific template of union type @GTPC_Types.ENodeB_IDs."); if (single_value.union_selection != ENodeB__IDs::ALT_macroENodeB__ID) TTCN_error("Accessing non-selected field macroENodeB_ID in a template of union type @GTPC_Types.ENodeB_IDs."); return *single_value.field_macroENodeB__ID; } boolean ENodeB__IDs_template::ischosen(ENodeB__IDs::union_selection_type checked_selection) const { if (checked_selection == ENodeB__IDs::UNBOUND_VALUE) TTCN_error("Internal error: Performing ischosen() operation on an invalid field of union type @GTPC_Types.ENodeB_IDs."); switch (template_selection) { case SPECIFIC_VALUE: if (single_value.union_selection == ENodeB__IDs::UNBOUND_VALUE) TTCN_error("Internal error: Invalid selector in a specific value when performing ischosen() operation on a template of union type @GTPC_Types.ENodeB_IDs."); 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 @GTPC_Types.ENodeB_IDs 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 ENodeB__IDs_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: switch (single_value.union_selection) { case ENodeB__IDs::ALT_homeENodeB__ID: TTCN_Logger::log_event_str("{ homeENodeB_ID := "); single_value.field_homeENodeB__ID->log(); TTCN_Logger::log_event_str(" }"); break; case ENodeB__IDs::ALT_macroENodeB__ID: TTCN_Logger::log_event_str("{ macroENodeB_ID := "); single_value.field_macroENodeB__ID->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 ENodeB__IDs_template::log_match(const ENodeB__IDs& 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 ENodeB__IDs::ALT_homeENodeB__ID: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".homeENodeB_ID"); single_value.field_homeENodeB__ID->log_match(match_value.homeENodeB__ID(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ homeENodeB_ID := "); single_value.field_homeENodeB__ID->log_match(match_value.homeENodeB__ID(), legacy); TTCN_Logger::log_event_str(" }"); } break; case ENodeB__IDs::ALT_macroENodeB__ID: if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){ TTCN_Logger::log_logmatch_info(".macroENodeB_ID"); single_value.field_macroENodeB__ID->log_match(match_value.macroENodeB__ID(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } else { TTCN_Logger::log_event_str("{ macroENodeB_ID := "); single_value.field_macroENodeB__ID->log_match(match_value.macroENodeB__ID(), 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 ENodeB__IDs_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 ENodeB__IDs::ALT_homeENodeB__ID: single_value.field_homeENodeB__ID->encode_text(text_buf); break; case ENodeB__IDs::ALT_macroENodeB__ID: single_value.field_macroENodeB__ID->encode_text(text_buf); break; default: TTCN_error("Internal error: Invalid selector in a specific value when encoding a template of union type @GTPC_Types.ENodeB_IDs."); } 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 @GTPC_Types.ENodeB_IDs."); } } void ENodeB__IDs_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: { single_value.union_selection = ENodeB__IDs::UNBOUND_VALUE; ENodeB__IDs::union_selection_type new_selection = (ENodeB__IDs::union_selection_type)text_buf.pull_int().get_val(); switch (new_selection) { case ENodeB__IDs::ALT_homeENodeB__ID: single_value.field_homeENodeB__ID = new HomeENodeB__ID_template; single_value.field_homeENodeB__ID->decode_text(text_buf); break; case ENodeB__IDs::ALT_macroENodeB__ID: single_value.field_macroENodeB__ID = new MacroENodeB__ID_template; single_value.field_macroENodeB__ID->decode_text(text_buf); break; default: TTCN_error("Text decoder: Unrecognized union selector was received for a template of type @GTPC_Types.ENodeB_IDs."); } 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 ENodeB__IDs_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 @GTPC_Types.ENodeB_IDs."); } } boolean ENodeB__IDs_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean ENodeB__IDs_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 `@GTPC_Types.ENodeB_IDs'"); } if (strcmp("homeENodeB_ID", param_field) == 0) { homeENodeB__ID().set_param(param); return; } else if (strcmp("macroENodeB_ID", param_field) == 0) { macroENodeB__ID().set_param(param); return; } else param.error("Field `%s' not found in union template type `@GTPC_Types.ENodeB_IDs'", 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: { ENodeB__IDs_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", "@GTPC_Types.ENodeB_IDs"); 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, "homeENodeB_ID")) { homeENodeB__ID().set_param(*mp_last); break; } if (!strcmp(last_name, "macroENodeB_ID")) { macroENodeB__ID().set_param(*mp_last); break; } mp_last->error("Field %s does not exist in type @GTPC_Types.ENodeB_IDs.", last_name); } break; case Module_Param::MP_Implication_Template: { ENodeB__IDs_template* precondition = new ENodeB__IDs_template; precondition->set_param(*m_p->get_elem(0)); ENodeB__IDs_template* implied_template = new ENodeB__IDs_template; implied_template->set_param(*m_p->get_elem(1)); *this = ENodeB__IDs_template(precondition, implied_template); } break; default: param.type_error("union template", "@GTPC_Types.ENodeB_IDs"); } is_ifpresent = param.get_ifpresent(); } void ENodeB__IDs_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 ENodeB__IDs::ALT_homeENodeB__ID: single_value.field_homeENodeB__ID->check_restriction(t_res, t_name ? t_name : "@GTPC_Types.ENodeB_IDs"); return; case ENodeB__IDs::ALT_macroENodeB__ID: single_value.field_macroENodeB__ID->check_restriction(t_res, t_name ? t_name : "@GTPC_Types.ENodeB_IDs"); return; default: TTCN_error("Internal error: Invalid selector in a specific value when performing check_restriction operation on a template of union type @GTPC_Types.ENodeB_IDs."); } 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 : "@GTPC_Types.ENodeB_IDs"); } HomeENodeB__ID::HomeENodeB__ID() { } HomeENodeB__ID::HomeENodeB__ID(const HEXSTRING& par_mcc1, const HEXSTRING& par_mcc2, const HEXSTRING& par_mcc3, const HEXSTRING& par_mnc3, const HEXSTRING& par_mnc1, const HEXSTRING& par_mnc2, const BITSTRING& par_spare, const BITSTRING& par_homeENodeB__ID, const OCTETSTRING& par_tac) : field_mcc1(par_mcc1), field_mcc2(par_mcc2), field_mcc3(par_mcc3), field_mnc3(par_mnc3), field_mnc1(par_mnc1), field_mnc2(par_mnc2), field_spare(par_spare), field_homeENodeB__ID(par_homeENodeB__ID), field_tac(par_tac) { } HomeENodeB__ID::HomeENodeB__ID(const HomeENodeB__ID& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GTPC_Types.HomeENodeB_ID."); if (other_value.mcc1().is_bound()) field_mcc1 = other_value.mcc1(); else field_mcc1.clean_up(); if (other_value.mcc2().is_bound()) field_mcc2 = other_value.mcc2(); else field_mcc2.clean_up(); if (other_value.mcc3().is_bound()) field_mcc3 = other_value.mcc3(); else field_mcc3.clean_up(); if (other_value.mnc3().is_bound()) field_mnc3 = other_value.mnc3(); else field_mnc3.clean_up(); if (other_value.mnc1().is_bound()) field_mnc1 = other_value.mnc1(); else field_mnc1.clean_up(); if (other_value.mnc2().is_bound()) field_mnc2 = other_value.mnc2(); else field_mnc2.clean_up(); if (other_value.spare().is_bound()) field_spare = other_value.spare(); else field_spare.clean_up(); if (other_value.homeENodeB__ID().is_bound()) field_homeENodeB__ID = other_value.homeENodeB__ID(); else field_homeENodeB__ID.clean_up(); if (other_value.tac().is_bound()) field_tac = other_value.tac(); else field_tac.clean_up(); } void HomeENodeB__ID::clean_up() { field_mcc1.clean_up(); field_mcc2.clean_up(); field_mcc3.clean_up(); field_mnc3.clean_up(); field_mnc1.clean_up(); field_mnc2.clean_up(); field_spare.clean_up(); field_homeENodeB__ID.clean_up(); field_tac.clean_up(); } const TTCN_Typedescriptor_t* HomeENodeB__ID::get_descriptor() const { return &HomeENodeB__ID_descr_; } HomeENodeB__ID& HomeENodeB__ID::operator=(const HomeENodeB__ID& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GTPC_Types.HomeENodeB_ID."); if (other_value.mcc1().is_bound()) field_mcc1 = other_value.mcc1(); else field_mcc1.clean_up(); if (other_value.mcc2().is_bound()) field_mcc2 = other_value.mcc2(); else field_mcc2.clean_up(); if (other_value.mcc3().is_bound()) field_mcc3 = other_value.mcc3(); else field_mcc3.clean_up(); if (other_value.mnc3().is_bound()) field_mnc3 = other_value.mnc3(); else field_mnc3.clean_up(); if (other_value.mnc1().is_bound()) field_mnc1 = other_value.mnc1(); else field_mnc1.clean_up(); if (other_value.mnc2().is_bound()) field_mnc2 = other_value.mnc2(); else field_mnc2.clean_up(); if (other_value.spare().is_bound()) field_spare = other_value.spare(); else field_spare.clean_up(); if (other_value.homeENodeB__ID().is_bound()) field_homeENodeB__ID = other_value.homeENodeB__ID(); else field_homeENodeB__ID.clean_up(); if (other_value.tac().is_bound()) field_tac = other_value.tac(); else field_tac.clean_up(); } return *this; } boolean HomeENodeB__ID::operator==(const HomeENodeB__ID& other_value) const { return field_mcc1==other_value.field_mcc1 && field_mcc2==other_value.field_mcc2 && field_mcc3==other_value.field_mcc3 && field_mnc3==other_value.field_mnc3 && field_mnc1==other_value.field_mnc1 && field_mnc2==other_value.field_mnc2 && field_spare==other_value.field_spare && field_homeENodeB__ID==other_value.field_homeENodeB__ID && field_tac==other_value.field_tac; } boolean HomeENodeB__ID::is_bound() const { return (field_mcc1.is_bound()) || (field_mcc2.is_bound()) || (field_mcc3.is_bound()) || (field_mnc3.is_bound()) || (field_mnc1.is_bound()) || (field_mnc2.is_bound()) || (field_spare.is_bound()) || (field_homeENodeB__ID.is_bound()) || (field_tac.is_bound()); } boolean HomeENodeB__ID::is_value() const { return field_mcc1.is_value() && field_mcc2.is_value() && field_mcc3.is_value() && field_mnc3.is_value() && field_mnc1.is_value() && field_mnc2.is_value() && field_spare.is_value() && field_homeENodeB__ID.is_value() && field_tac.is_value(); } void HomeENodeB__ID::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ mcc1 := "); field_mcc1.log(); TTCN_Logger::log_event_str(", mcc2 := "); field_mcc2.log(); TTCN_Logger::log_event_str(", mcc3 := "); field_mcc3.log(); TTCN_Logger::log_event_str(", mnc3 := "); field_mnc3.log(); TTCN_Logger::log_event_str(", mnc1 := "); field_mnc1.log(); TTCN_Logger::log_event_str(", mnc2 := "); field_mnc2.log(); TTCN_Logger::log_event_str(", spare := "); field_spare.log(); TTCN_Logger::log_event_str(", homeENodeB_ID := "); field_homeENodeB__ID.log(); TTCN_Logger::log_event_str(", tac := "); field_tac.log(); TTCN_Logger::log_event_str(" }"); } void HomeENodeB__ID::set_implicit_omit() { if (mcc1().is_bound()) mcc1().set_implicit_omit(); if (mcc2().is_bound()) mcc2().set_implicit_omit(); if (mcc3().is_bound()) mcc3().set_implicit_omit(); if (mnc3().is_bound()) mnc3().set_implicit_omit(); if (mnc1().is_bound()) mnc1().set_implicit_omit(); if (mnc2().is_bound()) mnc2().set_implicit_omit(); if (spare().is_bound()) spare().set_implicit_omit(); if (homeENodeB__ID().is_bound()) homeENodeB__ID().set_implicit_omit(); if (tac().is_bound()) tac().set_implicit_omit(); } void HomeENodeB__ID::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "record value"); switch (param.get_type()) { case Module_Param::MP_Value_List: if (90 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) mcc1().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) mcc2().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) mcc3().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) mnc3().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) mnc1().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) mnc2().set_param(*param.get_elem(5)); if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(6)); if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) homeENodeB__ID().set_param(*param.get_elem(7)); if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) tac().set_param(*param.get_elem(8)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "mcc1")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mcc1().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mcc2")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mcc2().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mcc3")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mcc3().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mnc3")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mnc3().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mnc1")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mnc1().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mnc2")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mnc2().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "spare")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "homeENodeB_ID")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { homeENodeB__ID().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "tac")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { tac().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.HomeENodeB_ID: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.HomeENodeB_ID"); } } void HomeENodeB__ID::encode_text(Text_Buf& text_buf) const { field_mcc1.encode_text(text_buf); field_mcc2.encode_text(text_buf); field_mcc3.encode_text(text_buf); field_mnc3.encode_text(text_buf); field_mnc1.encode_text(text_buf); field_mnc2.encode_text(text_buf); field_spare.encode_text(text_buf); field_homeENodeB__ID.encode_text(text_buf); field_tac.encode_text(text_buf); } void HomeENodeB__ID::decode_text(Text_Buf& text_buf) { field_mcc1.decode_text(text_buf); field_mcc2.decode_text(text_buf); field_mcc3.decode_text(text_buf); field_mnc3.decode_text(text_buf); field_mnc1.decode_text(text_buf); field_mnc2.decode_text(text_buf); field_spare.decode_text(text_buf); field_homeENodeB__ID.decode_text(text_buf); field_tac.decode_text(text_buf); } void HomeENodeB__ID::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 HomeENodeB__ID::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 HomeENodeB__ID::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::HEX1_descr_.raw->forceomit); decoded_field_length = field_mcc1.RAW_decode(General__Types::HEX1_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::HEX1_descr_.raw->forceomit); decoded_field_length = field_mcc2.RAW_decode(General__Types::HEX1_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::HEX1_descr_.raw->forceomit); decoded_field_length = field_mcc3.RAW_decode(General__Types::HEX1_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::HEX1_descr_.raw->forceomit); decoded_field_length = field_mnc3.RAW_decode(General__Types::HEX1_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_3_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); RAW_Force_Omit field_4_force_omit(4, force_omit, General__Types::HEX1_descr_.raw->forceomit); decoded_field_length = field_mnc1.RAW_decode(General__Types::HEX1_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_4_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); RAW_Force_Omit field_5_force_omit(5, force_omit, General__Types::HEX1_descr_.raw->forceomit); decoded_field_length = field_mnc2.RAW_decode(General__Types::HEX1_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_5_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); RAW_Force_Omit field_6_force_omit(6, force_omit, HomeENodeB__ID_spare_descr_.raw->forceomit); decoded_field_length = field_spare.RAW_decode(HomeENodeB__ID_spare_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_6_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); RAW_Force_Omit field_7_force_omit(7, force_omit, HomeENodeB__ID_homeENodeB__ID_descr_.raw->forceomit); decoded_field_length = field_homeENodeB__ID.RAW_decode(HomeENodeB__ID_homeENodeB__ID_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_7_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); RAW_Force_Omit field_8_force_omit(8, force_omit, General__Types::OCT2_descr_.raw->forceomit); decoded_field_length = field_tac.RAW_decode(General__Types::OCT2_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_8_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int HomeENodeB__ID::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const { if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value."); int encoded_length = 0; myleaf.isleaf = FALSE; myleaf.body.node.num_of_nodes = 9; myleaf.body.node.nodes = init_nodes_of_enc_tree(9); myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, General__Types::HEX1_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, General__Types::HEX1_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, General__Types::HEX1_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::HEX1_descr_.raw); myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, General__Types::HEX1_descr_.raw); myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, General__Types::HEX1_descr_.raw); myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, HomeENodeB__ID_spare_descr_.raw); myleaf.body.node.nodes[7] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 7, HomeENodeB__ID_homeENodeB__ID_descr_.raw); myleaf.body.node.nodes[8] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 8, General__Types::OCT2_descr_.raw); encoded_length += field_mcc1.RAW_encode(General__Types::HEX1_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_mcc2.RAW_encode(General__Types::HEX1_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_mcc3.RAW_encode(General__Types::HEX1_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_mnc3.RAW_encode(General__Types::HEX1_descr_, *myleaf.body.node.nodes[3]); encoded_length += field_mnc1.RAW_encode(General__Types::HEX1_descr_, *myleaf.body.node.nodes[4]); encoded_length += field_mnc2.RAW_encode(General__Types::HEX1_descr_, *myleaf.body.node.nodes[5]); encoded_length += field_spare.RAW_encode(HomeENodeB__ID_spare_descr_, *myleaf.body.node.nodes[6]); encoded_length += field_homeENodeB__ID.RAW_encode(HomeENodeB__ID_homeENodeB__ID_descr_, *myleaf.body.node.nodes[7]); encoded_length += field_tac.RAW_encode(General__Types::OCT2_descr_, *myleaf.body.node.nodes[8]); return myleaf.length = encoded_length; } struct HomeENodeB__ID_template::single_value_struct { HEXSTRING_template field_mcc1; HEXSTRING_template field_mcc2; HEXSTRING_template field_mcc3; HEXSTRING_template field_mnc3; HEXSTRING_template field_mnc1; HEXSTRING_template field_mnc2; BITSTRING_template field_spare; BITSTRING_template field_homeENodeB__ID; OCTETSTRING_template field_tac; }; void HomeENodeB__ID_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_mcc1 = ANY_VALUE; single_value->field_mcc2 = ANY_VALUE; single_value->field_mcc3 = ANY_VALUE; single_value->field_mnc3 = ANY_VALUE; single_value->field_mnc1 = ANY_VALUE; single_value->field_mnc2 = ANY_VALUE; single_value->field_spare = ANY_VALUE; single_value->field_homeENodeB__ID = ANY_VALUE; single_value->field_tac = ANY_VALUE; } } } void HomeENodeB__ID_template::copy_value(const HomeENodeB__ID& other_value) { single_value = new single_value_struct; if (other_value.mcc1().is_bound()) { single_value->field_mcc1 = other_value.mcc1(); } else { single_value->field_mcc1.clean_up(); } if (other_value.mcc2().is_bound()) { single_value->field_mcc2 = other_value.mcc2(); } else { single_value->field_mcc2.clean_up(); } if (other_value.mcc3().is_bound()) { single_value->field_mcc3 = other_value.mcc3(); } else { single_value->field_mcc3.clean_up(); } if (other_value.mnc3().is_bound()) { single_value->field_mnc3 = other_value.mnc3(); } else { single_value->field_mnc3.clean_up(); } if (other_value.mnc1().is_bound()) { single_value->field_mnc1 = other_value.mnc1(); } else { single_value->field_mnc1.clean_up(); } if (other_value.mnc2().is_bound()) { single_value->field_mnc2 = other_value.mnc2(); } else { single_value->field_mnc2.clean_up(); } if (other_value.spare().is_bound()) { single_value->field_spare = other_value.spare(); } else { single_value->field_spare.clean_up(); } if (other_value.homeENodeB__ID().is_bound()) { single_value->field_homeENodeB__ID = other_value.homeENodeB__ID(); } else { single_value->field_homeENodeB__ID.clean_up(); } if (other_value.tac().is_bound()) { single_value->field_tac = other_value.tac(); } else { single_value->field_tac.clean_up(); } set_selection(SPECIFIC_VALUE); } void HomeENodeB__ID_template::copy_template(const HomeENodeB__ID_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.mcc1().get_selection()) { single_value->field_mcc1 = other_value.mcc1(); } else { single_value->field_mcc1.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.mcc2().get_selection()) { single_value->field_mcc2 = other_value.mcc2(); } else { single_value->field_mcc2.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.mcc3().get_selection()) { single_value->field_mcc3 = other_value.mcc3(); } else { single_value->field_mcc3.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.mnc3().get_selection()) { single_value->field_mnc3 = other_value.mnc3(); } else { single_value->field_mnc3.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.mnc1().get_selection()) { single_value->field_mnc1 = other_value.mnc1(); } else { single_value->field_mnc1.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.mnc2().get_selection()) { single_value->field_mnc2 = other_value.mnc2(); } else { single_value->field_mnc2.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.spare().get_selection()) { single_value->field_spare = other_value.spare(); } else { single_value->field_spare.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.homeENodeB__ID().get_selection()) { single_value->field_homeENodeB__ID = other_value.homeENodeB__ID(); } else { single_value->field_homeENodeB__ID.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.tac().get_selection()) { single_value->field_tac = other_value.tac(); } else { single_value->field_tac.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 HomeENodeB__ID_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 HomeENodeB__ID_template(*other_value.implication_.precondition); implication_.implied_template = new HomeENodeB__ID_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 @GTPC_Types.HomeENodeB_ID."); break; } set_selection(other_value); } HomeENodeB__ID_template::HomeENodeB__ID_template() { } HomeENodeB__ID_template::HomeENodeB__ID_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } HomeENodeB__ID_template::HomeENodeB__ID_template(const HomeENodeB__ID& other_value) { copy_value(other_value); } HomeENodeB__ID_template::HomeENodeB__ID_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const HomeENodeB__ID&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.HomeENodeB_ID from an unbound optional field."); } } HomeENodeB__ID_template::HomeENodeB__ID_template(HomeENodeB__ID_template* p_precondition, HomeENodeB__ID_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } HomeENodeB__ID_template::HomeENodeB__ID_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; } HomeENodeB__ID_template::HomeENodeB__ID_template(const HomeENodeB__ID_template& other_value) : Base_Template() { copy_template(other_value); } HomeENodeB__ID_template::~HomeENodeB__ID_template() { clean_up(); } HomeENodeB__ID_template& HomeENodeB__ID_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } HomeENodeB__ID_template& HomeENodeB__ID_template::operator=(const HomeENodeB__ID& other_value) { clean_up(); copy_value(other_value); return *this; } HomeENodeB__ID_template& HomeENodeB__ID_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const HomeENodeB__ID&)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 @GTPC_Types.HomeENodeB_ID."); } return *this; } HomeENodeB__ID_template& HomeENodeB__ID_template::operator=(const HomeENodeB__ID_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean HomeENodeB__ID_template::match(const HomeENodeB__ID& 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.mcc1().is_bound()) return FALSE; if(!single_value->field_mcc1.match(other_value.mcc1(), legacy))return FALSE; if(!other_value.mcc2().is_bound()) return FALSE; if(!single_value->field_mcc2.match(other_value.mcc2(), legacy))return FALSE; if(!other_value.mcc3().is_bound()) return FALSE; if(!single_value->field_mcc3.match(other_value.mcc3(), legacy))return FALSE; if(!other_value.mnc3().is_bound()) return FALSE; if(!single_value->field_mnc3.match(other_value.mnc3(), legacy))return FALSE; if(!other_value.mnc1().is_bound()) return FALSE; if(!single_value->field_mnc1.match(other_value.mnc1(), legacy))return FALSE; if(!other_value.mnc2().is_bound()) return FALSE; if(!single_value->field_mnc2.match(other_value.mnc2(), legacy))return FALSE; if(!other_value.spare().is_bound()) return FALSE; if(!single_value->field_spare.match(other_value.spare(), legacy))return FALSE; if(!other_value.homeENodeB__ID().is_bound()) return FALSE; if(!single_value->field_homeENodeB__ID.match(other_value.homeENodeB__ID(), legacy))return FALSE; if(!other_value.tac().is_bound()) return FALSE; if(!single_value->field_tac.match(other_value.tac(), 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 @GTPC_Types.HomeENodeB_ID."); } return FALSE; } boolean HomeENodeB__ID_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_mcc1.is_bound() || single_value->field_mcc2.is_bound() || single_value->field_mcc3.is_bound() || single_value->field_mnc3.is_bound() || single_value->field_mnc1.is_bound() || single_value->field_mnc2.is_bound() || single_value->field_spare.is_bound() || single_value->field_homeENodeB__ID.is_bound() || single_value->field_tac.is_bound(); } boolean HomeENodeB__ID_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_mcc1.is_value() && single_value->field_mcc2.is_value() && single_value->field_mcc3.is_value() && single_value->field_mnc3.is_value() && single_value->field_mnc1.is_value() && single_value->field_mnc2.is_value() && single_value->field_spare.is_value() && single_value->field_homeENodeB__ID.is_value() && single_value->field_tac.is_value(); } void HomeENodeB__ID_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; } HomeENodeB__ID HomeENodeB__ID_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 @GTPC_Types.HomeENodeB_ID."); HomeENodeB__ID ret_val; if (single_value->field_mcc1.is_bound()) { ret_val.mcc1() = single_value->field_mcc1.valueof(); } if (single_value->field_mcc2.is_bound()) { ret_val.mcc2() = single_value->field_mcc2.valueof(); } if (single_value->field_mcc3.is_bound()) { ret_val.mcc3() = single_value->field_mcc3.valueof(); } if (single_value->field_mnc3.is_bound()) { ret_val.mnc3() = single_value->field_mnc3.valueof(); } if (single_value->field_mnc1.is_bound()) { ret_val.mnc1() = single_value->field_mnc1.valueof(); } if (single_value->field_mnc2.is_bound()) { ret_val.mnc2() = single_value->field_mnc2.valueof(); } if (single_value->field_spare.is_bound()) { ret_val.spare() = single_value->field_spare.valueof(); } if (single_value->field_homeENodeB__ID.is_bound()) { ret_val.homeENodeB__ID() = single_value->field_homeENodeB__ID.valueof(); } if (single_value->field_tac.is_bound()) { ret_val.tac() = single_value->field_tac.valueof(); } return ret_val; } void HomeENodeB__ID_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 @GTPC_Types.HomeENodeB_ID."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new HomeENodeB__ID_template[list_length]; } HomeENodeB__ID_template& HomeENodeB__ID_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 @GTPC_Types.HomeENodeB_ID."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.HomeENodeB_ID."); return value_list.list_value[list_index]; } HEXSTRING_template& HomeENodeB__ID_template::mcc1() { set_specific(); return single_value->field_mcc1; } const HEXSTRING_template& HomeENodeB__ID_template::mcc1() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field mcc1 of a non-specific template of type @GTPC_Types.HomeENodeB_ID."); return single_value->field_mcc1; } HEXSTRING_template& HomeENodeB__ID_template::mcc2() { set_specific(); return single_value->field_mcc2; } const HEXSTRING_template& HomeENodeB__ID_template::mcc2() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field mcc2 of a non-specific template of type @GTPC_Types.HomeENodeB_ID."); return single_value->field_mcc2; } HEXSTRING_template& HomeENodeB__ID_template::mcc3() { set_specific(); return single_value->field_mcc3; } const HEXSTRING_template& HomeENodeB__ID_template::mcc3() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field mcc3 of a non-specific template of type @GTPC_Types.HomeENodeB_ID."); return single_value->field_mcc3; } HEXSTRING_template& HomeENodeB__ID_template::mnc3() { set_specific(); return single_value->field_mnc3; } const HEXSTRING_template& HomeENodeB__ID_template::mnc3() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field mnc3 of a non-specific template of type @GTPC_Types.HomeENodeB_ID."); return single_value->field_mnc3; } HEXSTRING_template& HomeENodeB__ID_template::mnc1() { set_specific(); return single_value->field_mnc1; } const HEXSTRING_template& HomeENodeB__ID_template::mnc1() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field mnc1 of a non-specific template of type @GTPC_Types.HomeENodeB_ID."); return single_value->field_mnc1; } HEXSTRING_template& HomeENodeB__ID_template::mnc2() { set_specific(); return single_value->field_mnc2; } const HEXSTRING_template& HomeENodeB__ID_template::mnc2() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field mnc2 of a non-specific template of type @GTPC_Types.HomeENodeB_ID."); return single_value->field_mnc2; } BITSTRING_template& HomeENodeB__ID_template::spare() { set_specific(); return single_value->field_spare; } const BITSTRING_template& HomeENodeB__ID_template::spare() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field spare of a non-specific template of type @GTPC_Types.HomeENodeB_ID."); return single_value->field_spare; } BITSTRING_template& HomeENodeB__ID_template::homeENodeB__ID() { set_specific(); return single_value->field_homeENodeB__ID; } const BITSTRING_template& HomeENodeB__ID_template::homeENodeB__ID() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field homeENodeB_ID of a non-specific template of type @GTPC_Types.HomeENodeB_ID."); return single_value->field_homeENodeB__ID; } OCTETSTRING_template& HomeENodeB__ID_template::tac() { set_specific(); return single_value->field_tac; } const OCTETSTRING_template& HomeENodeB__ID_template::tac() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field tac of a non-specific template of type @GTPC_Types.HomeENodeB_ID."); return single_value->field_tac; } int HomeENodeB__ID_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.HomeENodeB_ID which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 9; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @GTPC_Types.HomeENodeB_ID 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 @GTPC_Types.HomeENodeB_ID containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.HomeENodeB_ID containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.HomeENodeB_ID containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.HomeENodeB_ID containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.HomeENodeB_ID containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.HomeENodeB_ID containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.HomeENodeB_ID containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.HomeENodeB_ID."); } return 0; } void HomeENodeB__ID_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ mcc1 := "); single_value->field_mcc1.log(); TTCN_Logger::log_event_str(", mcc2 := "); single_value->field_mcc2.log(); TTCN_Logger::log_event_str(", mcc3 := "); single_value->field_mcc3.log(); TTCN_Logger::log_event_str(", mnc3 := "); single_value->field_mnc3.log(); TTCN_Logger::log_event_str(", mnc1 := "); single_value->field_mnc1.log(); TTCN_Logger::log_event_str(", mnc2 := "); single_value->field_mnc2.log(); TTCN_Logger::log_event_str(", spare := "); single_value->field_spare.log(); TTCN_Logger::log_event_str(", homeENodeB_ID := "); single_value->field_homeENodeB__ID.log(); TTCN_Logger::log_event_str(", tac := "); single_value->field_tac.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 HomeENodeB__ID_template::log_match(const HomeENodeB__ID& 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_mcc1.match(match_value.mcc1(), legacy)){ TTCN_Logger::log_logmatch_info(".mcc1"); single_value->field_mcc1.log_match(match_value.mcc1(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_mcc2.match(match_value.mcc2(), legacy)){ TTCN_Logger::log_logmatch_info(".mcc2"); single_value->field_mcc2.log_match(match_value.mcc2(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_mcc3.match(match_value.mcc3(), legacy)){ TTCN_Logger::log_logmatch_info(".mcc3"); single_value->field_mcc3.log_match(match_value.mcc3(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_mnc3.match(match_value.mnc3(), legacy)){ TTCN_Logger::log_logmatch_info(".mnc3"); single_value->field_mnc3.log_match(match_value.mnc3(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_mnc1.match(match_value.mnc1(), legacy)){ TTCN_Logger::log_logmatch_info(".mnc1"); single_value->field_mnc1.log_match(match_value.mnc1(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_mnc2.match(match_value.mnc2(), legacy)){ TTCN_Logger::log_logmatch_info(".mnc2"); single_value->field_mnc2.log_match(match_value.mnc2(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_spare.match(match_value.spare(), legacy)){ TTCN_Logger::log_logmatch_info(".spare"); single_value->field_spare.log_match(match_value.spare(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_homeENodeB__ID.match(match_value.homeENodeB__ID(), legacy)){ TTCN_Logger::log_logmatch_info(".homeENodeB_ID"); single_value->field_homeENodeB__ID.log_match(match_value.homeENodeB__ID(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_tac.match(match_value.tac(), legacy)){ TTCN_Logger::log_logmatch_info(".tac"); single_value->field_tac.log_match(match_value.tac(), 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("{ mcc1 := "); single_value->field_mcc1.log_match(match_value.mcc1(), legacy); TTCN_Logger::log_event_str(", mcc2 := "); single_value->field_mcc2.log_match(match_value.mcc2(), legacy); TTCN_Logger::log_event_str(", mcc3 := "); single_value->field_mcc3.log_match(match_value.mcc3(), legacy); TTCN_Logger::log_event_str(", mnc3 := "); single_value->field_mnc3.log_match(match_value.mnc3(), legacy); TTCN_Logger::log_event_str(", mnc1 := "); single_value->field_mnc1.log_match(match_value.mnc1(), legacy); TTCN_Logger::log_event_str(", mnc2 := "); single_value->field_mnc2.log_match(match_value.mnc2(), legacy); TTCN_Logger::log_event_str(", spare := "); single_value->field_spare.log_match(match_value.spare(), legacy); TTCN_Logger::log_event_str(", homeENodeB_ID := "); single_value->field_homeENodeB__ID.log_match(match_value.homeENodeB__ID(), legacy); TTCN_Logger::log_event_str(", tac := "); single_value->field_tac.log_match(match_value.tac(), 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 HomeENodeB__ID_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_mcc1.encode_text(text_buf); single_value->field_mcc2.encode_text(text_buf); single_value->field_mcc3.encode_text(text_buf); single_value->field_mnc3.encode_text(text_buf); single_value->field_mnc1.encode_text(text_buf); single_value->field_mnc2.encode_text(text_buf); single_value->field_spare.encode_text(text_buf); single_value->field_homeENodeB__ID.encode_text(text_buf); single_value->field_tac.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 @GTPC_Types.HomeENodeB_ID."); } } void HomeENodeB__ID_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_mcc1.decode_text(text_buf); single_value->field_mcc2.decode_text(text_buf); single_value->field_mcc3.decode_text(text_buf); single_value->field_mnc3.decode_text(text_buf); single_value->field_mnc1.decode_text(text_buf); single_value->field_mnc2.decode_text(text_buf); single_value->field_spare.decode_text(text_buf); single_value->field_homeENodeB__ID.decode_text(text_buf); single_value->field_tac.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 HomeENodeB__ID_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 @GTPC_Types.HomeENodeB_ID."); } } void HomeENodeB__ID_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: { HomeENodeB__ID_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) mcc1().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) mcc2().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) mcc3().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) mnc3().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) mnc1().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) mnc2().set_param(*param.get_elem(5)); if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(6)); if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) homeENodeB__ID().set_param(*param.get_elem(7)); if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) tac().set_param(*param.get_elem(8)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "mcc1")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mcc1().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mcc2")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mcc2().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mcc3")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mcc3().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mnc3")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mnc3().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mnc1")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mnc1().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mnc2")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mnc2().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "spare")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "homeENodeB_ID")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { homeENodeB__ID().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "tac")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { tac().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.HomeENodeB_ID: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { HomeENodeB__ID_template* precondition = new HomeENodeB__ID_template; precondition->set_param(*param.get_elem(0)); HomeENodeB__ID_template* implied_template = new HomeENodeB__ID_template; implied_template->set_param(*param.get_elem(1)); *this = HomeENodeB__ID_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.HomeENodeB_ID"); } is_ifpresent = param.get_ifpresent(); } void HomeENodeB__ID_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_mcc1.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.HomeENodeB_ID"); single_value->field_mcc2.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.HomeENodeB_ID"); single_value->field_mcc3.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.HomeENodeB_ID"); single_value->field_mnc3.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.HomeENodeB_ID"); single_value->field_mnc1.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.HomeENodeB_ID"); single_value->field_mnc2.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.HomeENodeB_ID"); single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.HomeENodeB_ID"); single_value->field_homeENodeB__ID.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.HomeENodeB_ID"); single_value->field_tac.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.HomeENodeB_ID"); 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 : "@GTPC_Types.HomeENodeB_ID"); } boolean HomeENodeB__ID_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean HomeENodeB__ID_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) mcc1().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) mcc2().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) mcc3().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) mnc3().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) mnc1().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) mnc2().set_param(*param.get_elem(5)); if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(6)); if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) macroENodeB__ID().set_param(*param.get_elem(7)); if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) tac().set_param(*param.get_elem(8)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "mcc1")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mcc1().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mcc2")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mcc2().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mcc3")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mcc3().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mnc3")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mnc3().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mnc1")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mnc1().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mnc2")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mnc2().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "spare")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "macroENodeB_ID")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { macroENodeB__ID().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "tac")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { tac().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.MacroENodeB_ID: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.MacroENodeB_ID"); } } void MacroENodeB__ID::encode_text(Text_Buf& text_buf) const { field_mcc1.encode_text(text_buf); field_mcc2.encode_text(text_buf); field_mcc3.encode_text(text_buf); field_mnc3.encode_text(text_buf); field_mnc1.encode_text(text_buf); field_mnc2.encode_text(text_buf); field_spare.encode_text(text_buf); field_macroENodeB__ID.encode_text(text_buf); field_tac.encode_text(text_buf); } void MacroENodeB__ID::decode_text(Text_Buf& text_buf) { field_mcc1.decode_text(text_buf); field_mcc2.decode_text(text_buf); field_mcc3.decode_text(text_buf); field_mnc3.decode_text(text_buf); field_mnc1.decode_text(text_buf); field_mnc2.decode_text(text_buf); field_spare.decode_text(text_buf); field_macroENodeB__ID.decode_text(text_buf); field_tac.decode_text(text_buf); } void MacroENodeB__ID::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 MacroENodeB__ID::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 MacroENodeB__ID::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::HEX1_descr_.raw->forceomit); decoded_field_length = field_mcc1.RAW_decode(General__Types::HEX1_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::HEX1_descr_.raw->forceomit); decoded_field_length = field_mcc2.RAW_decode(General__Types::HEX1_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::HEX1_descr_.raw->forceomit); decoded_field_length = field_mcc3.RAW_decode(General__Types::HEX1_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::HEX1_descr_.raw->forceomit); decoded_field_length = field_mnc3.RAW_decode(General__Types::HEX1_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_3_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); RAW_Force_Omit field_4_force_omit(4, force_omit, General__Types::HEX1_descr_.raw->forceomit); decoded_field_length = field_mnc1.RAW_decode(General__Types::HEX1_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_4_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); RAW_Force_Omit field_5_force_omit(5, force_omit, General__Types::HEX1_descr_.raw->forceomit); decoded_field_length = field_mnc2.RAW_decode(General__Types::HEX1_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_5_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); RAW_Force_Omit field_6_force_omit(6, force_omit, MacroENodeB__ID_spare_descr_.raw->forceomit); decoded_field_length = field_spare.RAW_decode(MacroENodeB__ID_spare_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_6_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); RAW_Force_Omit field_7_force_omit(7, force_omit, MacroENodeB__ID_macroENodeB__ID_descr_.raw->forceomit); decoded_field_length = field_macroENodeB__ID.RAW_decode(MacroENodeB__ID_macroENodeB__ID_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_7_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); RAW_Force_Omit field_8_force_omit(8, force_omit, General__Types::OCT2_descr_.raw->forceomit); decoded_field_length = field_tac.RAW_decode(General__Types::OCT2_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_8_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int MacroENodeB__ID::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const { if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value."); int encoded_length = 0; myleaf.isleaf = FALSE; myleaf.body.node.num_of_nodes = 9; myleaf.body.node.nodes = init_nodes_of_enc_tree(9); myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, General__Types::HEX1_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, General__Types::HEX1_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, General__Types::HEX1_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::HEX1_descr_.raw); myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, General__Types::HEX1_descr_.raw); myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, General__Types::HEX1_descr_.raw); myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, MacroENodeB__ID_spare_descr_.raw); myleaf.body.node.nodes[7] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 7, MacroENodeB__ID_macroENodeB__ID_descr_.raw); myleaf.body.node.nodes[8] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 8, General__Types::OCT2_descr_.raw); encoded_length += field_mcc1.RAW_encode(General__Types::HEX1_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_mcc2.RAW_encode(General__Types::HEX1_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_mcc3.RAW_encode(General__Types::HEX1_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_mnc3.RAW_encode(General__Types::HEX1_descr_, *myleaf.body.node.nodes[3]); encoded_length += field_mnc1.RAW_encode(General__Types::HEX1_descr_, *myleaf.body.node.nodes[4]); encoded_length += field_mnc2.RAW_encode(General__Types::HEX1_descr_, *myleaf.body.node.nodes[5]); encoded_length += field_spare.RAW_encode(MacroENodeB__ID_spare_descr_, *myleaf.body.node.nodes[6]); encoded_length += field_macroENodeB__ID.RAW_encode(MacroENodeB__ID_macroENodeB__ID_descr_, *myleaf.body.node.nodes[7]); encoded_length += field_tac.RAW_encode(General__Types::OCT2_descr_, *myleaf.body.node.nodes[8]); return myleaf.length = encoded_length; } struct MacroENodeB__ID_template::single_value_struct { HEXSTRING_template field_mcc1; HEXSTRING_template field_mcc2; HEXSTRING_template field_mcc3; HEXSTRING_template field_mnc3; HEXSTRING_template field_mnc1; HEXSTRING_template field_mnc2; BITSTRING_template field_spare; BITSTRING_template field_macroENodeB__ID; OCTETSTRING_template field_tac; }; void MacroENodeB__ID_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_mcc1 = ANY_VALUE; single_value->field_mcc2 = ANY_VALUE; single_value->field_mcc3 = ANY_VALUE; single_value->field_mnc3 = ANY_VALUE; single_value->field_mnc1 = ANY_VALUE; single_value->field_mnc2 = ANY_VALUE; single_value->field_spare = ANY_VALUE; single_value->field_macroENodeB__ID = ANY_VALUE; single_value->field_tac = ANY_VALUE; } } } void MacroENodeB__ID_template::copy_value(const MacroENodeB__ID& other_value) { single_value = new single_value_struct; if (other_value.mcc1().is_bound()) { single_value->field_mcc1 = other_value.mcc1(); } else { single_value->field_mcc1.clean_up(); } if (other_value.mcc2().is_bound()) { single_value->field_mcc2 = other_value.mcc2(); } else { single_value->field_mcc2.clean_up(); } if (other_value.mcc3().is_bound()) { single_value->field_mcc3 = other_value.mcc3(); } else { single_value->field_mcc3.clean_up(); } if (other_value.mnc3().is_bound()) { single_value->field_mnc3 = other_value.mnc3(); } else { single_value->field_mnc3.clean_up(); } if (other_value.mnc1().is_bound()) { single_value->field_mnc1 = other_value.mnc1(); } else { single_value->field_mnc1.clean_up(); } if (other_value.mnc2().is_bound()) { single_value->field_mnc2 = other_value.mnc2(); } else { single_value->field_mnc2.clean_up(); } if (other_value.spare().is_bound()) { single_value->field_spare = other_value.spare(); } else { single_value->field_spare.clean_up(); } if (other_value.macroENodeB__ID().is_bound()) { single_value->field_macroENodeB__ID = other_value.macroENodeB__ID(); } else { single_value->field_macroENodeB__ID.clean_up(); } if (other_value.tac().is_bound()) { single_value->field_tac = other_value.tac(); } else { single_value->field_tac.clean_up(); } set_selection(SPECIFIC_VALUE); } void MacroENodeB__ID_template::copy_template(const MacroENodeB__ID_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.mcc1().get_selection()) { single_value->field_mcc1 = other_value.mcc1(); } else { single_value->field_mcc1.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.mcc2().get_selection()) { single_value->field_mcc2 = other_value.mcc2(); } else { single_value->field_mcc2.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.mcc3().get_selection()) { single_value->field_mcc3 = other_value.mcc3(); } else { single_value->field_mcc3.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.mnc3().get_selection()) { single_value->field_mnc3 = other_value.mnc3(); } else { single_value->field_mnc3.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.mnc1().get_selection()) { single_value->field_mnc1 = other_value.mnc1(); } else { single_value->field_mnc1.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.mnc2().get_selection()) { single_value->field_mnc2 = other_value.mnc2(); } else { single_value->field_mnc2.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.spare().get_selection()) { single_value->field_spare = other_value.spare(); } else { single_value->field_spare.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.macroENodeB__ID().get_selection()) { single_value->field_macroENodeB__ID = other_value.macroENodeB__ID(); } else { single_value->field_macroENodeB__ID.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.tac().get_selection()) { single_value->field_tac = other_value.tac(); } else { single_value->field_tac.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 MacroENodeB__ID_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 MacroENodeB__ID_template(*other_value.implication_.precondition); implication_.implied_template = new MacroENodeB__ID_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 @GTPC_Types.MacroENodeB_ID."); break; } set_selection(other_value); } MacroENodeB__ID_template::MacroENodeB__ID_template() { } MacroENodeB__ID_template::MacroENodeB__ID_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } MacroENodeB__ID_template::MacroENodeB__ID_template(const MacroENodeB__ID& other_value) { copy_value(other_value); } MacroENodeB__ID_template::MacroENodeB__ID_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const MacroENodeB__ID&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.MacroENodeB_ID from an unbound optional field."); } } MacroENodeB__ID_template::MacroENodeB__ID_template(MacroENodeB__ID_template* p_precondition, MacroENodeB__ID_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } MacroENodeB__ID_template::MacroENodeB__ID_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; } MacroENodeB__ID_template::MacroENodeB__ID_template(const MacroENodeB__ID_template& other_value) : Base_Template() { copy_template(other_value); } MacroENodeB__ID_template::~MacroENodeB__ID_template() { clean_up(); } MacroENodeB__ID_template& MacroENodeB__ID_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } MacroENodeB__ID_template& MacroENodeB__ID_template::operator=(const MacroENodeB__ID& other_value) { clean_up(); copy_value(other_value); return *this; } MacroENodeB__ID_template& MacroENodeB__ID_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const MacroENodeB__ID&)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 @GTPC_Types.MacroENodeB_ID."); } return *this; } MacroENodeB__ID_template& MacroENodeB__ID_template::operator=(const MacroENodeB__ID_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean MacroENodeB__ID_template::match(const MacroENodeB__ID& 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.mcc1().is_bound()) return FALSE; if(!single_value->field_mcc1.match(other_value.mcc1(), legacy))return FALSE; if(!other_value.mcc2().is_bound()) return FALSE; if(!single_value->field_mcc2.match(other_value.mcc2(), legacy))return FALSE; if(!other_value.mcc3().is_bound()) return FALSE; if(!single_value->field_mcc3.match(other_value.mcc3(), legacy))return FALSE; if(!other_value.mnc3().is_bound()) return FALSE; if(!single_value->field_mnc3.match(other_value.mnc3(), legacy))return FALSE; if(!other_value.mnc1().is_bound()) return FALSE; if(!single_value->field_mnc1.match(other_value.mnc1(), legacy))return FALSE; if(!other_value.mnc2().is_bound()) return FALSE; if(!single_value->field_mnc2.match(other_value.mnc2(), legacy))return FALSE; if(!other_value.spare().is_bound()) return FALSE; if(!single_value->field_spare.match(other_value.spare(), legacy))return FALSE; if(!other_value.macroENodeB__ID().is_bound()) return FALSE; if(!single_value->field_macroENodeB__ID.match(other_value.macroENodeB__ID(), legacy))return FALSE; if(!other_value.tac().is_bound()) return FALSE; if(!single_value->field_tac.match(other_value.tac(), 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 @GTPC_Types.MacroENodeB_ID."); } return FALSE; } boolean MacroENodeB__ID_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_mcc1.is_bound() || single_value->field_mcc2.is_bound() || single_value->field_mcc3.is_bound() || single_value->field_mnc3.is_bound() || single_value->field_mnc1.is_bound() || single_value->field_mnc2.is_bound() || single_value->field_spare.is_bound() || single_value->field_macroENodeB__ID.is_bound() || single_value->field_tac.is_bound(); } boolean MacroENodeB__ID_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_mcc1.is_value() && single_value->field_mcc2.is_value() && single_value->field_mcc3.is_value() && single_value->field_mnc3.is_value() && single_value->field_mnc1.is_value() && single_value->field_mnc2.is_value() && single_value->field_spare.is_value() && single_value->field_macroENodeB__ID.is_value() && single_value->field_tac.is_value(); } void MacroENodeB__ID_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; } MacroENodeB__ID MacroENodeB__ID_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 @GTPC_Types.MacroENodeB_ID."); MacroENodeB__ID ret_val; if (single_value->field_mcc1.is_bound()) { ret_val.mcc1() = single_value->field_mcc1.valueof(); } if (single_value->field_mcc2.is_bound()) { ret_val.mcc2() = single_value->field_mcc2.valueof(); } if (single_value->field_mcc3.is_bound()) { ret_val.mcc3() = single_value->field_mcc3.valueof(); } if (single_value->field_mnc3.is_bound()) { ret_val.mnc3() = single_value->field_mnc3.valueof(); } if (single_value->field_mnc1.is_bound()) { ret_val.mnc1() = single_value->field_mnc1.valueof(); } if (single_value->field_mnc2.is_bound()) { ret_val.mnc2() = single_value->field_mnc2.valueof(); } if (single_value->field_spare.is_bound()) { ret_val.spare() = single_value->field_spare.valueof(); } if (single_value->field_macroENodeB__ID.is_bound()) { ret_val.macroENodeB__ID() = single_value->field_macroENodeB__ID.valueof(); } if (single_value->field_tac.is_bound()) { ret_val.tac() = single_value->field_tac.valueof(); } return ret_val; } void MacroENodeB__ID_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 @GTPC_Types.MacroENodeB_ID."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new MacroENodeB__ID_template[list_length]; } MacroENodeB__ID_template& MacroENodeB__ID_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 @GTPC_Types.MacroENodeB_ID."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.MacroENodeB_ID."); return value_list.list_value[list_index]; } HEXSTRING_template& MacroENodeB__ID_template::mcc1() { set_specific(); return single_value->field_mcc1; } const HEXSTRING_template& MacroENodeB__ID_template::mcc1() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field mcc1 of a non-specific template of type @GTPC_Types.MacroENodeB_ID."); return single_value->field_mcc1; } HEXSTRING_template& MacroENodeB__ID_template::mcc2() { set_specific(); return single_value->field_mcc2; } const HEXSTRING_template& MacroENodeB__ID_template::mcc2() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field mcc2 of a non-specific template of type @GTPC_Types.MacroENodeB_ID."); return single_value->field_mcc2; } HEXSTRING_template& MacroENodeB__ID_template::mcc3() { set_specific(); return single_value->field_mcc3; } const HEXSTRING_template& MacroENodeB__ID_template::mcc3() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field mcc3 of a non-specific template of type @GTPC_Types.MacroENodeB_ID."); return single_value->field_mcc3; } HEXSTRING_template& MacroENodeB__ID_template::mnc3() { set_specific(); return single_value->field_mnc3; } const HEXSTRING_template& MacroENodeB__ID_template::mnc3() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field mnc3 of a non-specific template of type @GTPC_Types.MacroENodeB_ID."); return single_value->field_mnc3; } HEXSTRING_template& MacroENodeB__ID_template::mnc1() { set_specific(); return single_value->field_mnc1; } const HEXSTRING_template& MacroENodeB__ID_template::mnc1() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field mnc1 of a non-specific template of type @GTPC_Types.MacroENodeB_ID."); return single_value->field_mnc1; } HEXSTRING_template& MacroENodeB__ID_template::mnc2() { set_specific(); return single_value->field_mnc2; } const HEXSTRING_template& MacroENodeB__ID_template::mnc2() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field mnc2 of a non-specific template of type @GTPC_Types.MacroENodeB_ID."); return single_value->field_mnc2; } BITSTRING_template& MacroENodeB__ID_template::spare() { set_specific(); return single_value->field_spare; } const BITSTRING_template& MacroENodeB__ID_template::spare() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field spare of a non-specific template of type @GTPC_Types.MacroENodeB_ID."); return single_value->field_spare; } BITSTRING_template& MacroENodeB__ID_template::macroENodeB__ID() { set_specific(); return single_value->field_macroENodeB__ID; } const BITSTRING_template& MacroENodeB__ID_template::macroENodeB__ID() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field macroENodeB_ID of a non-specific template of type @GTPC_Types.MacroENodeB_ID."); return single_value->field_macroENodeB__ID; } OCTETSTRING_template& MacroENodeB__ID_template::tac() { set_specific(); return single_value->field_tac; } const OCTETSTRING_template& MacroENodeB__ID_template::tac() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field tac of a non-specific template of type @GTPC_Types.MacroENodeB_ID."); return single_value->field_tac; } int MacroENodeB__ID_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MacroENodeB_ID which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 9; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @GTPC_Types.MacroENodeB_ID 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 @GTPC_Types.MacroENodeB_ID containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MacroENodeB_ID containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MacroENodeB_ID containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MacroENodeB_ID containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MacroENodeB_ID containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MacroENodeB_ID containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.MacroENodeB_ID containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.MacroENodeB_ID."); } return 0; } void MacroENodeB__ID_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ mcc1 := "); single_value->field_mcc1.log(); TTCN_Logger::log_event_str(", mcc2 := "); single_value->field_mcc2.log(); TTCN_Logger::log_event_str(", mcc3 := "); single_value->field_mcc3.log(); TTCN_Logger::log_event_str(", mnc3 := "); single_value->field_mnc3.log(); TTCN_Logger::log_event_str(", mnc1 := "); single_value->field_mnc1.log(); TTCN_Logger::log_event_str(", mnc2 := "); single_value->field_mnc2.log(); TTCN_Logger::log_event_str(", spare := "); single_value->field_spare.log(); TTCN_Logger::log_event_str(", macroENodeB_ID := "); single_value->field_macroENodeB__ID.log(); TTCN_Logger::log_event_str(", tac := "); single_value->field_tac.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 MacroENodeB__ID_template::log_match(const MacroENodeB__ID& 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_mcc1.match(match_value.mcc1(), legacy)){ TTCN_Logger::log_logmatch_info(".mcc1"); single_value->field_mcc1.log_match(match_value.mcc1(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_mcc2.match(match_value.mcc2(), legacy)){ TTCN_Logger::log_logmatch_info(".mcc2"); single_value->field_mcc2.log_match(match_value.mcc2(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_mcc3.match(match_value.mcc3(), legacy)){ TTCN_Logger::log_logmatch_info(".mcc3"); single_value->field_mcc3.log_match(match_value.mcc3(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_mnc3.match(match_value.mnc3(), legacy)){ TTCN_Logger::log_logmatch_info(".mnc3"); single_value->field_mnc3.log_match(match_value.mnc3(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_mnc1.match(match_value.mnc1(), legacy)){ TTCN_Logger::log_logmatch_info(".mnc1"); single_value->field_mnc1.log_match(match_value.mnc1(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_mnc2.match(match_value.mnc2(), legacy)){ TTCN_Logger::log_logmatch_info(".mnc2"); single_value->field_mnc2.log_match(match_value.mnc2(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_spare.match(match_value.spare(), legacy)){ TTCN_Logger::log_logmatch_info(".spare"); single_value->field_spare.log_match(match_value.spare(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_macroENodeB__ID.match(match_value.macroENodeB__ID(), legacy)){ TTCN_Logger::log_logmatch_info(".macroENodeB_ID"); single_value->field_macroENodeB__ID.log_match(match_value.macroENodeB__ID(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_tac.match(match_value.tac(), legacy)){ TTCN_Logger::log_logmatch_info(".tac"); single_value->field_tac.log_match(match_value.tac(), 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("{ mcc1 := "); single_value->field_mcc1.log_match(match_value.mcc1(), legacy); TTCN_Logger::log_event_str(", mcc2 := "); single_value->field_mcc2.log_match(match_value.mcc2(), legacy); TTCN_Logger::log_event_str(", mcc3 := "); single_value->field_mcc3.log_match(match_value.mcc3(), legacy); TTCN_Logger::log_event_str(", mnc3 := "); single_value->field_mnc3.log_match(match_value.mnc3(), legacy); TTCN_Logger::log_event_str(", mnc1 := "); single_value->field_mnc1.log_match(match_value.mnc1(), legacy); TTCN_Logger::log_event_str(", mnc2 := "); single_value->field_mnc2.log_match(match_value.mnc2(), legacy); TTCN_Logger::log_event_str(", spare := "); single_value->field_spare.log_match(match_value.spare(), legacy); TTCN_Logger::log_event_str(", macroENodeB_ID := "); single_value->field_macroENodeB__ID.log_match(match_value.macroENodeB__ID(), legacy); TTCN_Logger::log_event_str(", tac := "); single_value->field_tac.log_match(match_value.tac(), 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 MacroENodeB__ID_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_mcc1.encode_text(text_buf); single_value->field_mcc2.encode_text(text_buf); single_value->field_mcc3.encode_text(text_buf); single_value->field_mnc3.encode_text(text_buf); single_value->field_mnc1.encode_text(text_buf); single_value->field_mnc2.encode_text(text_buf); single_value->field_spare.encode_text(text_buf); single_value->field_macroENodeB__ID.encode_text(text_buf); single_value->field_tac.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 @GTPC_Types.MacroENodeB_ID."); } } void MacroENodeB__ID_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_mcc1.decode_text(text_buf); single_value->field_mcc2.decode_text(text_buf); single_value->field_mcc3.decode_text(text_buf); single_value->field_mnc3.decode_text(text_buf); single_value->field_mnc1.decode_text(text_buf); single_value->field_mnc2.decode_text(text_buf); single_value->field_spare.decode_text(text_buf); single_value->field_macroENodeB__ID.decode_text(text_buf); single_value->field_tac.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 MacroENodeB__ID_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 @GTPC_Types.MacroENodeB_ID."); } } void MacroENodeB__ID_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: { MacroENodeB__ID_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) mcc1().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) mcc2().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) mcc3().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) mnc3().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) mnc1().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) mnc2().set_param(*param.get_elem(5)); if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(6)); if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) macroENodeB__ID().set_param(*param.get_elem(7)); if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) tac().set_param(*param.get_elem(8)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "mcc1")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mcc1().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mcc2")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mcc2().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mcc3")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mcc3().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mnc3")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mnc3().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mnc1")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mnc1().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mnc2")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mnc2().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "spare")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "macroENodeB_ID")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { macroENodeB__ID().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "tac")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { tac().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.MacroENodeB_ID: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { MacroENodeB__ID_template* precondition = new MacroENodeB__ID_template; precondition->set_param(*param.get_elem(0)); MacroENodeB__ID_template* implied_template = new MacroENodeB__ID_template; implied_template->set_param(*param.get_elem(1)); *this = MacroENodeB__ID_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.MacroENodeB_ID"); } is_ifpresent = param.get_ifpresent(); } void MacroENodeB__ID_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_mcc1.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.MacroENodeB_ID"); single_value->field_mcc2.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.MacroENodeB_ID"); single_value->field_mcc3.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.MacroENodeB_ID"); single_value->field_mnc3.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.MacroENodeB_ID"); single_value->field_mnc1.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.MacroENodeB_ID"); single_value->field_mnc2.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.MacroENodeB_ID"); single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.MacroENodeB_ID"); single_value->field_macroENodeB__ID.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.MacroENodeB_ID"); single_value->field_tac.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.MacroENodeB_ID"); 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 : "@GTPC_Types.MacroENodeB_ID"); } boolean MacroENodeB__ID_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean MacroENodeB__ID_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) eNodeB__type().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) eNodeB__ID().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "eNodeB_type")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { eNodeB__type().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "eNodeB_ID")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { eNodeB__ID().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.ENodeB_ID: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.ENodeB_ID"); } } void ENodeB__ID::encode_text(Text_Buf& text_buf) const { field_type__gtpc.encode_text(text_buf); field_lengthf.encode_text(text_buf); field_eNodeB__type.encode_text(text_buf); field_eNodeB__ID.encode_text(text_buf); } void ENodeB__ID::decode_text(Text_Buf& text_buf) { field_type__gtpc.decode_text(text_buf); field_lengthf.decode_text(text_buf); field_eNodeB__type.decode_text(text_buf); field_eNodeB__ID.decode_text(text_buf); } void ENodeB__ID::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 ENodeB__ID::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 ENodeB__ID::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; int value_of_length_field1 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_type__gtpc.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, ENodeB__ID_lengthf_descr_.raw->forceomit); decoded_field_length = field_lengthf.RAW_decode(ENodeB__ID_lengthf_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()); INTEGER tmp1 = field_lengthf.convert_to_Integer(ENodeB__ID_lengthf_descr_); field_lengthf = tmp1; value_of_length_field1 += tmp1.get_long_long_val() * 8; RAW_Force_Omit field_2_force_omit(2, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_eNodeB__type.RAW_decode(General__Types::OCT1_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_3_force_omit(3, force_omit, ENodeB__IDs_descr_.raw->forceomit); decoded_field_length = field_eNodeB__ID.RAW_decode(ENodeB__IDs_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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_field1 -= decoded_field_length; if (field_type__gtpc != os_99) return -1; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int ENodeB__ID::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, ENodeB__ID_lengthf_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, ENodeB__IDs_descr_.raw); encoded_length += field_type__gtpc.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += 16; myleaf.body.node.nodes[1]->calc = CALC_LENGTH; myleaf.body.node.nodes[1]->coding_descr = &ENodeB__ID_lengthf_descr_; myleaf.body.node.nodes[1]->calcof.lengthto.num_of_fields = 2; myleaf.body.node.nodes[1]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[1]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields = init_lengthto_fields_list(2); myleaf.body.node.nodes[1]->length = 16; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[2]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[2]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].level = myleaf.body.node.nodes[3]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].pos = myleaf.body.node.nodes[3]->curr_pos.pos; encoded_length += field_eNodeB__type.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_eNodeB__ID.RAW_encode(ENodeB__IDs_descr_, *myleaf.body.node.nodes[3]); if (field_type__gtpc != os_99) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={0}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ os_99.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 ENodeB__ID_template::single_value_struct { OCTETSTRING_template field_type__gtpc; INTEGER_template field_lengthf; OCTETSTRING_template field_eNodeB__type; ENodeB__IDs_template field_eNodeB__ID; }; void ENodeB__ID_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_type__gtpc = ANY_VALUE; single_value->field_lengthf = ANY_VALUE; single_value->field_eNodeB__type = ANY_VALUE; single_value->field_eNodeB__ID = ANY_VALUE; } } } void ENodeB__ID_template::copy_value(const ENodeB__ID& other_value) { single_value = new single_value_struct; if (other_value.type__gtpc().is_bound()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (other_value.lengthf().is_bound()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (other_value.eNodeB__type().is_bound()) { single_value->field_eNodeB__type = other_value.eNodeB__type(); } else { single_value->field_eNodeB__type.clean_up(); } if (other_value.eNodeB__ID().is_bound()) { single_value->field_eNodeB__ID = other_value.eNodeB__ID(); } else { single_value->field_eNodeB__ID.clean_up(); } set_selection(SPECIFIC_VALUE); } void ENodeB__ID_template::copy_template(const ENodeB__ID_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.type__gtpc().get_selection()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lengthf().get_selection()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.eNodeB__type().get_selection()) { single_value->field_eNodeB__type = other_value.eNodeB__type(); } else { single_value->field_eNodeB__type.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.eNodeB__ID().get_selection()) { single_value->field_eNodeB__ID = other_value.eNodeB__ID(); } else { single_value->field_eNodeB__ID.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 ENodeB__ID_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 ENodeB__ID_template(*other_value.implication_.precondition); implication_.implied_template = new ENodeB__ID_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 @GTPC_Types.ENodeB_ID."); break; } set_selection(other_value); } ENodeB__ID_template::ENodeB__ID_template() { } ENodeB__ID_template::ENodeB__ID_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } ENodeB__ID_template::ENodeB__ID_template(const ENodeB__ID& other_value) { copy_value(other_value); } ENodeB__ID_template::ENodeB__ID_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const ENodeB__ID&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.ENodeB_ID from an unbound optional field."); } } ENodeB__ID_template::ENodeB__ID_template(ENodeB__ID_template* p_precondition, ENodeB__ID_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } ENodeB__ID_template::ENodeB__ID_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; } ENodeB__ID_template::ENodeB__ID_template(const ENodeB__ID_template& other_value) : Base_Template() { copy_template(other_value); } ENodeB__ID_template::~ENodeB__ID_template() { clean_up(); } ENodeB__ID_template& ENodeB__ID_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } ENodeB__ID_template& ENodeB__ID_template::operator=(const ENodeB__ID& other_value) { clean_up(); copy_value(other_value); return *this; } ENodeB__ID_template& ENodeB__ID_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const ENodeB__ID&)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 @GTPC_Types.ENodeB_ID."); } return *this; } ENodeB__ID_template& ENodeB__ID_template::operator=(const ENodeB__ID_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean ENodeB__ID_template::match(const ENodeB__ID& 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.type__gtpc().is_bound()) return FALSE; if(!single_value->field_type__gtpc.match(other_value.type__gtpc(), legacy))return FALSE; if(!other_value.lengthf().is_bound()) return FALSE; if(!single_value->field_lengthf.match(other_value.lengthf(), legacy))return FALSE; if(!other_value.eNodeB__type().is_bound()) return FALSE; if(!single_value->field_eNodeB__type.match(other_value.eNodeB__type(), legacy))return FALSE; if(!other_value.eNodeB__ID().is_bound()) return FALSE; if(!single_value->field_eNodeB__ID.match(other_value.eNodeB__ID(), 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 @GTPC_Types.ENodeB_ID."); } return FALSE; } boolean ENodeB__ID_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_type__gtpc.is_bound() || single_value->field_lengthf.is_bound() || single_value->field_eNodeB__type.is_bound() || single_value->field_eNodeB__ID.is_bound(); } boolean ENodeB__ID_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_type__gtpc.is_value() && single_value->field_lengthf.is_value() && single_value->field_eNodeB__type.is_value() && single_value->field_eNodeB__ID.is_value(); } void ENodeB__ID_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; } ENodeB__ID ENodeB__ID_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 @GTPC_Types.ENodeB_ID."); ENodeB__ID ret_val; if (single_value->field_type__gtpc.is_bound()) { ret_val.type__gtpc() = single_value->field_type__gtpc.valueof(); } if (single_value->field_lengthf.is_bound()) { ret_val.lengthf() = single_value->field_lengthf.valueof(); } if (single_value->field_eNodeB__type.is_bound()) { ret_val.eNodeB__type() = single_value->field_eNodeB__type.valueof(); } if (single_value->field_eNodeB__ID.is_bound()) { ret_val.eNodeB__ID() = single_value->field_eNodeB__ID.valueof(); } return ret_val; } void ENodeB__ID_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 @GTPC_Types.ENodeB_ID."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new ENodeB__ID_template[list_length]; } ENodeB__ID_template& ENodeB__ID_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 @GTPC_Types.ENodeB_ID."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.ENodeB_ID."); return value_list.list_value[list_index]; } OCTETSTRING_template& ENodeB__ID_template::type__gtpc() { set_specific(); return single_value->field_type__gtpc; } const OCTETSTRING_template& ENodeB__ID_template::type__gtpc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field type_gtpc of a non-specific template of type @GTPC_Types.ENodeB_ID."); return single_value->field_type__gtpc; } INTEGER_template& ENodeB__ID_template::lengthf() { set_specific(); return single_value->field_lengthf; } const INTEGER_template& ENodeB__ID_template::lengthf() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthf of a non-specific template of type @GTPC_Types.ENodeB_ID."); return single_value->field_lengthf; } OCTETSTRING_template& ENodeB__ID_template::eNodeB__type() { set_specific(); return single_value->field_eNodeB__type; } const OCTETSTRING_template& ENodeB__ID_template::eNodeB__type() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field eNodeB_type of a non-specific template of type @GTPC_Types.ENodeB_ID."); return single_value->field_eNodeB__type; } ENodeB__IDs_template& ENodeB__ID_template::eNodeB__ID() { set_specific(); return single_value->field_eNodeB__ID; } const ENodeB__IDs_template& ENodeB__ID_template::eNodeB__ID() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field eNodeB_ID of a non-specific template of type @GTPC_Types.ENodeB_ID."); return single_value->field_eNodeB__ID; } int ENodeB__ID_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.ENodeB_ID 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 @GTPC_Types.ENodeB_ID 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 @GTPC_Types.ENodeB_ID containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.ENodeB_ID containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.ENodeB_ID containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.ENodeB_ID containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.ENodeB_ID containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.ENodeB_ID containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.ENodeB_ID containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.ENodeB_ID."); } return 0; } void ENodeB__ID_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ type_gtpc := "); single_value->field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log(); TTCN_Logger::log_event_str(", eNodeB_type := "); single_value->field_eNodeB__type.log(); TTCN_Logger::log_event_str(", eNodeB_ID := "); single_value->field_eNodeB__ID.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 ENodeB__ID_template::log_match(const ENodeB__ID& 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_type__gtpc.match(match_value.type__gtpc(), legacy)){ TTCN_Logger::log_logmatch_info(".type_gtpc"); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lengthf.match(match_value.lengthf(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthf"); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_eNodeB__type.match(match_value.eNodeB__type(), legacy)){ TTCN_Logger::log_logmatch_info(".eNodeB_type"); single_value->field_eNodeB__type.log_match(match_value.eNodeB__type(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_eNodeB__ID.match(match_value.eNodeB__ID(), legacy)){ TTCN_Logger::log_logmatch_info(".eNodeB_ID"); single_value->field_eNodeB__ID.log_match(match_value.eNodeB__ID(), 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("{ type_gtpc := "); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::log_event_str(", eNodeB_type := "); single_value->field_eNodeB__type.log_match(match_value.eNodeB__type(), legacy); TTCN_Logger::log_event_str(", eNodeB_ID := "); single_value->field_eNodeB__ID.log_match(match_value.eNodeB__ID(), 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 ENodeB__ID_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_type__gtpc.encode_text(text_buf); single_value->field_lengthf.encode_text(text_buf); single_value->field_eNodeB__type.encode_text(text_buf); single_value->field_eNodeB__ID.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 @GTPC_Types.ENodeB_ID."); } } void ENodeB__ID_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_type__gtpc.decode_text(text_buf); single_value->field_lengthf.decode_text(text_buf); single_value->field_eNodeB__type.decode_text(text_buf); single_value->field_eNodeB__ID.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 ENodeB__ID_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 @GTPC_Types.ENodeB_ID."); } } void ENodeB__ID_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: { ENodeB__ID_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) eNodeB__type().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) eNodeB__ID().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "eNodeB_type")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { eNodeB__type().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "eNodeB_ID")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { eNodeB__ID().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.ENodeB_ID: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { ENodeB__ID_template* precondition = new ENodeB__ID_template; precondition->set_param(*param.get_elem(0)); ENodeB__ID_template* implied_template = new ENodeB__ID_template; implied_template->set_param(*param.get_elem(1)); *this = ENodeB__ID_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.ENodeB_ID"); } is_ifpresent = param.get_ifpresent(); } void ENodeB__ID_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_type__gtpc.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.ENodeB_ID"); single_value->field_lengthf.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.ENodeB_ID"); single_value->field_eNodeB__type.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.ENodeB_ID"); single_value->field_eNodeB__ID.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.ENodeB_ID"); 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 : "@GTPC_Types.ENodeB_ID"); } boolean ENodeB__ID_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean ENodeB__ID_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) nsapi().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) spare1().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) selectionMode().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) spare2().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nsapi")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsapi().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "spare1")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare1().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "selectionMode")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { selectionMode().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "spare2")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare2().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.SelectionMode_NSAPI: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.SelectionMode_NSAPI"); } } void SelectionMode__NSAPI::encode_text(Text_Buf& text_buf) const { field_type__gtpc.encode_text(text_buf); field_lengthf.encode_text(text_buf); field_nsapi.encode_text(text_buf); field_spare1.encode_text(text_buf); field_selectionMode.encode_text(text_buf); field_spare2.encode_text(text_buf); } void SelectionMode__NSAPI::decode_text(Text_Buf& text_buf) { field_type__gtpc.decode_text(text_buf); field_lengthf.decode_text(text_buf); field_nsapi.decode_text(text_buf); field_spare1.decode_text(text_buf); field_selectionMode.decode_text(text_buf); field_spare2.decode_text(text_buf); } void SelectionMode__NSAPI::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 SelectionMode__NSAPI::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 SelectionMode__NSAPI::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; int value_of_length_field1 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_type__gtpc.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, SelectionMode__NSAPI_lengthf_descr_.raw->forceomit); decoded_field_length = field_lengthf.RAW_decode(SelectionMode__NSAPI_lengthf_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()); INTEGER tmp1 = field_lengthf.convert_to_Integer(SelectionMode__NSAPI_lengthf_descr_); field_lengthf = tmp1; value_of_length_field1 += tmp1.get_long_long_val() * 8; RAW_Force_Omit field_2_force_omit(2, force_omit, General__Types::BIT4_descr_.raw->forceomit); decoded_field_length = field_nsapi.RAW_decode(General__Types::BIT4_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::BIT4_descr_.raw->forceomit); decoded_field_length = field_spare1.RAW_decode(General__Types::BIT4_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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_field1 -= decoded_field_length; RAW_Force_Omit field_4_force_omit(4, force_omit, General__Types::BIT2_descr_.raw->forceomit); decoded_field_length = field_selectionMode.RAW_decode(General__Types::BIT2_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, no_err, -1, TRUE, &field_4_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_5_force_omit(5, force_omit, General__Types::BIT6_descr_.raw->forceomit); decoded_field_length = field_spare2.RAW_decode(General__Types::BIT6_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, no_err, -1, TRUE, &field_5_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); value_of_length_field1 -= decoded_field_length; if (field_type__gtpc != os_78) return -1; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int SelectionMode__NSAPI::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, SelectionMode__NSAPI_lengthf_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, General__Types::BIT4_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::BIT4_descr_.raw); myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, General__Types::BIT2_descr_.raw); myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, General__Types::BIT6_descr_.raw); encoded_length += field_type__gtpc.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += 16; myleaf.body.node.nodes[1]->calc = CALC_LENGTH; myleaf.body.node.nodes[1]->coding_descr = &SelectionMode__NSAPI_lengthf_descr_; myleaf.body.node.nodes[1]->calcof.lengthto.num_of_fields = 4; myleaf.body.node.nodes[1]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[1]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields = init_lengthto_fields_list(4); myleaf.body.node.nodes[1]->length = 16; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[2]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[2]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].level = myleaf.body.node.nodes[3]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].pos = myleaf.body.node.nodes[3]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].level = myleaf.body.node.nodes[4]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].pos = myleaf.body.node.nodes[4]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[3].level = myleaf.body.node.nodes[5]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[3].pos = myleaf.body.node.nodes[5]->curr_pos.pos; encoded_length += field_nsapi.RAW_encode(General__Types::BIT4_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_spare1.RAW_encode(General__Types::BIT4_descr_, *myleaf.body.node.nodes[3]); encoded_length += field_selectionMode.RAW_encode(General__Types::BIT2_descr_, *myleaf.body.node.nodes[4]); encoded_length += field_spare2.RAW_encode(General__Types::BIT6_descr_, *myleaf.body.node.nodes[5]); if (field_type__gtpc != os_78) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={0}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ os_78.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 SelectionMode__NSAPI_template::single_value_struct { OCTETSTRING_template field_type__gtpc; INTEGER_template field_lengthf; BITSTRING_template field_nsapi; BITSTRING_template field_spare1; BITSTRING_template field_selectionMode; BITSTRING_template field_spare2; }; void SelectionMode__NSAPI_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_type__gtpc = ANY_VALUE; single_value->field_lengthf = ANY_VALUE; single_value->field_nsapi = ANY_VALUE; single_value->field_spare1 = ANY_VALUE; single_value->field_selectionMode = ANY_VALUE; single_value->field_spare2 = ANY_VALUE; } } } void SelectionMode__NSAPI_template::copy_value(const SelectionMode__NSAPI& other_value) { single_value = new single_value_struct; if (other_value.type__gtpc().is_bound()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (other_value.lengthf().is_bound()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (other_value.nsapi().is_bound()) { single_value->field_nsapi = other_value.nsapi(); } else { single_value->field_nsapi.clean_up(); } if (other_value.spare1().is_bound()) { single_value->field_spare1 = other_value.spare1(); } else { single_value->field_spare1.clean_up(); } if (other_value.selectionMode().is_bound()) { single_value->field_selectionMode = other_value.selectionMode(); } else { single_value->field_selectionMode.clean_up(); } if (other_value.spare2().is_bound()) { single_value->field_spare2 = other_value.spare2(); } else { single_value->field_spare2.clean_up(); } set_selection(SPECIFIC_VALUE); } void SelectionMode__NSAPI_template::copy_template(const SelectionMode__NSAPI_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.type__gtpc().get_selection()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lengthf().get_selection()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.nsapi().get_selection()) { single_value->field_nsapi = other_value.nsapi(); } else { single_value->field_nsapi.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.spare1().get_selection()) { single_value->field_spare1 = other_value.spare1(); } else { single_value->field_spare1.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.selectionMode().get_selection()) { single_value->field_selectionMode = other_value.selectionMode(); } else { single_value->field_selectionMode.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.spare2().get_selection()) { single_value->field_spare2 = other_value.spare2(); } else { single_value->field_spare2.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 SelectionMode__NSAPI_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 SelectionMode__NSAPI_template(*other_value.implication_.precondition); implication_.implied_template = new SelectionMode__NSAPI_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 @GTPC_Types.SelectionMode_NSAPI."); break; } set_selection(other_value); } SelectionMode__NSAPI_template::SelectionMode__NSAPI_template() { } SelectionMode__NSAPI_template::SelectionMode__NSAPI_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } SelectionMode__NSAPI_template::SelectionMode__NSAPI_template(const SelectionMode__NSAPI& other_value) { copy_value(other_value); } SelectionMode__NSAPI_template::SelectionMode__NSAPI_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SelectionMode__NSAPI&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.SelectionMode_NSAPI from an unbound optional field."); } } SelectionMode__NSAPI_template::SelectionMode__NSAPI_template(SelectionMode__NSAPI_template* p_precondition, SelectionMode__NSAPI_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } SelectionMode__NSAPI_template::SelectionMode__NSAPI_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; } SelectionMode__NSAPI_template::SelectionMode__NSAPI_template(const SelectionMode__NSAPI_template& other_value) : Base_Template() { copy_template(other_value); } SelectionMode__NSAPI_template::~SelectionMode__NSAPI_template() { clean_up(); } SelectionMode__NSAPI_template& SelectionMode__NSAPI_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } SelectionMode__NSAPI_template& SelectionMode__NSAPI_template::operator=(const SelectionMode__NSAPI& other_value) { clean_up(); copy_value(other_value); return *this; } SelectionMode__NSAPI_template& SelectionMode__NSAPI_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SelectionMode__NSAPI&)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 @GTPC_Types.SelectionMode_NSAPI."); } return *this; } SelectionMode__NSAPI_template& SelectionMode__NSAPI_template::operator=(const SelectionMode__NSAPI_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean SelectionMode__NSAPI_template::match(const SelectionMode__NSAPI& 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.type__gtpc().is_bound()) return FALSE; if(!single_value->field_type__gtpc.match(other_value.type__gtpc(), legacy))return FALSE; if(!other_value.lengthf().is_bound()) return FALSE; if(!single_value->field_lengthf.match(other_value.lengthf(), legacy))return FALSE; if(!other_value.nsapi().is_bound()) return FALSE; if(!single_value->field_nsapi.match(other_value.nsapi(), legacy))return FALSE; if(!other_value.spare1().is_bound()) return FALSE; if(!single_value->field_spare1.match(other_value.spare1(), legacy))return FALSE; if(!other_value.selectionMode().is_bound()) return FALSE; if(!single_value->field_selectionMode.match(other_value.selectionMode(), legacy))return FALSE; if(!other_value.spare2().is_bound()) return FALSE; if(!single_value->field_spare2.match(other_value.spare2(), 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 @GTPC_Types.SelectionMode_NSAPI."); } return FALSE; } boolean SelectionMode__NSAPI_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_type__gtpc.is_bound() || single_value->field_lengthf.is_bound() || single_value->field_nsapi.is_bound() || single_value->field_spare1.is_bound() || single_value->field_selectionMode.is_bound() || single_value->field_spare2.is_bound(); } boolean SelectionMode__NSAPI_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_type__gtpc.is_value() && single_value->field_lengthf.is_value() && single_value->field_nsapi.is_value() && single_value->field_spare1.is_value() && single_value->field_selectionMode.is_value() && single_value->field_spare2.is_value(); } void SelectionMode__NSAPI_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; } SelectionMode__NSAPI SelectionMode__NSAPI_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 @GTPC_Types.SelectionMode_NSAPI."); SelectionMode__NSAPI ret_val; if (single_value->field_type__gtpc.is_bound()) { ret_val.type__gtpc() = single_value->field_type__gtpc.valueof(); } if (single_value->field_lengthf.is_bound()) { ret_val.lengthf() = single_value->field_lengthf.valueof(); } if (single_value->field_nsapi.is_bound()) { ret_val.nsapi() = single_value->field_nsapi.valueof(); } if (single_value->field_spare1.is_bound()) { ret_val.spare1() = single_value->field_spare1.valueof(); } if (single_value->field_selectionMode.is_bound()) { ret_val.selectionMode() = single_value->field_selectionMode.valueof(); } if (single_value->field_spare2.is_bound()) { ret_val.spare2() = single_value->field_spare2.valueof(); } return ret_val; } void SelectionMode__NSAPI_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 @GTPC_Types.SelectionMode_NSAPI."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new SelectionMode__NSAPI_template[list_length]; } SelectionMode__NSAPI_template& SelectionMode__NSAPI_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 @GTPC_Types.SelectionMode_NSAPI."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.SelectionMode_NSAPI."); return value_list.list_value[list_index]; } OCTETSTRING_template& SelectionMode__NSAPI_template::type__gtpc() { set_specific(); return single_value->field_type__gtpc; } const OCTETSTRING_template& SelectionMode__NSAPI_template::type__gtpc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field type_gtpc of a non-specific template of type @GTPC_Types.SelectionMode_NSAPI."); return single_value->field_type__gtpc; } INTEGER_template& SelectionMode__NSAPI_template::lengthf() { set_specific(); return single_value->field_lengthf; } const INTEGER_template& SelectionMode__NSAPI_template::lengthf() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthf of a non-specific template of type @GTPC_Types.SelectionMode_NSAPI."); return single_value->field_lengthf; } BITSTRING_template& SelectionMode__NSAPI_template::nsapi() { set_specific(); return single_value->field_nsapi; } const BITSTRING_template& SelectionMode__NSAPI_template::nsapi() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nsapi of a non-specific template of type @GTPC_Types.SelectionMode_NSAPI."); return single_value->field_nsapi; } BITSTRING_template& SelectionMode__NSAPI_template::spare1() { set_specific(); return single_value->field_spare1; } const BITSTRING_template& SelectionMode__NSAPI_template::spare1() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field spare1 of a non-specific template of type @GTPC_Types.SelectionMode_NSAPI."); return single_value->field_spare1; } BITSTRING_template& SelectionMode__NSAPI_template::selectionMode() { set_specific(); return single_value->field_selectionMode; } const BITSTRING_template& SelectionMode__NSAPI_template::selectionMode() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field selectionMode of a non-specific template of type @GTPC_Types.SelectionMode_NSAPI."); return single_value->field_selectionMode; } BITSTRING_template& SelectionMode__NSAPI_template::spare2() { set_specific(); return single_value->field_spare2; } const BITSTRING_template& SelectionMode__NSAPI_template::spare2() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field spare2 of a non-specific template of type @GTPC_Types.SelectionMode_NSAPI."); return single_value->field_spare2; } int SelectionMode__NSAPI_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.SelectionMode_NSAPI which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 6; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @GTPC_Types.SelectionMode_NSAPI 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 @GTPC_Types.SelectionMode_NSAPI containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.SelectionMode_NSAPI containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.SelectionMode_NSAPI containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.SelectionMode_NSAPI containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.SelectionMode_NSAPI containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.SelectionMode_NSAPI containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.SelectionMode_NSAPI containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.SelectionMode_NSAPI."); } return 0; } void SelectionMode__NSAPI_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ type_gtpc := "); single_value->field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log(); TTCN_Logger::log_event_str(", nsapi := "); single_value->field_nsapi.log(); TTCN_Logger::log_event_str(", spare1 := "); single_value->field_spare1.log(); TTCN_Logger::log_event_str(", selectionMode := "); single_value->field_selectionMode.log(); TTCN_Logger::log_event_str(", spare2 := "); single_value->field_spare2.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 SelectionMode__NSAPI_template::log_match(const SelectionMode__NSAPI& 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_type__gtpc.match(match_value.type__gtpc(), legacy)){ TTCN_Logger::log_logmatch_info(".type_gtpc"); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lengthf.match(match_value.lengthf(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthf"); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_nsapi.match(match_value.nsapi(), legacy)){ TTCN_Logger::log_logmatch_info(".nsapi"); single_value->field_nsapi.log_match(match_value.nsapi(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_spare1.match(match_value.spare1(), legacy)){ TTCN_Logger::log_logmatch_info(".spare1"); single_value->field_spare1.log_match(match_value.spare1(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_selectionMode.match(match_value.selectionMode(), legacy)){ TTCN_Logger::log_logmatch_info(".selectionMode"); single_value->field_selectionMode.log_match(match_value.selectionMode(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_spare2.match(match_value.spare2(), legacy)){ TTCN_Logger::log_logmatch_info(".spare2"); single_value->field_spare2.log_match(match_value.spare2(), 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("{ type_gtpc := "); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::log_event_str(", nsapi := "); single_value->field_nsapi.log_match(match_value.nsapi(), legacy); TTCN_Logger::log_event_str(", spare1 := "); single_value->field_spare1.log_match(match_value.spare1(), legacy); TTCN_Logger::log_event_str(", selectionMode := "); single_value->field_selectionMode.log_match(match_value.selectionMode(), legacy); TTCN_Logger::log_event_str(", spare2 := "); single_value->field_spare2.log_match(match_value.spare2(), 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 SelectionMode__NSAPI_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_type__gtpc.encode_text(text_buf); single_value->field_lengthf.encode_text(text_buf); single_value->field_nsapi.encode_text(text_buf); single_value->field_spare1.encode_text(text_buf); single_value->field_selectionMode.encode_text(text_buf); single_value->field_spare2.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 @GTPC_Types.SelectionMode_NSAPI."); } } void SelectionMode__NSAPI_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_type__gtpc.decode_text(text_buf); single_value->field_lengthf.decode_text(text_buf); single_value->field_nsapi.decode_text(text_buf); single_value->field_spare1.decode_text(text_buf); single_value->field_selectionMode.decode_text(text_buf); single_value->field_spare2.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 SelectionMode__NSAPI_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 @GTPC_Types.SelectionMode_NSAPI."); } } void SelectionMode__NSAPI_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: { SelectionMode__NSAPI_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) nsapi().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) spare1().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) selectionMode().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) spare2().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nsapi")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsapi().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "spare1")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare1().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "selectionMode")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { selectionMode().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "spare2")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare2().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.SelectionMode_NSAPI: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { SelectionMode__NSAPI_template* precondition = new SelectionMode__NSAPI_template; precondition->set_param(*param.get_elem(0)); SelectionMode__NSAPI_template* implied_template = new SelectionMode__NSAPI_template; implied_template->set_param(*param.get_elem(1)); *this = SelectionMode__NSAPI_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.SelectionMode_NSAPI"); } is_ifpresent = param.get_ifpresent(); } void SelectionMode__NSAPI_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_type__gtpc.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.SelectionMode_NSAPI"); single_value->field_lengthf.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.SelectionMode_NSAPI"); single_value->field_nsapi.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.SelectionMode_NSAPI"); single_value->field_spare1.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.SelectionMode_NSAPI"); single_value->field_selectionMode.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.SelectionMode_NSAPI"); single_value->field_spare2.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.SelectionMode_NSAPI"); 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 : "@GTPC_Types.SelectionMode_NSAPI"); } boolean SelectionMode__NSAPI_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean SelectionMode__NSAPI_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_explicitly__specified) : field_type__gtpc(par_type__gtpc), field_lengthf(par_lengthf), field_uliTimestampValue(par_uliTimestampValue), field_explicitly__specified(par_explicitly__specified) { } ULI__Timestamp::ULI__Timestamp(const ULI__Timestamp& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GTPC_Types.ULI_Timestamp."); if (other_value.type__gtpc().is_bound()) field_type__gtpc = other_value.type__gtpc(); else field_type__gtpc.clean_up(); if (other_value.lengthf().is_bound()) field_lengthf = other_value.lengthf(); else field_lengthf.clean_up(); if (other_value.uliTimestampValue().is_bound()) field_uliTimestampValue = other_value.uliTimestampValue(); else field_uliTimestampValue.clean_up(); if (other_value.explicitly__specified().is_bound()) field_explicitly__specified = other_value.explicitly__specified(); else field_explicitly__specified.clean_up(); } void ULI__Timestamp::clean_up() { field_type__gtpc.clean_up(); field_lengthf.clean_up(); field_uliTimestampValue.clean_up(); field_explicitly__specified.clean_up(); } const TTCN_Typedescriptor_t* ULI__Timestamp::get_descriptor() const { return &ULI__Timestamp_descr_; } ULI__Timestamp& ULI__Timestamp::operator=(const ULI__Timestamp& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GTPC_Types.ULI_Timestamp."); if (other_value.type__gtpc().is_bound()) field_type__gtpc = other_value.type__gtpc(); else field_type__gtpc.clean_up(); if (other_value.lengthf().is_bound()) field_lengthf = other_value.lengthf(); else field_lengthf.clean_up(); if (other_value.uliTimestampValue().is_bound()) field_uliTimestampValue = other_value.uliTimestampValue(); else field_uliTimestampValue.clean_up(); if (other_value.explicitly__specified().is_bound()) field_explicitly__specified = other_value.explicitly__specified(); else field_explicitly__specified.clean_up(); } return *this; } boolean ULI__Timestamp::operator==(const ULI__Timestamp& other_value) const { return field_type__gtpc==other_value.field_type__gtpc && field_lengthf==other_value.field_lengthf && field_uliTimestampValue==other_value.field_uliTimestampValue && field_explicitly__specified==other_value.field_explicitly__specified; } boolean ULI__Timestamp::is_bound() const { return (field_type__gtpc.is_bound()) || (field_lengthf.is_bound()) || (field_uliTimestampValue.is_bound()) || (OPTIONAL_OMIT == field_explicitly__specified.get_selection() || field_explicitly__specified.is_bound()); } boolean ULI__Timestamp::is_value() const { return field_type__gtpc.is_value() && field_lengthf.is_value() && field_uliTimestampValue.is_value() && (OPTIONAL_OMIT == field_explicitly__specified.get_selection() || field_explicitly__specified.is_value()); } int ULI__Timestamp::size_of() const { int ret_val = 3; if (field_explicitly__specified.ispresent()) ret_val++; return ret_val; } void ULI__Timestamp::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ type_gtpc := "); field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); field_lengthf.log(); TTCN_Logger::log_event_str(", uliTimestampValue := "); field_uliTimestampValue.log(); TTCN_Logger::log_event_str(", explicitly_specified := "); field_explicitly__specified.log(); TTCN_Logger::log_event_str(" }"); } void ULI__Timestamp::set_implicit_omit() { if (type__gtpc().is_bound()) type__gtpc().set_implicit_omit(); if (lengthf().is_bound()) lengthf().set_implicit_omit(); if (uliTimestampValue().is_bound()) uliTimestampValue().set_implicit_omit(); if (!explicitly__specified().is_bound()) explicitly__specified() = OMIT_VALUE; else explicitly__specified().set_implicit_omit(); } void ULI__Timestamp::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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) uliTimestampValue().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) explicitly__specified().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "uliTimestampValue")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { uliTimestampValue().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "explicitly_specified")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { explicitly__specified().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.ULI_Timestamp: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.ULI_Timestamp"); } } void ULI__Timestamp::encode_text(Text_Buf& text_buf) const { field_type__gtpc.encode_text(text_buf); field_lengthf.encode_text(text_buf); field_uliTimestampValue.encode_text(text_buf); field_explicitly__specified.encode_text(text_buf); } void ULI__Timestamp::decode_text(Text_Buf& text_buf) { field_type__gtpc.decode_text(text_buf); field_lengthf.decode_text(text_buf); field_uliTimestampValue.decode_text(text_buf); field_explicitly__specified.decode_text(text_buf); } void ULI__Timestamp::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 ULI__Timestamp::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 ULI__Timestamp::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; int value_of_length_field1 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_type__gtpc.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, ULI__Timestamp_lengthf_descr_.raw->forceomit); decoded_field_length = field_lengthf.RAW_decode(ULI__Timestamp_lengthf_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()); INTEGER tmp1 = field_lengthf.convert_to_Integer(ULI__Timestamp_lengthf_descr_); field_lengthf = tmp1; value_of_length_field1 += tmp1.get_long_long_val() * 8; RAW_Force_Omit field_2_force_omit(2, force_omit, General__Types::OCT4_descr_.raw->forceomit); decoded_field_length = field_uliTimestampValue.RAW_decode(General__Types::OCT4_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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()); value_of_length_field1 -= decoded_field_length; if (limit > 0 && value_of_length_field1 > 0){ if (force_omit != NULL && (*force_omit)(3)) { field_explicitly__specified = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_3_force_omit(3, force_omit, OCTETSTRING_descr_.raw->forceomit); decoded_field_length = field_explicitly__specified().RAW_decode(OCTETSTRING_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, TRUE, -1, TRUE, &field_3_force_omit); if (decoded_field_length < 1) { field_explicitly__specified = 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()); value_of_length_field1 -= decoded_field_length; } } } else field_explicitly__specified=OMIT_VALUE; if (field_type__gtpc != os_49) return -1; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int ULI__Timestamp::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, ULI__Timestamp_lengthf_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, General__Types::OCT4_descr_.raw); if (field_explicitly__specified.ispresent()) { myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, OCTETSTRING_descr_.raw); } else myleaf.body.node.nodes[3] = NULL; encoded_length += field_type__gtpc.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += 16; myleaf.body.node.nodes[1]->calc = CALC_LENGTH; myleaf.body.node.nodes[1]->coding_descr = &ULI__Timestamp_lengthf_descr_; myleaf.body.node.nodes[1]->calcof.lengthto.num_of_fields = 2; myleaf.body.node.nodes[1]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[1]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields = init_lengthto_fields_list(2); myleaf.body.node.nodes[1]->length = 16; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[2]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[2]->curr_pos.pos; if (field_explicitly__specified.ispresent()) { myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].level = myleaf.body.node.nodes[3]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].pos = myleaf.body.node.nodes[3]->curr_pos.pos; } else { myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].level = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].pos = 0; } encoded_length += field_uliTimestampValue.RAW_encode(General__Types::OCT4_descr_, *myleaf.body.node.nodes[2]); if (field_explicitly__specified.ispresent()) { encoded_length += field_explicitly__specified().RAW_encode(OCTETSTRING_descr_, *myleaf.body.node.nodes[3]); } if (field_type__gtpc != os_49) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={0}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ os_49.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 ULI__Timestamp_template::single_value_struct { OCTETSTRING_template field_type__gtpc; INTEGER_template field_lengthf; OCTETSTRING_template field_uliTimestampValue; OCTETSTRING_template field_explicitly__specified; }; void ULI__Timestamp_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_type__gtpc = ANY_VALUE; single_value->field_lengthf = ANY_VALUE; single_value->field_uliTimestampValue = ANY_VALUE; single_value->field_explicitly__specified = ANY_OR_OMIT; } } } void ULI__Timestamp_template::copy_value(const ULI__Timestamp& other_value) { single_value = new single_value_struct; if (other_value.type__gtpc().is_bound()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (other_value.lengthf().is_bound()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (other_value.uliTimestampValue().is_bound()) { single_value->field_uliTimestampValue = other_value.uliTimestampValue(); } else { single_value->field_uliTimestampValue.clean_up(); } if (other_value.explicitly__specified().is_bound()) { if (other_value.explicitly__specified().ispresent()) single_value->field_explicitly__specified = other_value.explicitly__specified()(); else single_value->field_explicitly__specified = OMIT_VALUE; } else { single_value->field_explicitly__specified.clean_up(); } set_selection(SPECIFIC_VALUE); } void ULI__Timestamp_template::copy_template(const ULI__Timestamp_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.type__gtpc().get_selection()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lengthf().get_selection()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.uliTimestampValue().get_selection()) { single_value->field_uliTimestampValue = other_value.uliTimestampValue(); } else { single_value->field_uliTimestampValue.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.explicitly__specified().get_selection()) { single_value->field_explicitly__specified = other_value.explicitly__specified(); } else { single_value->field_explicitly__specified.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 ULI__Timestamp_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 ULI__Timestamp_template(*other_value.implication_.precondition); implication_.implied_template = new ULI__Timestamp_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 @GTPC_Types.ULI_Timestamp."); break; } set_selection(other_value); } ULI__Timestamp_template::ULI__Timestamp_template() { } ULI__Timestamp_template::ULI__Timestamp_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } ULI__Timestamp_template::ULI__Timestamp_template(const ULI__Timestamp& other_value) { copy_value(other_value); } ULI__Timestamp_template::ULI__Timestamp_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const ULI__Timestamp&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.ULI_Timestamp from an unbound optional field."); } } ULI__Timestamp_template::ULI__Timestamp_template(ULI__Timestamp_template* p_precondition, ULI__Timestamp_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } ULI__Timestamp_template::ULI__Timestamp_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; } ULI__Timestamp_template::ULI__Timestamp_template(const ULI__Timestamp_template& other_value) : Base_Template() { copy_template(other_value); } ULI__Timestamp_template::~ULI__Timestamp_template() { clean_up(); } ULI__Timestamp_template& ULI__Timestamp_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } ULI__Timestamp_template& ULI__Timestamp_template::operator=(const ULI__Timestamp& other_value) { clean_up(); copy_value(other_value); return *this; } ULI__Timestamp_template& ULI__Timestamp_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const ULI__Timestamp&)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 @GTPC_Types.ULI_Timestamp."); } return *this; } ULI__Timestamp_template& ULI__Timestamp_template::operator=(const ULI__Timestamp_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean ULI__Timestamp_template::match(const ULI__Timestamp& 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.type__gtpc().is_bound()) return FALSE; if(!single_value->field_type__gtpc.match(other_value.type__gtpc(), legacy))return FALSE; if(!other_value.lengthf().is_bound()) return FALSE; if(!single_value->field_lengthf.match(other_value.lengthf(), legacy))return FALSE; if(!other_value.uliTimestampValue().is_bound()) return FALSE; if(!single_value->field_uliTimestampValue.match(other_value.uliTimestampValue(), legacy))return FALSE; if(!other_value.explicitly__specified().is_bound()) return FALSE; if((other_value.explicitly__specified().ispresent() ? !single_value->field_explicitly__specified.match((const OCTETSTRING&)other_value.explicitly__specified(), legacy) : !single_value->field_explicitly__specified.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 @GTPC_Types.ULI_Timestamp."); } return FALSE; } boolean ULI__Timestamp_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_type__gtpc.is_bound() || single_value->field_lengthf.is_bound() || single_value->field_uliTimestampValue.is_bound() || (single_value->field_explicitly__specified.is_omit() || single_value->field_explicitly__specified.is_bound()); } boolean ULI__Timestamp_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_type__gtpc.is_value() && single_value->field_lengthf.is_value() && single_value->field_uliTimestampValue.is_value() && (single_value->field_explicitly__specified.is_omit() || single_value->field_explicitly__specified.is_value()); } void ULI__Timestamp_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; } ULI__Timestamp ULI__Timestamp_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 @GTPC_Types.ULI_Timestamp."); ULI__Timestamp ret_val; if (single_value->field_type__gtpc.is_bound()) { ret_val.type__gtpc() = single_value->field_type__gtpc.valueof(); } if (single_value->field_lengthf.is_bound()) { ret_val.lengthf() = single_value->field_lengthf.valueof(); } if (single_value->field_uliTimestampValue.is_bound()) { ret_val.uliTimestampValue() = single_value->field_uliTimestampValue.valueof(); } if (single_value->field_explicitly__specified.is_omit()) ret_val.explicitly__specified() = OMIT_VALUE; else if (single_value->field_explicitly__specified.is_bound()) { ret_val.explicitly__specified() = single_value->field_explicitly__specified.valueof(); } return ret_val; } void ULI__Timestamp_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 @GTPC_Types.ULI_Timestamp."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new ULI__Timestamp_template[list_length]; } ULI__Timestamp_template& ULI__Timestamp_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 @GTPC_Types.ULI_Timestamp."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.ULI_Timestamp."); return value_list.list_value[list_index]; } OCTETSTRING_template& ULI__Timestamp_template::type__gtpc() { set_specific(); return single_value->field_type__gtpc; } const OCTETSTRING_template& ULI__Timestamp_template::type__gtpc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field type_gtpc of a non-specific template of type @GTPC_Types.ULI_Timestamp."); return single_value->field_type__gtpc; } INTEGER_template& ULI__Timestamp_template::lengthf() { set_specific(); return single_value->field_lengthf; } const INTEGER_template& ULI__Timestamp_template::lengthf() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthf of a non-specific template of type @GTPC_Types.ULI_Timestamp."); return single_value->field_lengthf; } OCTETSTRING_template& ULI__Timestamp_template::uliTimestampValue() { set_specific(); return single_value->field_uliTimestampValue; } const OCTETSTRING_template& ULI__Timestamp_template::uliTimestampValue() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field uliTimestampValue of a non-specific template of type @GTPC_Types.ULI_Timestamp."); return single_value->field_uliTimestampValue; } OCTETSTRING_template& ULI__Timestamp_template::explicitly__specified() { set_specific(); return single_value->field_explicitly__specified; } const OCTETSTRING_template& ULI__Timestamp_template::explicitly__specified() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field explicitly_specified of a non-specific template of type @GTPC_Types.ULI_Timestamp."); return single_value->field_explicitly__specified; } int ULI__Timestamp_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.ULI_Timestamp which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 3; if (single_value->field_explicitly__specified.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 @GTPC_Types.ULI_Timestamp 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 @GTPC_Types.ULI_Timestamp containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.ULI_Timestamp containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.ULI_Timestamp containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.ULI_Timestamp containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.ULI_Timestamp containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.ULI_Timestamp containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.ULI_Timestamp containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.ULI_Timestamp."); } return 0; } void ULI__Timestamp_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ type_gtpc := "); single_value->field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log(); TTCN_Logger::log_event_str(", uliTimestampValue := "); single_value->field_uliTimestampValue.log(); TTCN_Logger::log_event_str(", explicitly_specified := "); single_value->field_explicitly__specified.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 ULI__Timestamp_template::log_match(const ULI__Timestamp& 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_type__gtpc.match(match_value.type__gtpc(), legacy)){ TTCN_Logger::log_logmatch_info(".type_gtpc"); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lengthf.match(match_value.lengthf(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthf"); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_uliTimestampValue.match(match_value.uliTimestampValue(), legacy)){ TTCN_Logger::log_logmatch_info(".uliTimestampValue"); single_value->field_uliTimestampValue.log_match(match_value.uliTimestampValue(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.explicitly__specified().ispresent()){ if(!single_value->field_explicitly__specified.match(match_value.explicitly__specified(), legacy)){ TTCN_Logger::log_logmatch_info(".explicitly_specified"); single_value->field_explicitly__specified.log_match(match_value.explicitly__specified(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_explicitly__specified.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".explicitly_specified := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_explicitly__specified.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("{ type_gtpc := "); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::log_event_str(", uliTimestampValue := "); single_value->field_uliTimestampValue.log_match(match_value.uliTimestampValue(), legacy); TTCN_Logger::log_event_str(", explicitly_specified := "); if (match_value.explicitly__specified().ispresent()) { single_value->field_explicitly__specified.log_match(match_value.explicitly__specified(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_explicitly__specified.log(); if (single_value->field_explicitly__specified.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 ULI__Timestamp_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_type__gtpc.encode_text(text_buf); single_value->field_lengthf.encode_text(text_buf); single_value->field_uliTimestampValue.encode_text(text_buf); single_value->field_explicitly__specified.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 @GTPC_Types.ULI_Timestamp."); } } void ULI__Timestamp_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_type__gtpc.decode_text(text_buf); single_value->field_lengthf.decode_text(text_buf); single_value->field_uliTimestampValue.decode_text(text_buf); single_value->field_explicitly__specified.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 ULI__Timestamp_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 @GTPC_Types.ULI_Timestamp."); } } void ULI__Timestamp_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: { ULI__Timestamp_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) uliTimestampValue().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) explicitly__specified().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "uliTimestampValue")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { uliTimestampValue().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "explicitly_specified")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { explicitly__specified().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.ULI_Timestamp: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { ULI__Timestamp_template* precondition = new ULI__Timestamp_template; precondition->set_param(*param.get_elem(0)); ULI__Timestamp_template* implied_template = new ULI__Timestamp_template; implied_template->set_param(*param.get_elem(1)); *this = ULI__Timestamp_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.ULI_Timestamp"); } is_ifpresent = param.get_ifpresent(); } void ULI__Timestamp_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_type__gtpc.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.ULI_Timestamp"); single_value->field_lengthf.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.ULI_Timestamp"); single_value->field_uliTimestampValue.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.ULI_Timestamp"); single_value->field_explicitly__specified.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.ULI_Timestamp"); 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 : "@GTPC_Types.ULI_Timestamp"); } boolean ULI__Timestamp_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean ULI__Timestamp_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_lHN__ID) : field_type__gtpc(par_type__gtpc), field_lengthf(par_lengthf), field_nsapi(par_nsapi), field_spare(par_spare), field_lHN__ID(par_lHN__ID) { } LHN__ID__NSAPI::LHN__ID__NSAPI(const LHN__ID__NSAPI& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GTPC_Types.LHN_ID_NSAPI."); if (other_value.type__gtpc().is_bound()) field_type__gtpc = other_value.type__gtpc(); else field_type__gtpc.clean_up(); if (other_value.lengthf().is_bound()) field_lengthf = other_value.lengthf(); else field_lengthf.clean_up(); if (other_value.nsapi().is_bound()) field_nsapi = other_value.nsapi(); else field_nsapi.clean_up(); if (other_value.spare().is_bound()) field_spare = other_value.spare(); else field_spare.clean_up(); if (other_value.lHN__ID().is_bound()) field_lHN__ID = other_value.lHN__ID(); else field_lHN__ID.clean_up(); } void LHN__ID__NSAPI::clean_up() { field_type__gtpc.clean_up(); field_lengthf.clean_up(); field_nsapi.clean_up(); field_spare.clean_up(); field_lHN__ID.clean_up(); } const TTCN_Typedescriptor_t* LHN__ID__NSAPI::get_descriptor() const { return &LHN__ID__NSAPI_descr_; } LHN__ID__NSAPI& LHN__ID__NSAPI::operator=(const LHN__ID__NSAPI& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GTPC_Types.LHN_ID_NSAPI."); if (other_value.type__gtpc().is_bound()) field_type__gtpc = other_value.type__gtpc(); else field_type__gtpc.clean_up(); if (other_value.lengthf().is_bound()) field_lengthf = other_value.lengthf(); else field_lengthf.clean_up(); if (other_value.nsapi().is_bound()) field_nsapi = other_value.nsapi(); else field_nsapi.clean_up(); if (other_value.spare().is_bound()) field_spare = other_value.spare(); else field_spare.clean_up(); if (other_value.lHN__ID().is_bound()) field_lHN__ID = other_value.lHN__ID(); else field_lHN__ID.clean_up(); } return *this; } boolean LHN__ID__NSAPI::operator==(const LHN__ID__NSAPI& other_value) const { return field_type__gtpc==other_value.field_type__gtpc && field_lengthf==other_value.field_lengthf && field_nsapi==other_value.field_nsapi && field_spare==other_value.field_spare && field_lHN__ID==other_value.field_lHN__ID; } boolean LHN__ID__NSAPI::is_bound() const { return (field_type__gtpc.is_bound()) || (field_lengthf.is_bound()) || (field_nsapi.is_bound()) || (field_spare.is_bound()) || (OPTIONAL_OMIT == field_lHN__ID.get_selection() || field_lHN__ID.is_bound()); } boolean LHN__ID__NSAPI::is_value() const { return field_type__gtpc.is_value() && field_lengthf.is_value() && field_nsapi.is_value() && field_spare.is_value() && (OPTIONAL_OMIT == field_lHN__ID.get_selection() || field_lHN__ID.is_value()); } int LHN__ID__NSAPI::size_of() const { int ret_val = 4; if (field_lHN__ID.ispresent()) ret_val++; return ret_val; } void LHN__ID__NSAPI::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ type_gtpc := "); field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); field_lengthf.log(); TTCN_Logger::log_event_str(", nsapi := "); field_nsapi.log(); TTCN_Logger::log_event_str(", spare := "); field_spare.log(); TTCN_Logger::log_event_str(", lHN_ID := "); field_lHN__ID.log(); TTCN_Logger::log_event_str(" }"); } void LHN__ID__NSAPI::set_implicit_omit() { if (type__gtpc().is_bound()) type__gtpc().set_implicit_omit(); if (lengthf().is_bound()) lengthf().set_implicit_omit(); if (nsapi().is_bound()) nsapi().set_implicit_omit(); if (spare().is_bound()) spare().set_implicit_omit(); if (!lHN__ID().is_bound()) lHN__ID() = OMIT_VALUE; else lHN__ID().set_implicit_omit(); } void LHN__ID__NSAPI::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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) nsapi().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) lHN__ID().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nsapi")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsapi().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "spare")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lHN_ID")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lHN__ID().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.LHN_ID_NSAPI: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.LHN_ID_NSAPI"); } } void LHN__ID__NSAPI::encode_text(Text_Buf& text_buf) const { field_type__gtpc.encode_text(text_buf); field_lengthf.encode_text(text_buf); field_nsapi.encode_text(text_buf); field_spare.encode_text(text_buf); field_lHN__ID.encode_text(text_buf); } void LHN__ID__NSAPI::decode_text(Text_Buf& text_buf) { field_type__gtpc.decode_text(text_buf); field_lengthf.decode_text(text_buf); field_nsapi.decode_text(text_buf); field_spare.decode_text(text_buf); field_lHN__ID.decode_text(text_buf); } void LHN__ID__NSAPI::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 LHN__ID__NSAPI::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 LHN__ID__NSAPI::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; int value_of_length_field1 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_type__gtpc.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, LHN__ID__NSAPI_lengthf_descr_.raw->forceomit); decoded_field_length = field_lengthf.RAW_decode(LHN__ID__NSAPI_lengthf_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()); INTEGER tmp1 = field_lengthf.convert_to_Integer(LHN__ID__NSAPI_lengthf_descr_); field_lengthf = tmp1; value_of_length_field1 += tmp1.get_long_long_val() * 8; RAW_Force_Omit field_2_force_omit(2, force_omit, General__Types::BIT4_descr_.raw->forceomit); decoded_field_length = field_nsapi.RAW_decode(General__Types::BIT4_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::BIT4_descr_.raw->forceomit); decoded_field_length = field_spare.RAW_decode(General__Types::BIT4_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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_field1 -= decoded_field_length; if (limit > 0 && value_of_length_field1 > 0){ if (force_omit != NULL && (*force_omit)(4)) { field_lHN__ID = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_4_force_omit(4, force_omit, OCTETSTRING_descr_.raw->forceomit); decoded_field_length = field_lHN__ID().RAW_decode(OCTETSTRING_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, TRUE, -1, TRUE, &field_4_force_omit); if (decoded_field_length < 1) { field_lHN__ID = 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()); value_of_length_field1 -= decoded_field_length; } } } else field_lHN__ID=OMIT_VALUE; if (field_type__gtpc != os_79) return -1; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int LHN__ID__NSAPI::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, LHN__ID__NSAPI_lengthf_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, General__Types::BIT4_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::BIT4_descr_.raw); if (field_lHN__ID.ispresent()) { myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, OCTETSTRING_descr_.raw); } else myleaf.body.node.nodes[4] = NULL; encoded_length += field_type__gtpc.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += 16; myleaf.body.node.nodes[1]->calc = CALC_LENGTH; myleaf.body.node.nodes[1]->coding_descr = &LHN__ID__NSAPI_lengthf_descr_; myleaf.body.node.nodes[1]->calcof.lengthto.num_of_fields = 3; myleaf.body.node.nodes[1]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[1]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields = init_lengthto_fields_list(3); myleaf.body.node.nodes[1]->length = 16; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[2]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[2]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].level = myleaf.body.node.nodes[3]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].pos = myleaf.body.node.nodes[3]->curr_pos.pos; if (field_lHN__ID.ispresent()) { myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].level = myleaf.body.node.nodes[4]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].pos = myleaf.body.node.nodes[4]->curr_pos.pos; } else { myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].level = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].pos = 0; } encoded_length += field_nsapi.RAW_encode(General__Types::BIT4_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_spare.RAW_encode(General__Types::BIT4_descr_, *myleaf.body.node.nodes[3]); if (field_lHN__ID.ispresent()) { encoded_length += field_lHN__ID().RAW_encode(OCTETSTRING_descr_, *myleaf.body.node.nodes[4]); } if (field_type__gtpc != os_79) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={0}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ os_79.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 LHN__ID__NSAPI_template::single_value_struct { OCTETSTRING_template field_type__gtpc; INTEGER_template field_lengthf; BITSTRING_template field_nsapi; BITSTRING_template field_spare; OCTETSTRING_template field_lHN__ID; }; void LHN__ID__NSAPI_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_type__gtpc = ANY_VALUE; single_value->field_lengthf = ANY_VALUE; single_value->field_nsapi = ANY_VALUE; single_value->field_spare = ANY_VALUE; single_value->field_lHN__ID = ANY_OR_OMIT; } } } void LHN__ID__NSAPI_template::copy_value(const LHN__ID__NSAPI& other_value) { single_value = new single_value_struct; if (other_value.type__gtpc().is_bound()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (other_value.lengthf().is_bound()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (other_value.nsapi().is_bound()) { single_value->field_nsapi = other_value.nsapi(); } else { single_value->field_nsapi.clean_up(); } if (other_value.spare().is_bound()) { single_value->field_spare = other_value.spare(); } else { single_value->field_spare.clean_up(); } if (other_value.lHN__ID().is_bound()) { if (other_value.lHN__ID().ispresent()) single_value->field_lHN__ID = other_value.lHN__ID()(); else single_value->field_lHN__ID = OMIT_VALUE; } else { single_value->field_lHN__ID.clean_up(); } set_selection(SPECIFIC_VALUE); } void LHN__ID__NSAPI_template::copy_template(const LHN__ID__NSAPI_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.type__gtpc().get_selection()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lengthf().get_selection()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.nsapi().get_selection()) { single_value->field_nsapi = other_value.nsapi(); } else { single_value->field_nsapi.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.spare().get_selection()) { single_value->field_spare = other_value.spare(); } else { single_value->field_spare.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lHN__ID().get_selection()) { single_value->field_lHN__ID = other_value.lHN__ID(); } else { single_value->field_lHN__ID.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 LHN__ID__NSAPI_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 LHN__ID__NSAPI_template(*other_value.implication_.precondition); implication_.implied_template = new LHN__ID__NSAPI_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 @GTPC_Types.LHN_ID_NSAPI."); break; } set_selection(other_value); } LHN__ID__NSAPI_template::LHN__ID__NSAPI_template() { } LHN__ID__NSAPI_template::LHN__ID__NSAPI_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } LHN__ID__NSAPI_template::LHN__ID__NSAPI_template(const LHN__ID__NSAPI& other_value) { copy_value(other_value); } LHN__ID__NSAPI_template::LHN__ID__NSAPI_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const LHN__ID__NSAPI&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.LHN_ID_NSAPI from an unbound optional field."); } } LHN__ID__NSAPI_template::LHN__ID__NSAPI_template(LHN__ID__NSAPI_template* p_precondition, LHN__ID__NSAPI_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } LHN__ID__NSAPI_template::LHN__ID__NSAPI_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; } LHN__ID__NSAPI_template::LHN__ID__NSAPI_template(const LHN__ID__NSAPI_template& other_value) : Base_Template() { copy_template(other_value); } LHN__ID__NSAPI_template::~LHN__ID__NSAPI_template() { clean_up(); } LHN__ID__NSAPI_template& LHN__ID__NSAPI_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } LHN__ID__NSAPI_template& LHN__ID__NSAPI_template::operator=(const LHN__ID__NSAPI& other_value) { clean_up(); copy_value(other_value); return *this; } LHN__ID__NSAPI_template& LHN__ID__NSAPI_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const LHN__ID__NSAPI&)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 @GTPC_Types.LHN_ID_NSAPI."); } return *this; } LHN__ID__NSAPI_template& LHN__ID__NSAPI_template::operator=(const LHN__ID__NSAPI_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean LHN__ID__NSAPI_template::match(const LHN__ID__NSAPI& 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.type__gtpc().is_bound()) return FALSE; if(!single_value->field_type__gtpc.match(other_value.type__gtpc(), legacy))return FALSE; if(!other_value.lengthf().is_bound()) return FALSE; if(!single_value->field_lengthf.match(other_value.lengthf(), legacy))return FALSE; if(!other_value.nsapi().is_bound()) return FALSE; if(!single_value->field_nsapi.match(other_value.nsapi(), legacy))return FALSE; if(!other_value.spare().is_bound()) return FALSE; if(!single_value->field_spare.match(other_value.spare(), legacy))return FALSE; if(!other_value.lHN__ID().is_bound()) return FALSE; if((other_value.lHN__ID().ispresent() ? !single_value->field_lHN__ID.match((const OCTETSTRING&)other_value.lHN__ID(), legacy) : !single_value->field_lHN__ID.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 @GTPC_Types.LHN_ID_NSAPI."); } return FALSE; } boolean LHN__ID__NSAPI_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_type__gtpc.is_bound() || single_value->field_lengthf.is_bound() || single_value->field_nsapi.is_bound() || single_value->field_spare.is_bound() || (single_value->field_lHN__ID.is_omit() || single_value->field_lHN__ID.is_bound()); } boolean LHN__ID__NSAPI_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_type__gtpc.is_value() && single_value->field_lengthf.is_value() && single_value->field_nsapi.is_value() && single_value->field_spare.is_value() && (single_value->field_lHN__ID.is_omit() || single_value->field_lHN__ID.is_value()); } void LHN__ID__NSAPI_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; } LHN__ID__NSAPI LHN__ID__NSAPI_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 @GTPC_Types.LHN_ID_NSAPI."); LHN__ID__NSAPI ret_val; if (single_value->field_type__gtpc.is_bound()) { ret_val.type__gtpc() = single_value->field_type__gtpc.valueof(); } if (single_value->field_lengthf.is_bound()) { ret_val.lengthf() = single_value->field_lengthf.valueof(); } if (single_value->field_nsapi.is_bound()) { ret_val.nsapi() = single_value->field_nsapi.valueof(); } if (single_value->field_spare.is_bound()) { ret_val.spare() = single_value->field_spare.valueof(); } if (single_value->field_lHN__ID.is_omit()) ret_val.lHN__ID() = OMIT_VALUE; else if (single_value->field_lHN__ID.is_bound()) { ret_val.lHN__ID() = single_value->field_lHN__ID.valueof(); } return ret_val; } void LHN__ID__NSAPI_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 @GTPC_Types.LHN_ID_NSAPI."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new LHN__ID__NSAPI_template[list_length]; } LHN__ID__NSAPI_template& LHN__ID__NSAPI_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 @GTPC_Types.LHN_ID_NSAPI."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.LHN_ID_NSAPI."); return value_list.list_value[list_index]; } OCTETSTRING_template& LHN__ID__NSAPI_template::type__gtpc() { set_specific(); return single_value->field_type__gtpc; } const OCTETSTRING_template& LHN__ID__NSAPI_template::type__gtpc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field type_gtpc of a non-specific template of type @GTPC_Types.LHN_ID_NSAPI."); return single_value->field_type__gtpc; } INTEGER_template& LHN__ID__NSAPI_template::lengthf() { set_specific(); return single_value->field_lengthf; } const INTEGER_template& LHN__ID__NSAPI_template::lengthf() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthf of a non-specific template of type @GTPC_Types.LHN_ID_NSAPI."); return single_value->field_lengthf; } BITSTRING_template& LHN__ID__NSAPI_template::nsapi() { set_specific(); return single_value->field_nsapi; } const BITSTRING_template& LHN__ID__NSAPI_template::nsapi() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nsapi of a non-specific template of type @GTPC_Types.LHN_ID_NSAPI."); return single_value->field_nsapi; } BITSTRING_template& LHN__ID__NSAPI_template::spare() { set_specific(); return single_value->field_spare; } const BITSTRING_template& LHN__ID__NSAPI_template::spare() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field spare of a non-specific template of type @GTPC_Types.LHN_ID_NSAPI."); return single_value->field_spare; } OCTETSTRING_template& LHN__ID__NSAPI_template::lHN__ID() { set_specific(); return single_value->field_lHN__ID; } const OCTETSTRING_template& LHN__ID__NSAPI_template::lHN__ID() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lHN_ID of a non-specific template of type @GTPC_Types.LHN_ID_NSAPI."); return single_value->field_lHN__ID; } int LHN__ID__NSAPI_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.LHN_ID_NSAPI which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 4; if (single_value->field_lHN__ID.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 @GTPC_Types.LHN_ID_NSAPI 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 @GTPC_Types.LHN_ID_NSAPI containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.LHN_ID_NSAPI containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.LHN_ID_NSAPI containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.LHN_ID_NSAPI containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.LHN_ID_NSAPI containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.LHN_ID_NSAPI containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.LHN_ID_NSAPI containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.LHN_ID_NSAPI."); } return 0; } void LHN__ID__NSAPI_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ type_gtpc := "); single_value->field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log(); TTCN_Logger::log_event_str(", nsapi := "); single_value->field_nsapi.log(); TTCN_Logger::log_event_str(", spare := "); single_value->field_spare.log(); TTCN_Logger::log_event_str(", lHN_ID := "); single_value->field_lHN__ID.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 LHN__ID__NSAPI_template::log_match(const LHN__ID__NSAPI& 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_type__gtpc.match(match_value.type__gtpc(), legacy)){ TTCN_Logger::log_logmatch_info(".type_gtpc"); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lengthf.match(match_value.lengthf(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthf"); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_nsapi.match(match_value.nsapi(), legacy)){ TTCN_Logger::log_logmatch_info(".nsapi"); single_value->field_nsapi.log_match(match_value.nsapi(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_spare.match(match_value.spare(), legacy)){ TTCN_Logger::log_logmatch_info(".spare"); single_value->field_spare.log_match(match_value.spare(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.lHN__ID().ispresent()){ if(!single_value->field_lHN__ID.match(match_value.lHN__ID(), legacy)){ TTCN_Logger::log_logmatch_info(".lHN_ID"); single_value->field_lHN__ID.log_match(match_value.lHN__ID(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_lHN__ID.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".lHN_ID := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_lHN__ID.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("{ type_gtpc := "); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::log_event_str(", nsapi := "); single_value->field_nsapi.log_match(match_value.nsapi(), legacy); TTCN_Logger::log_event_str(", spare := "); single_value->field_spare.log_match(match_value.spare(), legacy); TTCN_Logger::log_event_str(", lHN_ID := "); if (match_value.lHN__ID().ispresent()) { single_value->field_lHN__ID.log_match(match_value.lHN__ID(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_lHN__ID.log(); if (single_value->field_lHN__ID.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 LHN__ID__NSAPI_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_type__gtpc.encode_text(text_buf); single_value->field_lengthf.encode_text(text_buf); single_value->field_nsapi.encode_text(text_buf); single_value->field_spare.encode_text(text_buf); single_value->field_lHN__ID.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 @GTPC_Types.LHN_ID_NSAPI."); } } void LHN__ID__NSAPI_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_type__gtpc.decode_text(text_buf); single_value->field_lengthf.decode_text(text_buf); single_value->field_nsapi.decode_text(text_buf); single_value->field_spare.decode_text(text_buf); single_value->field_lHN__ID.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 LHN__ID__NSAPI_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 @GTPC_Types.LHN_ID_NSAPI."); } } void LHN__ID__NSAPI_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: { LHN__ID__NSAPI_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) nsapi().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) lHN__ID().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nsapi")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nsapi().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "spare")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lHN_ID")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lHN__ID().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.LHN_ID_NSAPI: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { LHN__ID__NSAPI_template* precondition = new LHN__ID__NSAPI_template; precondition->set_param(*param.get_elem(0)); LHN__ID__NSAPI_template* implied_template = new LHN__ID__NSAPI_template; implied_template->set_param(*param.get_elem(1)); *this = LHN__ID__NSAPI_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.LHN_ID_NSAPI"); } is_ifpresent = param.get_ifpresent(); } void LHN__ID__NSAPI_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_type__gtpc.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.LHN_ID_NSAPI"); single_value->field_lengthf.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.LHN_ID_NSAPI"); single_value->field_nsapi.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.LHN_ID_NSAPI"); single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.LHN_ID_NSAPI"); single_value->field_lHN__ID.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.LHN_ID_NSAPI"); 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 : "@GTPC_Types.LHN_ID_NSAPI"); } boolean LHN__ID__NSAPI_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean LHN__ID__NSAPI_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_explicitly__specified) : field_type__gtpc(par_type__gtpc), field_lengthf(par_lengthf), field_selectionEntity(par_selectionEntity), field_spare(par_spare), field_explicitly__specified(par_explicitly__specified) { } CN__OperatorSelectionEntity::CN__OperatorSelectionEntity(const CN__OperatorSelectionEntity& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GTPC_Types.CN_OperatorSelectionEntity."); if (other_value.type__gtpc().is_bound()) field_type__gtpc = other_value.type__gtpc(); else field_type__gtpc.clean_up(); if (other_value.lengthf().is_bound()) field_lengthf = other_value.lengthf(); else field_lengthf.clean_up(); if (other_value.selectionEntity().is_bound()) field_selectionEntity = other_value.selectionEntity(); else field_selectionEntity.clean_up(); if (other_value.spare().is_bound()) field_spare = other_value.spare(); else field_spare.clean_up(); if (other_value.explicitly__specified().is_bound()) field_explicitly__specified = other_value.explicitly__specified(); else field_explicitly__specified.clean_up(); } void CN__OperatorSelectionEntity::clean_up() { field_type__gtpc.clean_up(); field_lengthf.clean_up(); field_selectionEntity.clean_up(); field_spare.clean_up(); field_explicitly__specified.clean_up(); } const TTCN_Typedescriptor_t* CN__OperatorSelectionEntity::get_descriptor() const { return &CN__OperatorSelectionEntity_descr_; } CN__OperatorSelectionEntity& CN__OperatorSelectionEntity::operator=(const CN__OperatorSelectionEntity& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GTPC_Types.CN_OperatorSelectionEntity."); if (other_value.type__gtpc().is_bound()) field_type__gtpc = other_value.type__gtpc(); else field_type__gtpc.clean_up(); if (other_value.lengthf().is_bound()) field_lengthf = other_value.lengthf(); else field_lengthf.clean_up(); if (other_value.selectionEntity().is_bound()) field_selectionEntity = other_value.selectionEntity(); else field_selectionEntity.clean_up(); if (other_value.spare().is_bound()) field_spare = other_value.spare(); else field_spare.clean_up(); if (other_value.explicitly__specified().is_bound()) field_explicitly__specified = other_value.explicitly__specified(); else field_explicitly__specified.clean_up(); } return *this; } boolean CN__OperatorSelectionEntity::operator==(const CN__OperatorSelectionEntity& other_value) const { return field_type__gtpc==other_value.field_type__gtpc && field_lengthf==other_value.field_lengthf && field_selectionEntity==other_value.field_selectionEntity && field_spare==other_value.field_spare && field_explicitly__specified==other_value.field_explicitly__specified; } boolean CN__OperatorSelectionEntity::is_bound() const { return (field_type__gtpc.is_bound()) || (field_lengthf.is_bound()) || (field_selectionEntity.is_bound()) || (field_spare.is_bound()) || (OPTIONAL_OMIT == field_explicitly__specified.get_selection() || field_explicitly__specified.is_bound()); } boolean CN__OperatorSelectionEntity::is_value() const { return field_type__gtpc.is_value() && field_lengthf.is_value() && field_selectionEntity.is_value() && field_spare.is_value() && (OPTIONAL_OMIT == field_explicitly__specified.get_selection() || field_explicitly__specified.is_value()); } int CN__OperatorSelectionEntity::size_of() const { int ret_val = 4; if (field_explicitly__specified.ispresent()) ret_val++; return ret_val; } void CN__OperatorSelectionEntity::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ type_gtpc := "); field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); field_lengthf.log(); TTCN_Logger::log_event_str(", selectionEntity := "); field_selectionEntity.log(); TTCN_Logger::log_event_str(", spare := "); field_spare.log(); TTCN_Logger::log_event_str(", explicitly_specified := "); field_explicitly__specified.log(); TTCN_Logger::log_event_str(" }"); } void CN__OperatorSelectionEntity::set_implicit_omit() { if (type__gtpc().is_bound()) type__gtpc().set_implicit_omit(); if (lengthf().is_bound()) lengthf().set_implicit_omit(); if (selectionEntity().is_bound()) selectionEntity().set_implicit_omit(); if (spare().is_bound()) spare().set_implicit_omit(); if (!explicitly__specified().is_bound()) explicitly__specified() = OMIT_VALUE; else explicitly__specified().set_implicit_omit(); } void CN__OperatorSelectionEntity::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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) selectionEntity().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) explicitly__specified().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "selectionEntity")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { selectionEntity().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "spare")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "explicitly_specified")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { explicitly__specified().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.CN_OperatorSelectionEntity: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GTPC_Types.CN_OperatorSelectionEntity"); } } void CN__OperatorSelectionEntity::encode_text(Text_Buf& text_buf) const { field_type__gtpc.encode_text(text_buf); field_lengthf.encode_text(text_buf); field_selectionEntity.encode_text(text_buf); field_spare.encode_text(text_buf); field_explicitly__specified.encode_text(text_buf); } void CN__OperatorSelectionEntity::decode_text(Text_Buf& text_buf) { field_type__gtpc.decode_text(text_buf); field_lengthf.decode_text(text_buf); field_selectionEntity.decode_text(text_buf); field_spare.decode_text(text_buf); field_explicitly__specified.decode_text(text_buf); } void CN__OperatorSelectionEntity::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 CN__OperatorSelectionEntity::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 CN__OperatorSelectionEntity::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; int value_of_length_field1 = 0; RAW_Force_Omit field_0_force_omit(0, force_omit, General__Types::OCT1_descr_.raw->forceomit); decoded_field_length = field_type__gtpc.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, CN__OperatorSelectionEntity_lengthf_descr_.raw->forceomit); decoded_field_length = field_lengthf.RAW_decode(CN__OperatorSelectionEntity_lengthf_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()); INTEGER tmp1 = field_lengthf.convert_to_Integer(CN__OperatorSelectionEntity_lengthf_descr_); field_lengthf = tmp1; value_of_length_field1 += tmp1.get_long_long_val() * 8; RAW_Force_Omit field_2_force_omit(2, force_omit, General__Types::BIT2_descr_.raw->forceomit); decoded_field_length = field_selectionEntity.RAW_decode(General__Types::BIT2_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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()); value_of_length_field1 -= decoded_field_length; RAW_Force_Omit field_3_force_omit(3, force_omit, General__Types::BIT6_descr_.raw->forceomit); decoded_field_length = field_spare.RAW_decode(General__Types::BIT6_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), 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_field1 -= decoded_field_length; if (limit > 0 && value_of_length_field1 > 0){ if (force_omit != NULL && (*force_omit)(4)) { field_explicitly__specified = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_4_force_omit(4, force_omit, OCTETSTRING_descr_.raw->forceomit); decoded_field_length = field_explicitly__specified().RAW_decode(OCTETSTRING_descr_, p_buf, min_of_ints(2, limit, value_of_length_field1), local_top_order, TRUE, -1, TRUE, &field_4_force_omit); if (decoded_field_length < 1) { field_explicitly__specified = 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()); value_of_length_field1 -= decoded_field_length; } } } else field_explicitly__specified=OMIT_VALUE; if (field_type__gtpc != os_39) return -1; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int CN__OperatorSelectionEntity::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, CN__OperatorSelectionEntity_lengthf_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, General__Types::BIT2_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, General__Types::BIT6_descr_.raw); if (field_explicitly__specified.ispresent()) { myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, OCTETSTRING_descr_.raw); } else myleaf.body.node.nodes[4] = NULL; encoded_length += field_type__gtpc.RAW_encode(General__Types::OCT1_descr_, *myleaf.body.node.nodes[0]); encoded_length += 16; myleaf.body.node.nodes[1]->calc = CALC_LENGTH; myleaf.body.node.nodes[1]->coding_descr = &CN__OperatorSelectionEntity_lengthf_descr_; myleaf.body.node.nodes[1]->calcof.lengthto.num_of_fields = 3; myleaf.body.node.nodes[1]->calcof.lengthto.unit = 8; myleaf.body.node.nodes[1]->calcof.lengthto.offset = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields = init_lengthto_fields_list(3); myleaf.body.node.nodes[1]->length = 16; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[2]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[2]->curr_pos.pos; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].level = myleaf.body.node.nodes[3]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[1].pos = myleaf.body.node.nodes[3]->curr_pos.pos; if (field_explicitly__specified.ispresent()) { myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].level = myleaf.body.node.nodes[4]->curr_pos.level; myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].pos = myleaf.body.node.nodes[4]->curr_pos.pos; } else { myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].level = 0; myleaf.body.node.nodes[1]->calcof.lengthto.fields[2].pos = 0; } encoded_length += field_selectionEntity.RAW_encode(General__Types::BIT2_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_spare.RAW_encode(General__Types::BIT6_descr_, *myleaf.body.node.nodes[3]); if (field_explicitly__specified.ispresent()) { encoded_length += field_explicitly__specified().RAW_encode(OCTETSTRING_descr_, *myleaf.body.node.nodes[4]); } if (field_type__gtpc != os_39) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={0}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ os_39.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 CN__OperatorSelectionEntity_template::single_value_struct { OCTETSTRING_template field_type__gtpc; INTEGER_template field_lengthf; BITSTRING_template field_selectionEntity; BITSTRING_template field_spare; OCTETSTRING_template field_explicitly__specified; }; void CN__OperatorSelectionEntity_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_type__gtpc = ANY_VALUE; single_value->field_lengthf = ANY_VALUE; single_value->field_selectionEntity = ANY_VALUE; single_value->field_spare = ANY_VALUE; single_value->field_explicitly__specified = ANY_OR_OMIT; } } } void CN__OperatorSelectionEntity_template::copy_value(const CN__OperatorSelectionEntity& other_value) { single_value = new single_value_struct; if (other_value.type__gtpc().is_bound()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (other_value.lengthf().is_bound()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (other_value.selectionEntity().is_bound()) { single_value->field_selectionEntity = other_value.selectionEntity(); } else { single_value->field_selectionEntity.clean_up(); } if (other_value.spare().is_bound()) { single_value->field_spare = other_value.spare(); } else { single_value->field_spare.clean_up(); } if (other_value.explicitly__specified().is_bound()) { if (other_value.explicitly__specified().ispresent()) single_value->field_explicitly__specified = other_value.explicitly__specified()(); else single_value->field_explicitly__specified = OMIT_VALUE; } else { single_value->field_explicitly__specified.clean_up(); } set_selection(SPECIFIC_VALUE); } void CN__OperatorSelectionEntity_template::copy_template(const CN__OperatorSelectionEntity_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.type__gtpc().get_selection()) { single_value->field_type__gtpc = other_value.type__gtpc(); } else { single_value->field_type__gtpc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.lengthf().get_selection()) { single_value->field_lengthf = other_value.lengthf(); } else { single_value->field_lengthf.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.selectionEntity().get_selection()) { single_value->field_selectionEntity = other_value.selectionEntity(); } else { single_value->field_selectionEntity.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.spare().get_selection()) { single_value->field_spare = other_value.spare(); } else { single_value->field_spare.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.explicitly__specified().get_selection()) { single_value->field_explicitly__specified = other_value.explicitly__specified(); } else { single_value->field_explicitly__specified.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 CN__OperatorSelectionEntity_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 CN__OperatorSelectionEntity_template(*other_value.implication_.precondition); implication_.implied_template = new CN__OperatorSelectionEntity_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 @GTPC_Types.CN_OperatorSelectionEntity."); break; } set_selection(other_value); } CN__OperatorSelectionEntity_template::CN__OperatorSelectionEntity_template() { } CN__OperatorSelectionEntity_template::CN__OperatorSelectionEntity_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } CN__OperatorSelectionEntity_template::CN__OperatorSelectionEntity_template(const CN__OperatorSelectionEntity& other_value) { copy_value(other_value); } CN__OperatorSelectionEntity_template::CN__OperatorSelectionEntity_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const CN__OperatorSelectionEntity&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GTPC_Types.CN_OperatorSelectionEntity from an unbound optional field."); } } CN__OperatorSelectionEntity_template::CN__OperatorSelectionEntity_template(CN__OperatorSelectionEntity_template* p_precondition, CN__OperatorSelectionEntity_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } CN__OperatorSelectionEntity_template::CN__OperatorSelectionEntity_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; } CN__OperatorSelectionEntity_template::CN__OperatorSelectionEntity_template(const CN__OperatorSelectionEntity_template& other_value) : Base_Template() { copy_template(other_value); } CN__OperatorSelectionEntity_template::~CN__OperatorSelectionEntity_template() { clean_up(); } CN__OperatorSelectionEntity_template& CN__OperatorSelectionEntity_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } CN__OperatorSelectionEntity_template& CN__OperatorSelectionEntity_template::operator=(const CN__OperatorSelectionEntity& other_value) { clean_up(); copy_value(other_value); return *this; } CN__OperatorSelectionEntity_template& CN__OperatorSelectionEntity_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const CN__OperatorSelectionEntity&)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 @GTPC_Types.CN_OperatorSelectionEntity."); } return *this; } CN__OperatorSelectionEntity_template& CN__OperatorSelectionEntity_template::operator=(const CN__OperatorSelectionEntity_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean CN__OperatorSelectionEntity_template::match(const CN__OperatorSelectionEntity& 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.type__gtpc().is_bound()) return FALSE; if(!single_value->field_type__gtpc.match(other_value.type__gtpc(), legacy))return FALSE; if(!other_value.lengthf().is_bound()) return FALSE; if(!single_value->field_lengthf.match(other_value.lengthf(), legacy))return FALSE; if(!other_value.selectionEntity().is_bound()) return FALSE; if(!single_value->field_selectionEntity.match(other_value.selectionEntity(), legacy))return FALSE; if(!other_value.spare().is_bound()) return FALSE; if(!single_value->field_spare.match(other_value.spare(), legacy))return FALSE; if(!other_value.explicitly__specified().is_bound()) return FALSE; if((other_value.explicitly__specified().ispresent() ? !single_value->field_explicitly__specified.match((const OCTETSTRING&)other_value.explicitly__specified(), legacy) : !single_value->field_explicitly__specified.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 @GTPC_Types.CN_OperatorSelectionEntity."); } return FALSE; } boolean CN__OperatorSelectionEntity_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_type__gtpc.is_bound() || single_value->field_lengthf.is_bound() || single_value->field_selectionEntity.is_bound() || single_value->field_spare.is_bound() || (single_value->field_explicitly__specified.is_omit() || single_value->field_explicitly__specified.is_bound()); } boolean CN__OperatorSelectionEntity_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_type__gtpc.is_value() && single_value->field_lengthf.is_value() && single_value->field_selectionEntity.is_value() && single_value->field_spare.is_value() && (single_value->field_explicitly__specified.is_omit() || single_value->field_explicitly__specified.is_value()); } void CN__OperatorSelectionEntity_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; } CN__OperatorSelectionEntity CN__OperatorSelectionEntity_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 @GTPC_Types.CN_OperatorSelectionEntity."); CN__OperatorSelectionEntity ret_val; if (single_value->field_type__gtpc.is_bound()) { ret_val.type__gtpc() = single_value->field_type__gtpc.valueof(); } if (single_value->field_lengthf.is_bound()) { ret_val.lengthf() = single_value->field_lengthf.valueof(); } if (single_value->field_selectionEntity.is_bound()) { ret_val.selectionEntity() = single_value->field_selectionEntity.valueof(); } if (single_value->field_spare.is_bound()) { ret_val.spare() = single_value->field_spare.valueof(); } if (single_value->field_explicitly__specified.is_omit()) ret_val.explicitly__specified() = OMIT_VALUE; else if (single_value->field_explicitly__specified.is_bound()) { ret_val.explicitly__specified() = single_value->field_explicitly__specified.valueof(); } return ret_val; } void CN__OperatorSelectionEntity_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 @GTPC_Types.CN_OperatorSelectionEntity."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new CN__OperatorSelectionEntity_template[list_length]; } CN__OperatorSelectionEntity_template& CN__OperatorSelectionEntity_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 @GTPC_Types.CN_OperatorSelectionEntity."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GTPC_Types.CN_OperatorSelectionEntity."); return value_list.list_value[list_index]; } OCTETSTRING_template& CN__OperatorSelectionEntity_template::type__gtpc() { set_specific(); return single_value->field_type__gtpc; } const OCTETSTRING_template& CN__OperatorSelectionEntity_template::type__gtpc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field type_gtpc of a non-specific template of type @GTPC_Types.CN_OperatorSelectionEntity."); return single_value->field_type__gtpc; } INTEGER_template& CN__OperatorSelectionEntity_template::lengthf() { set_specific(); return single_value->field_lengthf; } const INTEGER_template& CN__OperatorSelectionEntity_template::lengthf() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field lengthf of a non-specific template of type @GTPC_Types.CN_OperatorSelectionEntity."); return single_value->field_lengthf; } BITSTRING_template& CN__OperatorSelectionEntity_template::selectionEntity() { set_specific(); return single_value->field_selectionEntity; } const BITSTRING_template& CN__OperatorSelectionEntity_template::selectionEntity() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field selectionEntity of a non-specific template of type @GTPC_Types.CN_OperatorSelectionEntity."); return single_value->field_selectionEntity; } BITSTRING_template& CN__OperatorSelectionEntity_template::spare() { set_specific(); return single_value->field_spare; } const BITSTRING_template& CN__OperatorSelectionEntity_template::spare() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field spare of a non-specific template of type @GTPC_Types.CN_OperatorSelectionEntity."); return single_value->field_spare; } OCTETSTRING_template& CN__OperatorSelectionEntity_template::explicitly__specified() { set_specific(); return single_value->field_explicitly__specified; } const OCTETSTRING_template& CN__OperatorSelectionEntity_template::explicitly__specified() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field explicitly_specified of a non-specific template of type @GTPC_Types.CN_OperatorSelectionEntity."); return single_value->field_explicitly__specified; } int CN__OperatorSelectionEntity_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.CN_OperatorSelectionEntity which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 4; if (single_value->field_explicitly__specified.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 @GTPC_Types.CN_OperatorSelectionEntity 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 @GTPC_Types.CN_OperatorSelectionEntity containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.CN_OperatorSelectionEntity containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.CN_OperatorSelectionEntity containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.CN_OperatorSelectionEntity containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.CN_OperatorSelectionEntity containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.CN_OperatorSelectionEntity containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GTPC_Types.CN_OperatorSelectionEntity containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GTPC_Types.CN_OperatorSelectionEntity."); } return 0; } void CN__OperatorSelectionEntity_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ type_gtpc := "); single_value->field_type__gtpc.log(); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log(); TTCN_Logger::log_event_str(", selectionEntity := "); single_value->field_selectionEntity.log(); TTCN_Logger::log_event_str(", spare := "); single_value->field_spare.log(); TTCN_Logger::log_event_str(", explicitly_specified := "); single_value->field_explicitly__specified.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 CN__OperatorSelectionEntity_template::log_match(const CN__OperatorSelectionEntity& 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_type__gtpc.match(match_value.type__gtpc(), legacy)){ TTCN_Logger::log_logmatch_info(".type_gtpc"); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_lengthf.match(match_value.lengthf(), legacy)){ TTCN_Logger::log_logmatch_info(".lengthf"); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_selectionEntity.match(match_value.selectionEntity(), legacy)){ TTCN_Logger::log_logmatch_info(".selectionEntity"); single_value->field_selectionEntity.log_match(match_value.selectionEntity(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_spare.match(match_value.spare(), legacy)){ TTCN_Logger::log_logmatch_info(".spare"); single_value->field_spare.log_match(match_value.spare(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.explicitly__specified().ispresent()){ if(!single_value->field_explicitly__specified.match(match_value.explicitly__specified(), legacy)){ TTCN_Logger::log_logmatch_info(".explicitly_specified"); single_value->field_explicitly__specified.log_match(match_value.explicitly__specified(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_explicitly__specified.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".explicitly_specified := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_explicitly__specified.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("{ type_gtpc := "); single_value->field_type__gtpc.log_match(match_value.type__gtpc(), legacy); TTCN_Logger::log_event_str(", lengthf := "); single_value->field_lengthf.log_match(match_value.lengthf(), legacy); TTCN_Logger::log_event_str(", selectionEntity := "); single_value->field_selectionEntity.log_match(match_value.selectionEntity(), legacy); TTCN_Logger::log_event_str(", spare := "); single_value->field_spare.log_match(match_value.spare(), legacy); TTCN_Logger::log_event_str(", explicitly_specified := "); if (match_value.explicitly__specified().ispresent()) { single_value->field_explicitly__specified.log_match(match_value.explicitly__specified(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_explicitly__specified.log(); if (single_value->field_explicitly__specified.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 CN__OperatorSelectionEntity_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_type__gtpc.encode_text(text_buf); single_value->field_lengthf.encode_text(text_buf); single_value->field_selectionEntity.encode_text(text_buf); single_value->field_spare.encode_text(text_buf); single_value->field_explicitly__specified.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 @GTPC_Types.CN_OperatorSelectionEntity."); } } void CN__OperatorSelectionEntity_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_type__gtpc.decode_text(text_buf); single_value->field_lengthf.decode_text(text_buf); single_value->field_selectionEntity.decode_text(text_buf); single_value->field_spare.decode_text(text_buf); single_value->field_explicitly__specified.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 CN__OperatorSelectionEntity_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 @GTPC_Types.CN_OperatorSelectionEntity."); } } void CN__OperatorSelectionEntity_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: { CN__OperatorSelectionEntity_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) type__gtpc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) lengthf().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) selectionEntity().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) spare().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) explicitly__specified().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(), "type_gtpc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { type__gtpc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "lengthf")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { lengthf().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "selectionEntity")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { selectionEntity().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "spare")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spare().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "explicitly_specified")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { explicitly__specified().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GTPC_Types.CN_OperatorSelectionEntity: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { CN__OperatorSelectionEntity_template* precondition = new CN__OperatorSelectionEntity_template; precondition->set_param(*param.get_elem(0)); CN__OperatorSelectionEntity_template* implied_template = new CN__OperatorSelectionEntity_template; implied_template->set_param(*param.get_elem(1)); *this = CN__OperatorSelectionEntity_template(precondition, implied_template); } break; default: param.type_error("record template", "@GTPC_Types.CN_OperatorSelectionEntity"); } is_ifpresent = param.get_ifpresent(); } void CN__OperatorSelectionEntity_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_type__gtpc.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.CN_OperatorSelectionEntity"); single_value->field_lengthf.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.CN_OperatorSelectionEntity"); single_value->field_selectionEntity.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.CN_OperatorSelectionEntity"); single_value->field_spare.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.CN_OperatorSelectionEntity"); single_value->field_explicitly__specified.check_restriction(t_res, t_name ? t_name : "@GTPC_Types.CN_OperatorSelectionEntity"); 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 : "@GTPC_Types.CN_OperatorSelectionEntity"); } boolean CN__OperatorSelectionEntity_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean CN__OperatorSelectionEntity_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