// This C++ source file was generated by the TTCN-3 compiler // of the TTCN-3 Test Executor version 11.1.0 // The generation of user and time information were disabled by the -D flag. // Copyright (c) 2000-2025 Ericsson Telecom AB // Do not edit this file unless you know what you are doing. /* Including header files */ #include "GSM_RestOctets.hh" namespace GSM__RestOctets { /* Member functions of C++ classes */ GPRS__ReportPrioDescOpt::GPRS__ReportPrioDescOpt() { } GPRS__ReportPrioDescOpt::GPRS__ReportPrioDescOpt(const BITSTRING& par_presence, const OPTIONAL< BITSTRING >& par_desc) : field_presence(par_presence), field_desc(par_desc) { } GPRS__ReportPrioDescOpt::GPRS__ReportPrioDescOpt(const GPRS__ReportPrioDescOpt& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.GPRS_ReportPrioDescOpt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.desc().is_bound()) field_desc = other_value.desc(); else field_desc.clean_up(); } void GPRS__ReportPrioDescOpt::clean_up() { field_presence.clean_up(); field_desc.clean_up(); } const TTCN_Typedescriptor_t* GPRS__ReportPrioDescOpt::get_descriptor() const { return &GPRS__ReportPrioDescOpt_descr_; } GPRS__ReportPrioDescOpt& GPRS__ReportPrioDescOpt::operator=(const GPRS__ReportPrioDescOpt& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.GPRS_ReportPrioDescOpt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.desc().is_bound()) field_desc = other_value.desc(); else field_desc.clean_up(); } return *this; } boolean GPRS__ReportPrioDescOpt::operator==(const GPRS__ReportPrioDescOpt& other_value) const { return field_presence==other_value.field_presence && field_desc==other_value.field_desc; } boolean GPRS__ReportPrioDescOpt::is_bound() const { return (field_presence.is_bound()) || (OPTIONAL_OMIT == field_desc.get_selection() || field_desc.is_bound()); } boolean GPRS__ReportPrioDescOpt::is_value() const { return field_presence.is_value() && (OPTIONAL_OMIT == field_desc.get_selection() || field_desc.is_value()); } int GPRS__ReportPrioDescOpt::size_of() const { int ret_val = 1; if (field_desc.ispresent()) ret_val++; return ret_val; } void GPRS__ReportPrioDescOpt::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ presence := "); field_presence.log(); TTCN_Logger::log_event_str(", desc := "); field_desc.log(); TTCN_Logger::log_event_str(" }"); } void GPRS__ReportPrioDescOpt::set_implicit_omit() { if (presence().is_bound()) presence().set_implicit_omit(); if (!desc().is_bound()) desc() = OMIT_VALUE; else desc().set_implicit_omit(); } void GPRS__ReportPrioDescOpt::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) presence().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) desc().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(), "presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.GPRS_ReportPrioDescOpt: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.GPRS_ReportPrioDescOpt"); } } void GPRS__ReportPrioDescOpt::encode_text(Text_Buf& text_buf) const { field_presence.encode_text(text_buf); field_desc.encode_text(text_buf); } void GPRS__ReportPrioDescOpt::decode_text(Text_Buf& text_buf) { field_presence.decode_text(text_buf); field_desc.decode_text(text_buf); } void GPRS__ReportPrioDescOpt::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name); if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); PER_encode(p_td, p_buf, opt); break; } default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void GPRS__ReportPrioDescOpt::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name); if(!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); try { PER_decode(p_td, p_buf, opt); p_buf.PER_octet_align(FALSE); } catch (PER_Buffer_Exception) { } break; } default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int GPRS__ReportPrioDescOpt::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, GPRS__ReportPrioDescOpt_presence_descr_.raw->forceomit); decoded_field_length = field_presence.RAW_decode(GPRS__ReportPrioDescOpt_presence_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); if (limit > 0 && field_presence == bs_0){ if (force_omit != NULL && (*force_omit)(1)) { field_desc = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_1_force_omit(1, force_omit, GPRS__ReportPrioDescOpt_desc_descr_.raw->forceomit); decoded_field_length = field_desc().RAW_decode(GPRS__ReportPrioDescOpt_desc_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 1) { field_desc = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } else field_desc=OMIT_VALUE; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int GPRS__ReportPrioDescOpt::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, GPRS__ReportPrioDescOpt_presence_descr_.raw); if (field_desc.ispresent()) { myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, GPRS__ReportPrioDescOpt_desc_descr_.raw); } else myleaf.body.node.nodes[1] = NULL; encoded_length += field_presence.RAW_encode(GPRS__ReportPrioDescOpt_presence_descr_, *myleaf.body.node.nodes[0]); if (field_desc.ispresent()) { encoded_length += field_desc().RAW_encode(GPRS__ReportPrioDescOpt_desc_descr_, *myleaf.body.node.nodes[1]); } if (field_desc.ispresent() && (field_presence != bs_0)) { 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){ bs_0.RAW_encode(GPRS__ReportPrioDescOpt_presence_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 GPRS__ReportPrioDescOpt_template::single_value_struct { BITSTRING_template field_presence; BITSTRING_template field_desc; }; void GPRS__ReportPrioDescOpt_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_presence = ANY_VALUE; single_value->field_desc = ANY_OR_OMIT; } } } void GPRS__ReportPrioDescOpt_template::copy_value(const GPRS__ReportPrioDescOpt& other_value) { single_value = new single_value_struct; if (other_value.presence().is_bound()) { single_value->field_presence = other_value.presence(); } else { single_value->field_presence.clean_up(); } if (other_value.desc().is_bound()) { if (other_value.desc().ispresent()) single_value->field_desc = other_value.desc()(); else single_value->field_desc = OMIT_VALUE; } else { single_value->field_desc.clean_up(); } set_selection(SPECIFIC_VALUE); } void GPRS__ReportPrioDescOpt_template::copy_template(const GPRS__ReportPrioDescOpt_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.presence().get_selection()) { single_value->field_presence = other_value.presence(); } else { single_value->field_presence.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.desc().get_selection()) { single_value->field_desc = other_value.desc(); } else { single_value->field_desc.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 GPRS__ReportPrioDescOpt_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 GPRS__ReportPrioDescOpt_template(*other_value.implication_.precondition); implication_.implied_template = new GPRS__ReportPrioDescOpt_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of type @GSM_RestOctets.GPRS_ReportPrioDescOpt."); break; } set_selection(other_value); } GPRS__ReportPrioDescOpt_template::GPRS__ReportPrioDescOpt_template() { } GPRS__ReportPrioDescOpt_template::GPRS__ReportPrioDescOpt_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } GPRS__ReportPrioDescOpt_template::GPRS__ReportPrioDescOpt_template(const GPRS__ReportPrioDescOpt& other_value) { copy_value(other_value); } GPRS__ReportPrioDescOpt_template::GPRS__ReportPrioDescOpt_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const GPRS__ReportPrioDescOpt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.GPRS_ReportPrioDescOpt from an unbound optional field."); } } GPRS__ReportPrioDescOpt_template::GPRS__ReportPrioDescOpt_template(GPRS__ReportPrioDescOpt_template* p_precondition, GPRS__ReportPrioDescOpt_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } GPRS__ReportPrioDescOpt_template::GPRS__ReportPrioDescOpt_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; } GPRS__ReportPrioDescOpt_template::GPRS__ReportPrioDescOpt_template(const GPRS__ReportPrioDescOpt_template& other_value) : Base_Template() { copy_template(other_value); } GPRS__ReportPrioDescOpt_template::~GPRS__ReportPrioDescOpt_template() { clean_up(); } GPRS__ReportPrioDescOpt_template& GPRS__ReportPrioDescOpt_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } GPRS__ReportPrioDescOpt_template& GPRS__ReportPrioDescOpt_template::operator=(const GPRS__ReportPrioDescOpt& other_value) { clean_up(); copy_value(other_value); return *this; } GPRS__ReportPrioDescOpt_template& GPRS__ReportPrioDescOpt_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const GPRS__ReportPrioDescOpt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @GSM_RestOctets.GPRS_ReportPrioDescOpt."); } return *this; } GPRS__ReportPrioDescOpt_template& GPRS__ReportPrioDescOpt_template::operator=(const GPRS__ReportPrioDescOpt_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean GPRS__ReportPrioDescOpt_template::match(const GPRS__ReportPrioDescOpt& 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.presence().is_bound()) return FALSE; if(!single_value->field_presence.match(other_value.presence(), legacy))return FALSE; if(!other_value.desc().is_bound()) return FALSE; if((other_value.desc().ispresent() ? !single_value->field_desc.match((const BITSTRING&)other_value.desc(), legacy) : !single_value->field_desc.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 @GSM_RestOctets.GPRS_ReportPrioDescOpt."); } return FALSE; } boolean GPRS__ReportPrioDescOpt_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_presence.is_bound() || (single_value->field_desc.is_omit() || single_value->field_desc.is_bound()); } boolean GPRS__ReportPrioDescOpt_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_presence.is_value() && (single_value->field_desc.is_omit() || single_value->field_desc.is_value()); } void GPRS__ReportPrioDescOpt_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; } GPRS__ReportPrioDescOpt GPRS__ReportPrioDescOpt_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @GSM_RestOctets.GPRS_ReportPrioDescOpt."); GPRS__ReportPrioDescOpt ret_val; if (single_value->field_presence.is_bound()) { ret_val.presence() = single_value->field_presence.valueof(); } if (single_value->field_desc.is_omit()) ret_val.desc() = OMIT_VALUE; else if (single_value->field_desc.is_bound()) { ret_val.desc() = single_value->field_desc.valueof(); } return ret_val; } void GPRS__ReportPrioDescOpt_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list for a template of type @GSM_RestOctets.GPRS_ReportPrioDescOpt."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new GPRS__ReportPrioDescOpt_template[list_length]; } GPRS__ReportPrioDescOpt_template& GPRS__ReportPrioDescOpt_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element of a non-list template of type @GSM_RestOctets.GPRS_ReportPrioDescOpt."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.GPRS_ReportPrioDescOpt."); return value_list.list_value[list_index]; } BITSTRING_template& GPRS__ReportPrioDescOpt_template::presence() { set_specific(); return single_value->field_presence; } const BITSTRING_template& GPRS__ReportPrioDescOpt_template::presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field presence of a non-specific template of type @GSM_RestOctets.GPRS_ReportPrioDescOpt."); return single_value->field_presence; } BITSTRING_template& GPRS__ReportPrioDescOpt_template::desc() { set_specific(); return single_value->field_desc; } const BITSTRING_template& GPRS__ReportPrioDescOpt_template::desc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field desc of a non-specific template of type @GSM_RestOctets.GPRS_ReportPrioDescOpt."); return single_value->field_desc; } int GPRS__ReportPrioDescOpt_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.GPRS_ReportPrioDescOpt which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 1; if (single_value->field_desc.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 @GSM_RestOctets.GPRS_ReportPrioDescOpt containing an empty list."); int item_size = value_list.list_value[0].size_of(); for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++) { if (value_list.list_value[l_idx].size_of()!=item_size) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.GPRS_ReportPrioDescOpt containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.GPRS_ReportPrioDescOpt containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.GPRS_ReportPrioDescOpt containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.GPRS_ReportPrioDescOpt containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.GPRS_ReportPrioDescOpt containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.GPRS_ReportPrioDescOpt containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.GPRS_ReportPrioDescOpt containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.GPRS_ReportPrioDescOpt."); } return 0; } void GPRS__ReportPrioDescOpt_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ presence := "); single_value->field_presence.log(); TTCN_Logger::log_event_str(", desc := "); single_value->field_desc.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 GPRS__ReportPrioDescOpt_template::log_match(const GPRS__ReportPrioDescOpt& 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_presence.match(match_value.presence(), legacy)){ TTCN_Logger::log_logmatch_info(".presence"); single_value->field_presence.log_match(match_value.presence(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.desc().ispresent()){ if(!single_value->field_desc.match(match_value.desc(), legacy)){ TTCN_Logger::log_logmatch_info(".desc"); single_value->field_desc.log_match(match_value.desc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_desc.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".desc := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_desc.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("{ presence := "); single_value->field_presence.log_match(match_value.presence(), legacy); TTCN_Logger::log_event_str(", desc := "); if (match_value.desc().ispresent()) { single_value->field_desc.log_match(match_value.desc(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_desc.log(); if (single_value->field_desc.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 GPRS__ReportPrioDescOpt_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (presence().is_bound()) presence().set_implicit_omit(); if (!desc().is_bound()) desc() = OMIT_VALUE; else desc().set_implicit_omit(); } void GPRS__ReportPrioDescOpt_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_presence.encode_text(text_buf); single_value->field_desc.encode_text(text_buf); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @GSM_RestOctets.GPRS_ReportPrioDescOpt."); } } void GPRS__ReportPrioDescOpt_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_presence.decode_text(text_buf); single_value->field_desc.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 GPRS__ReportPrioDescOpt_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @GSM_RestOctets.GPRS_ReportPrioDescOpt."); } } void GPRS__ReportPrioDescOpt_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: { GPRS__ReportPrioDescOpt_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) presence().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) desc().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(), "presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.GPRS_ReportPrioDescOpt: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { GPRS__ReportPrioDescOpt_template* precondition = new GPRS__ReportPrioDescOpt_template; precondition->set_param(*param.get_elem(0)); GPRS__ReportPrioDescOpt_template* implied_template = new GPRS__ReportPrioDescOpt_template; implied_template->set_param(*param.get_elem(1)); *this = GPRS__ReportPrioDescOpt_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.GPRS_ReportPrioDescOpt"); } is_ifpresent = param.get_ifpresent(); } void GPRS__ReportPrioDescOpt_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_presence.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.GPRS_ReportPrioDescOpt"); single_value->field_desc.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.GPRS_ReportPrioDescOpt"); return; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@GSM_RestOctets.GPRS_ReportPrioDescOpt"); } boolean GPRS__ReportPrioDescOpt_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean GPRS__ReportPrioDescOpt_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) rt__diff__desc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) bsic__desc().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) rep__prio__desc().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) meas__params__desc().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(), "rt_diff_desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rt__diff__desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "bsic_desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { bsic__desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "rep_prio_desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rep__prio__desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "meas_params_desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { meas__params__desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.SI2quaterRestOctets.gprs: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.SI2quaterRestOctets.gprs"); } } void SI2quaterRestOctets_gprs::encode_text(Text_Buf& text_buf) const { field_rt__diff__desc.encode_text(text_buf); field_bsic__desc.encode_text(text_buf); field_rep__prio__desc.encode_text(text_buf); field_meas__params__desc.encode_text(text_buf); } void SI2quaterRestOctets_gprs::decode_text(Text_Buf& text_buf) { field_rt__diff__desc.decode_text(text_buf); field_bsic__desc.decode_text(text_buf); field_rep__prio__desc.decode_text(text_buf); field_meas__params__desc.decode_text(text_buf); } void SI2quaterRestOctets_gprs::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name); if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); PER_encode(p_td, p_buf, opt); break; } default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void SI2quaterRestOctets_gprs::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name); if(!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); try { PER_decode(p_td, p_buf, opt); p_buf.PER_octet_align(FALSE); } catch (PER_Buffer_Exception) { } break; } default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int SI2quaterRestOctets_gprs::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, SI2quaterRestOctets_gprs_rt__diff__desc_descr_.raw->forceomit); decoded_field_length = field_rt__diff__desc.RAW_decode(SI2quaterRestOctets_gprs_rt__diff__desc_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, SI2quaterRestOctets_gprs_bsic__desc_descr_.raw->forceomit); decoded_field_length = field_bsic__desc.RAW_decode(SI2quaterRestOctets_gprs_bsic__desc_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, SI2quaterRestOctets_gprs_rep__prio__desc_descr_.raw->forceomit); decoded_field_length = field_rep__prio__desc.RAW_decode(SI2quaterRestOctets_gprs_rep__prio__desc_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, SI2quaterRestOctets_gprs_meas__params__desc_descr_.raw->forceomit); decoded_field_length = field_meas__params__desc.RAW_decode(SI2quaterRestOctets_gprs_meas__params__desc_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_3_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int SI2quaterRestOctets_gprs::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, SI2quaterRestOctets_gprs_rt__diff__desc_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, SI2quaterRestOctets_gprs_bsic__desc_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, SI2quaterRestOctets_gprs_rep__prio__desc_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, SI2quaterRestOctets_gprs_meas__params__desc_descr_.raw); encoded_length += field_rt__diff__desc.RAW_encode(SI2quaterRestOctets_gprs_rt__diff__desc_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_bsic__desc.RAW_encode(SI2quaterRestOctets_gprs_bsic__desc_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_rep__prio__desc.RAW_encode(SI2quaterRestOctets_gprs_rep__prio__desc_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_meas__params__desc.RAW_encode(SI2quaterRestOctets_gprs_meas__params__desc_descr_, *myleaf.body.node.nodes[3]); return myleaf.length = encoded_length; } struct SI2quaterRestOctets_gprs_template::single_value_struct { GPRS__RealTimeDiffDescOpt_template field_rt__diff__desc; GPRS__BSICDescOpt_template field_bsic__desc; GPRS__ReportPrioDescOpt_template field_rep__prio__desc; MeasParamsDescOpt_template field_meas__params__desc; }; void SI2quaterRestOctets_gprs_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_rt__diff__desc = ANY_VALUE; single_value->field_bsic__desc = ANY_VALUE; single_value->field_rep__prio__desc = ANY_VALUE; single_value->field_meas__params__desc = ANY_VALUE; } } } void SI2quaterRestOctets_gprs_template::copy_value(const SI2quaterRestOctets_gprs& other_value) { single_value = new single_value_struct; if (other_value.rt__diff__desc().is_bound()) { single_value->field_rt__diff__desc = other_value.rt__diff__desc(); } else { single_value->field_rt__diff__desc.clean_up(); } if (other_value.bsic__desc().is_bound()) { single_value->field_bsic__desc = other_value.bsic__desc(); } else { single_value->field_bsic__desc.clean_up(); } if (other_value.rep__prio__desc().is_bound()) { single_value->field_rep__prio__desc = other_value.rep__prio__desc(); } else { single_value->field_rep__prio__desc.clean_up(); } if (other_value.meas__params__desc().is_bound()) { single_value->field_meas__params__desc = other_value.meas__params__desc(); } else { single_value->field_meas__params__desc.clean_up(); } set_selection(SPECIFIC_VALUE); } void SI2quaterRestOctets_gprs_template::copy_template(const SI2quaterRestOctets_gprs_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.rt__diff__desc().get_selection()) { single_value->field_rt__diff__desc = other_value.rt__diff__desc(); } else { single_value->field_rt__diff__desc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.bsic__desc().get_selection()) { single_value->field_bsic__desc = other_value.bsic__desc(); } else { single_value->field_bsic__desc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.rep__prio__desc().get_selection()) { single_value->field_rep__prio__desc = other_value.rep__prio__desc(); } else { single_value->field_rep__prio__desc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.meas__params__desc().get_selection()) { single_value->field_meas__params__desc = other_value.meas__params__desc(); } else { single_value->field_meas__params__desc.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 SI2quaterRestOctets_gprs_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 SI2quaterRestOctets_gprs_template(*other_value.implication_.precondition); implication_.implied_template = new SI2quaterRestOctets_gprs_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of type @GSM_RestOctets.SI2quaterRestOctets.gprs."); break; } set_selection(other_value); } SI2quaterRestOctets_gprs_template::SI2quaterRestOctets_gprs_template() { } SI2quaterRestOctets_gprs_template::SI2quaterRestOctets_gprs_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } SI2quaterRestOctets_gprs_template::SI2quaterRestOctets_gprs_template(const SI2quaterRestOctets_gprs& other_value) { copy_value(other_value); } SI2quaterRestOctets_gprs_template::SI2quaterRestOctets_gprs_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI2quaterRestOctets_gprs&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.SI2quaterRestOctets.gprs from an unbound optional field."); } } SI2quaterRestOctets_gprs_template::SI2quaterRestOctets_gprs_template(SI2quaterRestOctets_gprs_template* p_precondition, SI2quaterRestOctets_gprs_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } SI2quaterRestOctets_gprs_template::SI2quaterRestOctets_gprs_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; } SI2quaterRestOctets_gprs_template::SI2quaterRestOctets_gprs_template(const SI2quaterRestOctets_gprs_template& other_value) : Base_Template() { copy_template(other_value); } SI2quaterRestOctets_gprs_template::~SI2quaterRestOctets_gprs_template() { clean_up(); } SI2quaterRestOctets_gprs_template& SI2quaterRestOctets_gprs_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } SI2quaterRestOctets_gprs_template& SI2quaterRestOctets_gprs_template::operator=(const SI2quaterRestOctets_gprs& other_value) { clean_up(); copy_value(other_value); return *this; } SI2quaterRestOctets_gprs_template& SI2quaterRestOctets_gprs_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI2quaterRestOctets_gprs&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @GSM_RestOctets.SI2quaterRestOctets.gprs."); } return *this; } SI2quaterRestOctets_gprs_template& SI2quaterRestOctets_gprs_template::operator=(const SI2quaterRestOctets_gprs_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean SI2quaterRestOctets_gprs_template::match(const SI2quaterRestOctets_gprs& 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.rt__diff__desc().is_bound()) return FALSE; if(!single_value->field_rt__diff__desc.match(other_value.rt__diff__desc(), legacy))return FALSE; if(!other_value.bsic__desc().is_bound()) return FALSE; if(!single_value->field_bsic__desc.match(other_value.bsic__desc(), legacy))return FALSE; if(!other_value.rep__prio__desc().is_bound()) return FALSE; if(!single_value->field_rep__prio__desc.match(other_value.rep__prio__desc(), legacy))return FALSE; if(!other_value.meas__params__desc().is_bound()) return FALSE; if(!single_value->field_meas__params__desc.match(other_value.meas__params__desc(), legacy))return FALSE; return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of type @GSM_RestOctets.SI2quaterRestOctets.gprs."); } return FALSE; } boolean SI2quaterRestOctets_gprs_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_rt__diff__desc.is_bound() || single_value->field_bsic__desc.is_bound() || single_value->field_rep__prio__desc.is_bound() || single_value->field_meas__params__desc.is_bound(); } boolean SI2quaterRestOctets_gprs_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_rt__diff__desc.is_value() && single_value->field_bsic__desc.is_value() && single_value->field_rep__prio__desc.is_value() && single_value->field_meas__params__desc.is_value(); } void SI2quaterRestOctets_gprs_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; } SI2quaterRestOctets_gprs SI2quaterRestOctets_gprs_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @GSM_RestOctets.SI2quaterRestOctets.gprs."); SI2quaterRestOctets_gprs ret_val; if (single_value->field_rt__diff__desc.is_bound()) { ret_val.rt__diff__desc() = single_value->field_rt__diff__desc.valueof(); } if (single_value->field_bsic__desc.is_bound()) { ret_val.bsic__desc() = single_value->field_bsic__desc.valueof(); } if (single_value->field_rep__prio__desc.is_bound()) { ret_val.rep__prio__desc() = single_value->field_rep__prio__desc.valueof(); } if (single_value->field_meas__params__desc.is_bound()) { ret_val.meas__params__desc() = single_value->field_meas__params__desc.valueof(); } return ret_val; } void SI2quaterRestOctets_gprs_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list for a template of type @GSM_RestOctets.SI2quaterRestOctets.gprs."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new SI2quaterRestOctets_gprs_template[list_length]; } SI2quaterRestOctets_gprs_template& SI2quaterRestOctets_gprs_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element of a non-list template of type @GSM_RestOctets.SI2quaterRestOctets.gprs."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.SI2quaterRestOctets.gprs."); return value_list.list_value[list_index]; } GPRS__RealTimeDiffDescOpt_template& SI2quaterRestOctets_gprs_template::rt__diff__desc() { set_specific(); return single_value->field_rt__diff__desc; } const GPRS__RealTimeDiffDescOpt_template& SI2quaterRestOctets_gprs_template::rt__diff__desc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field rt_diff_desc of a non-specific template of type @GSM_RestOctets.SI2quaterRestOctets.gprs."); return single_value->field_rt__diff__desc; } GPRS__BSICDescOpt_template& SI2quaterRestOctets_gprs_template::bsic__desc() { set_specific(); return single_value->field_bsic__desc; } const GPRS__BSICDescOpt_template& SI2quaterRestOctets_gprs_template::bsic__desc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field bsic_desc of a non-specific template of type @GSM_RestOctets.SI2quaterRestOctets.gprs."); return single_value->field_bsic__desc; } GPRS__ReportPrioDescOpt_template& SI2quaterRestOctets_gprs_template::rep__prio__desc() { set_specific(); return single_value->field_rep__prio__desc; } const GPRS__ReportPrioDescOpt_template& SI2quaterRestOctets_gprs_template::rep__prio__desc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field rep_prio_desc of a non-specific template of type @GSM_RestOctets.SI2quaterRestOctets.gprs."); return single_value->field_rep__prio__desc; } MeasParamsDescOpt_template& SI2quaterRestOctets_gprs_template::meas__params__desc() { set_specific(); return single_value->field_meas__params__desc; } const MeasParamsDescOpt_template& SI2quaterRestOctets_gprs_template::meas__params__desc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field meas_params_desc of a non-specific template of type @GSM_RestOctets.SI2quaterRestOctets.gprs."); return single_value->field_meas__params__desc; } int SI2quaterRestOctets_gprs_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterRestOctets.gprs which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 4; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterRestOctets.gprs containing an empty list."); int item_size = value_list.list_value[0].size_of(); for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++) { if (value_list.list_value[l_idx].size_of()!=item_size) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterRestOctets.gprs containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterRestOctets.gprs containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterRestOctets.gprs containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterRestOctets.gprs containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterRestOctets.gprs containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterRestOctets.gprs containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterRestOctets.gprs containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.SI2quaterRestOctets.gprs."); } return 0; } void SI2quaterRestOctets_gprs_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ rt_diff_desc := "); single_value->field_rt__diff__desc.log(); TTCN_Logger::log_event_str(", bsic_desc := "); single_value->field_bsic__desc.log(); TTCN_Logger::log_event_str(", rep_prio_desc := "); single_value->field_rep__prio__desc.log(); TTCN_Logger::log_event_str(", meas_params_desc := "); single_value->field_meas__params__desc.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 SI2quaterRestOctets_gprs_template::log_match(const SI2quaterRestOctets_gprs& 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_rt__diff__desc.match(match_value.rt__diff__desc(), legacy)){ TTCN_Logger::log_logmatch_info(".rt_diff_desc"); single_value->field_rt__diff__desc.log_match(match_value.rt__diff__desc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_bsic__desc.match(match_value.bsic__desc(), legacy)){ TTCN_Logger::log_logmatch_info(".bsic_desc"); single_value->field_bsic__desc.log_match(match_value.bsic__desc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_rep__prio__desc.match(match_value.rep__prio__desc(), legacy)){ TTCN_Logger::log_logmatch_info(".rep_prio_desc"); single_value->field_rep__prio__desc.log_match(match_value.rep__prio__desc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_meas__params__desc.match(match_value.meas__params__desc(), legacy)){ TTCN_Logger::log_logmatch_info(".meas_params_desc"); single_value->field_meas__params__desc.log_match(match_value.meas__params__desc(), 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("{ rt_diff_desc := "); single_value->field_rt__diff__desc.log_match(match_value.rt__diff__desc(), legacy); TTCN_Logger::log_event_str(", bsic_desc := "); single_value->field_bsic__desc.log_match(match_value.bsic__desc(), legacy); TTCN_Logger::log_event_str(", rep_prio_desc := "); single_value->field_rep__prio__desc.log_match(match_value.rep__prio__desc(), legacy); TTCN_Logger::log_event_str(", meas_params_desc := "); single_value->field_meas__params__desc.log_match(match_value.meas__params__desc(), 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 SI2quaterRestOctets_gprs_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (rt__diff__desc().is_bound()) rt__diff__desc().set_implicit_omit(); if (bsic__desc().is_bound()) bsic__desc().set_implicit_omit(); if (rep__prio__desc().is_bound()) rep__prio__desc().set_implicit_omit(); if (meas__params__desc().is_bound()) meas__params__desc().set_implicit_omit(); } void SI2quaterRestOctets_gprs_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_rt__diff__desc.encode_text(text_buf); single_value->field_bsic__desc.encode_text(text_buf); single_value->field_rep__prio__desc.encode_text(text_buf); single_value->field_meas__params__desc.encode_text(text_buf); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @GSM_RestOctets.SI2quaterRestOctets.gprs."); } } void SI2quaterRestOctets_gprs_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_rt__diff__desc.decode_text(text_buf); single_value->field_bsic__desc.decode_text(text_buf); single_value->field_rep__prio__desc.decode_text(text_buf); single_value->field_meas__params__desc.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 SI2quaterRestOctets_gprs_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @GSM_RestOctets.SI2quaterRestOctets.gprs."); } } void SI2quaterRestOctets_gprs_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: { SI2quaterRestOctets_gprs_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) rt__diff__desc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) bsic__desc().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) rep__prio__desc().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) meas__params__desc().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(), "rt_diff_desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rt__diff__desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "bsic_desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { bsic__desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "rep_prio_desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rep__prio__desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "meas_params_desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { meas__params__desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.SI2quaterRestOctets.gprs: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { SI2quaterRestOctets_gprs_template* precondition = new SI2quaterRestOctets_gprs_template; precondition->set_param(*param.get_elem(0)); SI2quaterRestOctets_gprs_template* implied_template = new SI2quaterRestOctets_gprs_template; implied_template->set_param(*param.get_elem(1)); *this = SI2quaterRestOctets_gprs_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.SI2quaterRestOctets.gprs"); } is_ifpresent = param.get_ifpresent(); } void SI2quaterRestOctets_gprs_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_rt__diff__desc.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI2quaterRestOctets.gprs"); single_value->field_bsic__desc.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI2quaterRestOctets.gprs"); single_value->field_rep__prio__desc.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI2quaterRestOctets.gprs"); single_value->field_meas__params__desc.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI2quaterRestOctets.gprs"); return; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@GSM_RestOctets.SI2quaterRestOctets.gprs"); } boolean SI2quaterRestOctets_gprs_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean SI2quaterRestOctets_gprs_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_params) : field_presence(par_presence), field_params(par_params) { } NCMeasParamsOpt::NCMeasParamsOpt(const NCMeasParamsOpt& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.NCMeasParamsOpt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.params().is_bound()) field_params = other_value.params(); else field_params.clean_up(); } void NCMeasParamsOpt::clean_up() { field_presence.clean_up(); field_params.clean_up(); } const TTCN_Typedescriptor_t* NCMeasParamsOpt::get_descriptor() const { return &NCMeasParamsOpt_descr_; } NCMeasParamsOpt& NCMeasParamsOpt::operator=(const NCMeasParamsOpt& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.NCMeasParamsOpt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.params().is_bound()) field_params = other_value.params(); else field_params.clean_up(); } return *this; } boolean NCMeasParamsOpt::operator==(const NCMeasParamsOpt& other_value) const { return field_presence==other_value.field_presence && field_params==other_value.field_params; } boolean NCMeasParamsOpt::is_bound() const { return (field_presence.is_bound()) || (OPTIONAL_OMIT == field_params.get_selection() || field_params.is_bound()); } boolean NCMeasParamsOpt::is_value() const { return field_presence.is_value() && (OPTIONAL_OMIT == field_params.get_selection() || field_params.is_value()); } int NCMeasParamsOpt::size_of() const { int ret_val = 1; if (field_params.ispresent()) ret_val++; return ret_val; } void NCMeasParamsOpt::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ presence := "); field_presence.log(); TTCN_Logger::log_event_str(", params := "); field_params.log(); TTCN_Logger::log_event_str(" }"); } void NCMeasParamsOpt::set_implicit_omit() { if (presence().is_bound()) presence().set_implicit_omit(); if (!params().is_bound()) params() = OMIT_VALUE; else params().set_implicit_omit(); } void NCMeasParamsOpt::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) presence().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) params().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(), "presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "params")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { params().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.NCMeasParamsOpt: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.NCMeasParamsOpt"); } } void NCMeasParamsOpt::encode_text(Text_Buf& text_buf) const { field_presence.encode_text(text_buf); field_params.encode_text(text_buf); } void NCMeasParamsOpt::decode_text(Text_Buf& text_buf) { field_presence.decode_text(text_buf); field_params.decode_text(text_buf); } void NCMeasParamsOpt::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name); if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); PER_encode(p_td, p_buf, opt); break; } default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void NCMeasParamsOpt::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name); if(!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); try { PER_decode(p_td, p_buf, opt); p_buf.PER_octet_align(FALSE); } catch (PER_Buffer_Exception) { } break; } default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int NCMeasParamsOpt::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, NCMeasParamsOpt_presence_descr_.raw->forceomit); decoded_field_length = field_presence.RAW_decode(NCMeasParamsOpt_presence_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); if (limit > 0 && field_presence == bs_0){ if (force_omit != NULL && (*force_omit)(1)) { field_params = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_1_force_omit(1, force_omit, NCMeasParamsOpt_params_descr_.raw->forceomit); decoded_field_length = field_params().RAW_decode(NCMeasParamsOpt_params_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 1) { field_params = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } else field_params=OMIT_VALUE; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int NCMeasParamsOpt::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, NCMeasParamsOpt_presence_descr_.raw); if (field_params.ispresent()) { myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, NCMeasParamsOpt_params_descr_.raw); } else myleaf.body.node.nodes[1] = NULL; encoded_length += field_presence.RAW_encode(NCMeasParamsOpt_presence_descr_, *myleaf.body.node.nodes[0]); if (field_params.ispresent()) { encoded_length += field_params().RAW_encode(NCMeasParamsOpt_params_descr_, *myleaf.body.node.nodes[1]); } if (field_params.ispresent() && (field_presence != bs_0)) { 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){ bs_0.RAW_encode(NCMeasParamsOpt_presence_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 NCMeasParamsOpt_template::single_value_struct { BITSTRING_template field_presence; NCMeasParams_template field_params; }; void NCMeasParamsOpt_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_presence = ANY_VALUE; single_value->field_params = ANY_OR_OMIT; } } } void NCMeasParamsOpt_template::copy_value(const NCMeasParamsOpt& other_value) { single_value = new single_value_struct; if (other_value.presence().is_bound()) { single_value->field_presence = other_value.presence(); } else { single_value->field_presence.clean_up(); } if (other_value.params().is_bound()) { if (other_value.params().ispresent()) single_value->field_params = other_value.params()(); else single_value->field_params = OMIT_VALUE; } else { single_value->field_params.clean_up(); } set_selection(SPECIFIC_VALUE); } void NCMeasParamsOpt_template::copy_template(const NCMeasParamsOpt_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.presence().get_selection()) { single_value->field_presence = other_value.presence(); } else { single_value->field_presence.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.params().get_selection()) { single_value->field_params = other_value.params(); } else { single_value->field_params.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 NCMeasParamsOpt_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 NCMeasParamsOpt_template(*other_value.implication_.precondition); implication_.implied_template = new NCMeasParamsOpt_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of type @GSM_RestOctets.NCMeasParamsOpt."); break; } set_selection(other_value); } NCMeasParamsOpt_template::NCMeasParamsOpt_template() { } NCMeasParamsOpt_template::NCMeasParamsOpt_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } NCMeasParamsOpt_template::NCMeasParamsOpt_template(const NCMeasParamsOpt& other_value) { copy_value(other_value); } NCMeasParamsOpt_template::NCMeasParamsOpt_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const NCMeasParamsOpt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.NCMeasParamsOpt from an unbound optional field."); } } NCMeasParamsOpt_template::NCMeasParamsOpt_template(NCMeasParamsOpt_template* p_precondition, NCMeasParamsOpt_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } NCMeasParamsOpt_template::NCMeasParamsOpt_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; } NCMeasParamsOpt_template::NCMeasParamsOpt_template(const NCMeasParamsOpt_template& other_value) : Base_Template() { copy_template(other_value); } NCMeasParamsOpt_template::~NCMeasParamsOpt_template() { clean_up(); } NCMeasParamsOpt_template& NCMeasParamsOpt_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } NCMeasParamsOpt_template& NCMeasParamsOpt_template::operator=(const NCMeasParamsOpt& other_value) { clean_up(); copy_value(other_value); return *this; } NCMeasParamsOpt_template& NCMeasParamsOpt_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const NCMeasParamsOpt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @GSM_RestOctets.NCMeasParamsOpt."); } return *this; } NCMeasParamsOpt_template& NCMeasParamsOpt_template::operator=(const NCMeasParamsOpt_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean NCMeasParamsOpt_template::match(const NCMeasParamsOpt& 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.presence().is_bound()) return FALSE; if(!single_value->field_presence.match(other_value.presence(), legacy))return FALSE; if(!other_value.params().is_bound()) return FALSE; if((other_value.params().ispresent() ? !single_value->field_params.match((const NCMeasParams&)other_value.params(), legacy) : !single_value->field_params.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 @GSM_RestOctets.NCMeasParamsOpt."); } return FALSE; } boolean NCMeasParamsOpt_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_presence.is_bound() || (single_value->field_params.is_omit() || single_value->field_params.is_bound()); } boolean NCMeasParamsOpt_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_presence.is_value() && (single_value->field_params.is_omit() || single_value->field_params.is_value()); } void NCMeasParamsOpt_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; } NCMeasParamsOpt NCMeasParamsOpt_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @GSM_RestOctets.NCMeasParamsOpt."); NCMeasParamsOpt ret_val; if (single_value->field_presence.is_bound()) { ret_val.presence() = single_value->field_presence.valueof(); } if (single_value->field_params.is_omit()) ret_val.params() = OMIT_VALUE; else if (single_value->field_params.is_bound()) { ret_val.params() = single_value->field_params.valueof(); } return ret_val; } void NCMeasParamsOpt_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list for a template of type @GSM_RestOctets.NCMeasParamsOpt."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new NCMeasParamsOpt_template[list_length]; } NCMeasParamsOpt_template& NCMeasParamsOpt_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element of a non-list template of type @GSM_RestOctets.NCMeasParamsOpt."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.NCMeasParamsOpt."); return value_list.list_value[list_index]; } BITSTRING_template& NCMeasParamsOpt_template::presence() { set_specific(); return single_value->field_presence; } const BITSTRING_template& NCMeasParamsOpt_template::presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field presence of a non-specific template of type @GSM_RestOctets.NCMeasParamsOpt."); return single_value->field_presence; } NCMeasParams_template& NCMeasParamsOpt_template::params() { set_specific(); return single_value->field_params; } const NCMeasParams_template& NCMeasParamsOpt_template::params() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field params of a non-specific template of type @GSM_RestOctets.NCMeasParamsOpt."); return single_value->field_params; } int NCMeasParamsOpt_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.NCMeasParamsOpt which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 1; if (single_value->field_params.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 @GSM_RestOctets.NCMeasParamsOpt containing an empty list."); int item_size = value_list.list_value[0].size_of(); for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++) { if (value_list.list_value[l_idx].size_of()!=item_size) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.NCMeasParamsOpt containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.NCMeasParamsOpt containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.NCMeasParamsOpt containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.NCMeasParamsOpt containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.NCMeasParamsOpt containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.NCMeasParamsOpt containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.NCMeasParamsOpt containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.NCMeasParamsOpt."); } return 0; } void NCMeasParamsOpt_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ presence := "); single_value->field_presence.log(); TTCN_Logger::log_event_str(", params := "); single_value->field_params.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 NCMeasParamsOpt_template::log_match(const NCMeasParamsOpt& 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_presence.match(match_value.presence(), legacy)){ TTCN_Logger::log_logmatch_info(".presence"); single_value->field_presence.log_match(match_value.presence(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.params().ispresent()){ if(!single_value->field_params.match(match_value.params(), legacy)){ TTCN_Logger::log_logmatch_info(".params"); single_value->field_params.log_match(match_value.params(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_params.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".params := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_params.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("{ presence := "); single_value->field_presence.log_match(match_value.presence(), legacy); TTCN_Logger::log_event_str(", params := "); if (match_value.params().ispresent()) { single_value->field_params.log_match(match_value.params(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_params.log(); if (single_value->field_params.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 NCMeasParamsOpt_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (presence().is_bound()) presence().set_implicit_omit(); if (!params().is_bound()) params() = OMIT_VALUE; else params().set_implicit_omit(); } void NCMeasParamsOpt_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_presence.encode_text(text_buf); single_value->field_params.encode_text(text_buf); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @GSM_RestOctets.NCMeasParamsOpt."); } } void NCMeasParamsOpt_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_presence.decode_text(text_buf); single_value->field_params.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 NCMeasParamsOpt_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @GSM_RestOctets.NCMeasParamsOpt."); } } void NCMeasParamsOpt_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: { NCMeasParamsOpt_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) presence().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) params().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(), "presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "params")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { params().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.NCMeasParamsOpt: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { NCMeasParamsOpt_template* precondition = new NCMeasParamsOpt_template; precondition->set_param(*param.get_elem(0)); NCMeasParamsOpt_template* implied_template = new NCMeasParamsOpt_template; implied_template->set_param(*param.get_elem(1)); *this = NCMeasParamsOpt_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.NCMeasParamsOpt"); } is_ifpresent = param.get_ifpresent(); } void NCMeasParamsOpt_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_presence.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.NCMeasParamsOpt"); single_value->field_params.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.NCMeasParamsOpt"); return; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@GSM_RestOctets.NCMeasParamsOpt"); } boolean NCMeasParamsOpt_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean NCMeasParamsOpt_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_p) : field_nco(par_nco), field_p__presence(par_p__presence), field_p(par_p) { } NCMeasParams::NCMeasParams(const NCMeasParams& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.NCMeasParams."); if (other_value.nco().is_bound()) field_nco = other_value.nco(); else field_nco.clean_up(); if (other_value.p__presence().is_bound()) field_p__presence = other_value.p__presence(); else field_p__presence.clean_up(); if (other_value.p().is_bound()) field_p = other_value.p(); else field_p.clean_up(); } void NCMeasParams::clean_up() { field_nco.clean_up(); field_p__presence.clean_up(); field_p.clean_up(); } const TTCN_Typedescriptor_t* NCMeasParams::get_descriptor() const { return &NCMeasParams_descr_; } NCMeasParams& NCMeasParams::operator=(const NCMeasParams& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.NCMeasParams."); if (other_value.nco().is_bound()) field_nco = other_value.nco(); else field_nco.clean_up(); if (other_value.p__presence().is_bound()) field_p__presence = other_value.p__presence(); else field_p__presence.clean_up(); if (other_value.p().is_bound()) field_p = other_value.p(); else field_p.clean_up(); } return *this; } boolean NCMeasParams::operator==(const NCMeasParams& other_value) const { return field_nco==other_value.field_nco && field_p__presence==other_value.field_p__presence && field_p==other_value.field_p; } boolean NCMeasParams::is_bound() const { return (field_nco.is_bound()) || (field_p__presence.is_bound()) || (OPTIONAL_OMIT == field_p.get_selection() || field_p.is_bound()); } boolean NCMeasParams::is_value() const { return field_nco.is_value() && field_p__presence.is_value() && (OPTIONAL_OMIT == field_p.get_selection() || field_p.is_value()); } int NCMeasParams::size_of() const { int ret_val = 2; if (field_p.ispresent()) ret_val++; return ret_val; } void NCMeasParams::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ nco := "); field_nco.log(); TTCN_Logger::log_event_str(", p_presence := "); field_p__presence.log(); TTCN_Logger::log_event_str(", p := "); field_p.log(); TTCN_Logger::log_event_str(" }"); } void NCMeasParams::set_implicit_omit() { if (nco().is_bound()) nco().set_implicit_omit(); if (p__presence().is_bound()) p__presence().set_implicit_omit(); if (!p().is_bound()) p() = OMIT_VALUE; else p().set_implicit_omit(); } void NCMeasParams::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) nco().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) p__presence().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) p().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(), "nco")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nco().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "p_presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { p__presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "p")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { p().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.NCMeasParams: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.NCMeasParams"); } } void NCMeasParams::encode_text(Text_Buf& text_buf) const { field_nco.encode_text(text_buf); field_p__presence.encode_text(text_buf); field_p.encode_text(text_buf); } void NCMeasParams::decode_text(Text_Buf& text_buf) { field_nco.decode_text(text_buf); field_p__presence.decode_text(text_buf); field_p.decode_text(text_buf); } void NCMeasParams::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name); if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); PER_encode(p_td, p_buf, opt); break; } default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void NCMeasParams::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name); if(!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); try { PER_decode(p_td, p_buf, opt); p_buf.PER_octet_align(FALSE); } catch (PER_Buffer_Exception) { } break; } default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int NCMeasParams::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, NCMeasParams_nco_descr_.raw->forceomit); decoded_field_length = field_nco.RAW_decode(NCMeasParams_nco_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, NCMeasParams_p__presence_descr_.raw->forceomit); decoded_field_length = field_p__presence.RAW_decode(NCMeasParams_p__presence_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); if (limit > 0 && field_p__presence == bs_0){ if (force_omit != NULL && (*force_omit)(2)) { field_p = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_2_force_omit(2, force_omit, NCMeasParams_p_descr_.raw->forceomit); decoded_field_length = field_p().RAW_decode(NCMeasParams_p_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_2_force_omit); if (decoded_field_length < 1) { field_p = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } else field_p=OMIT_VALUE; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int NCMeasParams::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, NCMeasParams_nco_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, NCMeasParams_p__presence_descr_.raw); if (field_p.ispresent()) { myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, NCMeasParams_p_descr_.raw); } else myleaf.body.node.nodes[2] = NULL; encoded_length += field_nco.RAW_encode(NCMeasParams_nco_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_p__presence.RAW_encode(NCMeasParams_p__presence_descr_, *myleaf.body.node.nodes[1]); if (field_p.ispresent()) { encoded_length += field_p().RAW_encode(NCMeasParams_p_descr_, *myleaf.body.node.nodes[2]); } if (field_p.ispresent() && (field_p__presence != bs_0)) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={1}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ bs_0.RAW_encode(NCMeasParams_p__presence_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 NCMeasParams_template::single_value_struct { BITSTRING_template field_nco; BITSTRING_template field_p__presence; NCMeasPeriods_template field_p; }; void NCMeasParams_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_nco = ANY_VALUE; single_value->field_p__presence = ANY_VALUE; single_value->field_p = ANY_OR_OMIT; } } } void NCMeasParams_template::copy_value(const NCMeasParams& other_value) { single_value = new single_value_struct; if (other_value.nco().is_bound()) { single_value->field_nco = other_value.nco(); } else { single_value->field_nco.clean_up(); } if (other_value.p__presence().is_bound()) { single_value->field_p__presence = other_value.p__presence(); } else { single_value->field_p__presence.clean_up(); } if (other_value.p().is_bound()) { if (other_value.p().ispresent()) single_value->field_p = other_value.p()(); else single_value->field_p = OMIT_VALUE; } else { single_value->field_p.clean_up(); } set_selection(SPECIFIC_VALUE); } void NCMeasParams_template::copy_template(const NCMeasParams_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.nco().get_selection()) { single_value->field_nco = other_value.nco(); } else { single_value->field_nco.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.p__presence().get_selection()) { single_value->field_p__presence = other_value.p__presence(); } else { single_value->field_p__presence.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.p().get_selection()) { single_value->field_p = other_value.p(); } else { single_value->field_p.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 NCMeasParams_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 NCMeasParams_template(*other_value.implication_.precondition); implication_.implied_template = new NCMeasParams_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of type @GSM_RestOctets.NCMeasParams."); break; } set_selection(other_value); } NCMeasParams_template::NCMeasParams_template() { } NCMeasParams_template::NCMeasParams_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } NCMeasParams_template::NCMeasParams_template(const NCMeasParams& other_value) { copy_value(other_value); } NCMeasParams_template::NCMeasParams_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const NCMeasParams&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.NCMeasParams from an unbound optional field."); } } NCMeasParams_template::NCMeasParams_template(NCMeasParams_template* p_precondition, NCMeasParams_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } NCMeasParams_template::NCMeasParams_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; } NCMeasParams_template::NCMeasParams_template(const NCMeasParams_template& other_value) : Base_Template() { copy_template(other_value); } NCMeasParams_template::~NCMeasParams_template() { clean_up(); } NCMeasParams_template& NCMeasParams_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } NCMeasParams_template& NCMeasParams_template::operator=(const NCMeasParams& other_value) { clean_up(); copy_value(other_value); return *this; } NCMeasParams_template& NCMeasParams_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const NCMeasParams&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @GSM_RestOctets.NCMeasParams."); } return *this; } NCMeasParams_template& NCMeasParams_template::operator=(const NCMeasParams_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean NCMeasParams_template::match(const NCMeasParams& 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.nco().is_bound()) return FALSE; if(!single_value->field_nco.match(other_value.nco(), legacy))return FALSE; if(!other_value.p__presence().is_bound()) return FALSE; if(!single_value->field_p__presence.match(other_value.p__presence(), legacy))return FALSE; if(!other_value.p().is_bound()) return FALSE; if((other_value.p().ispresent() ? !single_value->field_p.match((const NCMeasPeriods&)other_value.p(), legacy) : !single_value->field_p.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 @GSM_RestOctets.NCMeasParams."); } return FALSE; } boolean NCMeasParams_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_nco.is_bound() || single_value->field_p__presence.is_bound() || (single_value->field_p.is_omit() || single_value->field_p.is_bound()); } boolean NCMeasParams_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_nco.is_value() && single_value->field_p__presence.is_value() && (single_value->field_p.is_omit() || single_value->field_p.is_value()); } void NCMeasParams_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; } NCMeasParams NCMeasParams_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @GSM_RestOctets.NCMeasParams."); NCMeasParams ret_val; if (single_value->field_nco.is_bound()) { ret_val.nco() = single_value->field_nco.valueof(); } if (single_value->field_p__presence.is_bound()) { ret_val.p__presence() = single_value->field_p__presence.valueof(); } if (single_value->field_p.is_omit()) ret_val.p() = OMIT_VALUE; else if (single_value->field_p.is_bound()) { ret_val.p() = single_value->field_p.valueof(); } return ret_val; } void NCMeasParams_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list for a template of type @GSM_RestOctets.NCMeasParams."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new NCMeasParams_template[list_length]; } NCMeasParams_template& NCMeasParams_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element of a non-list template of type @GSM_RestOctets.NCMeasParams."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.NCMeasParams."); return value_list.list_value[list_index]; } BITSTRING_template& NCMeasParams_template::nco() { set_specific(); return single_value->field_nco; } const BITSTRING_template& NCMeasParams_template::nco() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nco of a non-specific template of type @GSM_RestOctets.NCMeasParams."); return single_value->field_nco; } BITSTRING_template& NCMeasParams_template::p__presence() { set_specific(); return single_value->field_p__presence; } const BITSTRING_template& NCMeasParams_template::p__presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field p_presence of a non-specific template of type @GSM_RestOctets.NCMeasParams."); return single_value->field_p__presence; } NCMeasPeriods_template& NCMeasParams_template::p() { set_specific(); return single_value->field_p; } const NCMeasPeriods_template& NCMeasParams_template::p() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field p of a non-specific template of type @GSM_RestOctets.NCMeasParams."); return single_value->field_p; } int NCMeasParams_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.NCMeasParams which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 2; if (single_value->field_p.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 @GSM_RestOctets.NCMeasParams containing an empty list."); int item_size = value_list.list_value[0].size_of(); for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++) { if (value_list.list_value[l_idx].size_of()!=item_size) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.NCMeasParams containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.NCMeasParams containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.NCMeasParams containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.NCMeasParams containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.NCMeasParams containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.NCMeasParams containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.NCMeasParams containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.NCMeasParams."); } return 0; } void NCMeasParams_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ nco := "); single_value->field_nco.log(); TTCN_Logger::log_event_str(", p_presence := "); single_value->field_p__presence.log(); TTCN_Logger::log_event_str(", p := "); single_value->field_p.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 NCMeasParams_template::log_match(const NCMeasParams& 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_nco.match(match_value.nco(), legacy)){ TTCN_Logger::log_logmatch_info(".nco"); single_value->field_nco.log_match(match_value.nco(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_p__presence.match(match_value.p__presence(), legacy)){ TTCN_Logger::log_logmatch_info(".p_presence"); single_value->field_p__presence.log_match(match_value.p__presence(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.p().ispresent()){ if(!single_value->field_p.match(match_value.p(), legacy)){ TTCN_Logger::log_logmatch_info(".p"); single_value->field_p.log_match(match_value.p(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_p.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".p := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_p.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("{ nco := "); single_value->field_nco.log_match(match_value.nco(), legacy); TTCN_Logger::log_event_str(", p_presence := "); single_value->field_p__presence.log_match(match_value.p__presence(), legacy); TTCN_Logger::log_event_str(", p := "); if (match_value.p().ispresent()) { single_value->field_p.log_match(match_value.p(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_p.log(); if (single_value->field_p.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 NCMeasParams_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (nco().is_bound()) nco().set_implicit_omit(); if (p__presence().is_bound()) p__presence().set_implicit_omit(); if (!p().is_bound()) p() = OMIT_VALUE; else p().set_implicit_omit(); } void NCMeasParams_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_nco.encode_text(text_buf); single_value->field_p__presence.encode_text(text_buf); single_value->field_p.encode_text(text_buf); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @GSM_RestOctets.NCMeasParams."); } } void NCMeasParams_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_nco.decode_text(text_buf); single_value->field_p__presence.decode_text(text_buf); single_value->field_p.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 NCMeasParams_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @GSM_RestOctets.NCMeasParams."); } } void NCMeasParams_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: { NCMeasParams_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) nco().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) p__presence().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) p().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(), "nco")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nco().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "p_presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { p__presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "p")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { p().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.NCMeasParams: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { NCMeasParams_template* precondition = new NCMeasParams_template; precondition->set_param(*param.get_elem(0)); NCMeasParams_template* implied_template = new NCMeasParams_template; implied_template->set_param(*param.get_elem(1)); *this = NCMeasParams_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.NCMeasParams"); } is_ifpresent = param.get_ifpresent(); } void NCMeasParams_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_nco.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.NCMeasParams"); single_value->field_p__presence.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.NCMeasParams"); single_value->field_p.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.NCMeasParams"); return; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@GSM_RestOctets.NCMeasParams"); } boolean NCMeasParams_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean NCMeasParams_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) non__drx__period().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) rep__period__i().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) rep__period__t().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(), "non_drx_period")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { non__drx__period().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "rep_period_i")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rep__period__i().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "rep_period_t")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rep__period__t().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.NCMeasPeriods: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.NCMeasPeriods"); } } void NCMeasPeriods::encode_text(Text_Buf& text_buf) const { field_non__drx__period.encode_text(text_buf); field_rep__period__i.encode_text(text_buf); field_rep__period__t.encode_text(text_buf); } void NCMeasPeriods::decode_text(Text_Buf& text_buf) { field_non__drx__period.decode_text(text_buf); field_rep__period__i.decode_text(text_buf); field_rep__period__t.decode_text(text_buf); } void NCMeasPeriods::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name); if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); PER_encode(p_td, p_buf, opt); break; } default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void NCMeasPeriods::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name); if(!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); try { PER_decode(p_td, p_buf, opt); p_buf.PER_octet_align(FALSE); } catch (PER_Buffer_Exception) { } break; } default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int NCMeasPeriods::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, NCMeasPeriods_non__drx__period_descr_.raw->forceomit); decoded_field_length = field_non__drx__period.RAW_decode(NCMeasPeriods_non__drx__period_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, NCMeasPeriods_rep__period__i_descr_.raw->forceomit); decoded_field_length = field_rep__period__i.RAW_decode(NCMeasPeriods_rep__period__i_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, NCMeasPeriods_rep__period__t_descr_.raw->forceomit); decoded_field_length = field_rep__period__t.RAW_decode(NCMeasPeriods_rep__period__t_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_2_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int NCMeasPeriods::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, NCMeasPeriods_non__drx__period_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, NCMeasPeriods_rep__period__i_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, NCMeasPeriods_rep__period__t_descr_.raw); encoded_length += field_non__drx__period.RAW_encode(NCMeasPeriods_non__drx__period_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_rep__period__i.RAW_encode(NCMeasPeriods_rep__period__i_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_rep__period__t.RAW_encode(NCMeasPeriods_rep__period__t_descr_, *myleaf.body.node.nodes[2]); return myleaf.length = encoded_length; } struct NCMeasPeriods_template::single_value_struct { BITSTRING_template field_non__drx__period; BITSTRING_template field_rep__period__i; BITSTRING_template field_rep__period__t; }; void NCMeasPeriods_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_non__drx__period = ANY_VALUE; single_value->field_rep__period__i = ANY_VALUE; single_value->field_rep__period__t = ANY_VALUE; } } } void NCMeasPeriods_template::copy_value(const NCMeasPeriods& other_value) { single_value = new single_value_struct; if (other_value.non__drx__period().is_bound()) { single_value->field_non__drx__period = other_value.non__drx__period(); } else { single_value->field_non__drx__period.clean_up(); } if (other_value.rep__period__i().is_bound()) { single_value->field_rep__period__i = other_value.rep__period__i(); } else { single_value->field_rep__period__i.clean_up(); } if (other_value.rep__period__t().is_bound()) { single_value->field_rep__period__t = other_value.rep__period__t(); } else { single_value->field_rep__period__t.clean_up(); } set_selection(SPECIFIC_VALUE); } void NCMeasPeriods_template::copy_template(const NCMeasPeriods_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.non__drx__period().get_selection()) { single_value->field_non__drx__period = other_value.non__drx__period(); } else { single_value->field_non__drx__period.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.rep__period__i().get_selection()) { single_value->field_rep__period__i = other_value.rep__period__i(); } else { single_value->field_rep__period__i.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.rep__period__t().get_selection()) { single_value->field_rep__period__t = other_value.rep__period__t(); } else { single_value->field_rep__period__t.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 NCMeasPeriods_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 NCMeasPeriods_template(*other_value.implication_.precondition); implication_.implied_template = new NCMeasPeriods_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of type @GSM_RestOctets.NCMeasPeriods."); break; } set_selection(other_value); } NCMeasPeriods_template::NCMeasPeriods_template() { } NCMeasPeriods_template::NCMeasPeriods_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } NCMeasPeriods_template::NCMeasPeriods_template(const NCMeasPeriods& other_value) { copy_value(other_value); } NCMeasPeriods_template::NCMeasPeriods_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const NCMeasPeriods&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.NCMeasPeriods from an unbound optional field."); } } NCMeasPeriods_template::NCMeasPeriods_template(NCMeasPeriods_template* p_precondition, NCMeasPeriods_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } NCMeasPeriods_template::NCMeasPeriods_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; } NCMeasPeriods_template::NCMeasPeriods_template(const NCMeasPeriods_template& other_value) : Base_Template() { copy_template(other_value); } NCMeasPeriods_template::~NCMeasPeriods_template() { clean_up(); } NCMeasPeriods_template& NCMeasPeriods_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } NCMeasPeriods_template& NCMeasPeriods_template::operator=(const NCMeasPeriods& other_value) { clean_up(); copy_value(other_value); return *this; } NCMeasPeriods_template& NCMeasPeriods_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const NCMeasPeriods&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @GSM_RestOctets.NCMeasPeriods."); } return *this; } NCMeasPeriods_template& NCMeasPeriods_template::operator=(const NCMeasPeriods_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean NCMeasPeriods_template::match(const NCMeasPeriods& 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.non__drx__period().is_bound()) return FALSE; if(!single_value->field_non__drx__period.match(other_value.non__drx__period(), legacy))return FALSE; if(!other_value.rep__period__i().is_bound()) return FALSE; if(!single_value->field_rep__period__i.match(other_value.rep__period__i(), legacy))return FALSE; if(!other_value.rep__period__t().is_bound()) return FALSE; if(!single_value->field_rep__period__t.match(other_value.rep__period__t(), legacy))return FALSE; return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of type @GSM_RestOctets.NCMeasPeriods."); } return FALSE; } boolean NCMeasPeriods_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_non__drx__period.is_bound() || single_value->field_rep__period__i.is_bound() || single_value->field_rep__period__t.is_bound(); } boolean NCMeasPeriods_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_non__drx__period.is_value() && single_value->field_rep__period__i.is_value() && single_value->field_rep__period__t.is_value(); } void NCMeasPeriods_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; } NCMeasPeriods NCMeasPeriods_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @GSM_RestOctets.NCMeasPeriods."); NCMeasPeriods ret_val; if (single_value->field_non__drx__period.is_bound()) { ret_val.non__drx__period() = single_value->field_non__drx__period.valueof(); } if (single_value->field_rep__period__i.is_bound()) { ret_val.rep__period__i() = single_value->field_rep__period__i.valueof(); } if (single_value->field_rep__period__t.is_bound()) { ret_val.rep__period__t() = single_value->field_rep__period__t.valueof(); } return ret_val; } void NCMeasPeriods_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list for a template of type @GSM_RestOctets.NCMeasPeriods."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new NCMeasPeriods_template[list_length]; } NCMeasPeriods_template& NCMeasPeriods_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element of a non-list template of type @GSM_RestOctets.NCMeasPeriods."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.NCMeasPeriods."); return value_list.list_value[list_index]; } BITSTRING_template& NCMeasPeriods_template::non__drx__period() { set_specific(); return single_value->field_non__drx__period; } const BITSTRING_template& NCMeasPeriods_template::non__drx__period() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field non_drx_period of a non-specific template of type @GSM_RestOctets.NCMeasPeriods."); return single_value->field_non__drx__period; } BITSTRING_template& NCMeasPeriods_template::rep__period__i() { set_specific(); return single_value->field_rep__period__i; } const BITSTRING_template& NCMeasPeriods_template::rep__period__i() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field rep_period_i of a non-specific template of type @GSM_RestOctets.NCMeasPeriods."); return single_value->field_rep__period__i; } BITSTRING_template& NCMeasPeriods_template::rep__period__t() { set_specific(); return single_value->field_rep__period__t; } const BITSTRING_template& NCMeasPeriods_template::rep__period__t() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field rep_period_t of a non-specific template of type @GSM_RestOctets.NCMeasPeriods."); return single_value->field_rep__period__t; } int NCMeasPeriods_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.NCMeasPeriods 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 @GSM_RestOctets.NCMeasPeriods containing an empty list."); int item_size = value_list.list_value[0].size_of(); for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++) { if (value_list.list_value[l_idx].size_of()!=item_size) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.NCMeasPeriods containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.NCMeasPeriods containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.NCMeasPeriods containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.NCMeasPeriods containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.NCMeasPeriods containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.NCMeasPeriods containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.NCMeasPeriods containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.NCMeasPeriods."); } return 0; } void NCMeasPeriods_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ non_drx_period := "); single_value->field_non__drx__period.log(); TTCN_Logger::log_event_str(", rep_period_i := "); single_value->field_rep__period__i.log(); TTCN_Logger::log_event_str(", rep_period_t := "); single_value->field_rep__period__t.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 NCMeasPeriods_template::log_match(const NCMeasPeriods& 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_non__drx__period.match(match_value.non__drx__period(), legacy)){ TTCN_Logger::log_logmatch_info(".non_drx_period"); single_value->field_non__drx__period.log_match(match_value.non__drx__period(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_rep__period__i.match(match_value.rep__period__i(), legacy)){ TTCN_Logger::log_logmatch_info(".rep_period_i"); single_value->field_rep__period__i.log_match(match_value.rep__period__i(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_rep__period__t.match(match_value.rep__period__t(), legacy)){ TTCN_Logger::log_logmatch_info(".rep_period_t"); single_value->field_rep__period__t.log_match(match_value.rep__period__t(), 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("{ non_drx_period := "); single_value->field_non__drx__period.log_match(match_value.non__drx__period(), legacy); TTCN_Logger::log_event_str(", rep_period_i := "); single_value->field_rep__period__i.log_match(match_value.rep__period__i(), legacy); TTCN_Logger::log_event_str(", rep_period_t := "); single_value->field_rep__period__t.log_match(match_value.rep__period__t(), 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 NCMeasPeriods_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (non__drx__period().is_bound()) non__drx__period().set_implicit_omit(); if (rep__period__i().is_bound()) rep__period__i().set_implicit_omit(); if (rep__period__t().is_bound()) rep__period__t().set_implicit_omit(); } void NCMeasPeriods_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_non__drx__period.encode_text(text_buf); single_value->field_rep__period__i.encode_text(text_buf); single_value->field_rep__period__t.encode_text(text_buf); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @GSM_RestOctets.NCMeasPeriods."); } } void NCMeasPeriods_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_non__drx__period.decode_text(text_buf); single_value->field_rep__period__i.decode_text(text_buf); single_value->field_rep__period__t.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 NCMeasPeriods_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @GSM_RestOctets.NCMeasPeriods."); } } void NCMeasPeriods_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: { NCMeasPeriods_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) non__drx__period().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) rep__period__i().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) rep__period__t().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(), "non_drx_period")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { non__drx__period().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "rep_period_i")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rep__period__i().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "rep_period_t")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rep__period__t().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.NCMeasPeriods: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { NCMeasPeriods_template* precondition = new NCMeasPeriods_template; precondition->set_param(*param.get_elem(0)); NCMeasPeriods_template* implied_template = new NCMeasPeriods_template; implied_template->set_param(*param.get_elem(1)); *this = NCMeasPeriods_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.NCMeasPeriods"); } is_ifpresent = param.get_ifpresent(); } void NCMeasPeriods_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_non__drx__period.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.NCMeasPeriods"); single_value->field_rep__period__i.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.NCMeasPeriods"); single_value->field_rep__period__t.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.NCMeasPeriods"); return; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@GSM_RestOctets.NCMeasPeriods"); } boolean NCMeasPeriods_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean NCMeasPeriods_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_info) : field_presence(par_presence), field_info(par_info) { } SI2quaterExtInfoOpt::SI2quaterExtInfoOpt(const SI2quaterExtInfoOpt& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.SI2quaterExtInfoOpt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.info().is_bound()) field_info = other_value.info(); else field_info.clean_up(); } void SI2quaterExtInfoOpt::clean_up() { field_presence.clean_up(); field_info.clean_up(); } const TTCN_Typedescriptor_t* SI2quaterExtInfoOpt::get_descriptor() const { return &SI2quaterExtInfoOpt_descr_; } SI2quaterExtInfoOpt& SI2quaterExtInfoOpt::operator=(const SI2quaterExtInfoOpt& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.SI2quaterExtInfoOpt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.info().is_bound()) field_info = other_value.info(); else field_info.clean_up(); } return *this; } boolean SI2quaterExtInfoOpt::operator==(const SI2quaterExtInfoOpt& other_value) const { return field_presence==other_value.field_presence && field_info==other_value.field_info; } boolean SI2quaterExtInfoOpt::is_bound() const { return (field_presence.is_bound()) || (OPTIONAL_OMIT == field_info.get_selection() || field_info.is_bound()); } boolean SI2quaterExtInfoOpt::is_value() const { return field_presence.is_value() && (OPTIONAL_OMIT == field_info.get_selection() || field_info.is_value()); } int SI2quaterExtInfoOpt::size_of() const { int ret_val = 1; if (field_info.ispresent()) ret_val++; return ret_val; } void SI2quaterExtInfoOpt::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ presence := "); field_presence.log(); TTCN_Logger::log_event_str(", info := "); field_info.log(); TTCN_Logger::log_event_str(" }"); } void SI2quaterExtInfoOpt::set_implicit_omit() { if (presence().is_bound()) presence().set_implicit_omit(); if (!info().is_bound()) info() = OMIT_VALUE; else info().set_implicit_omit(); } void SI2quaterExtInfoOpt::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) presence().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) info().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(), "presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "info")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { info().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.SI2quaterExtInfoOpt: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.SI2quaterExtInfoOpt"); } } void SI2quaterExtInfoOpt::encode_text(Text_Buf& text_buf) const { field_presence.encode_text(text_buf); field_info.encode_text(text_buf); } void SI2quaterExtInfoOpt::decode_text(Text_Buf& text_buf) { field_presence.decode_text(text_buf); field_info.decode_text(text_buf); } void SI2quaterExtInfoOpt::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name); if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); PER_encode(p_td, p_buf, opt); break; } default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void SI2quaterExtInfoOpt::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name); if(!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); try { PER_decode(p_td, p_buf, opt); p_buf.PER_octet_align(FALSE); } catch (PER_Buffer_Exception) { } break; } default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int SI2quaterExtInfoOpt::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, SI2quaterExtInfoOpt_presence_descr_.raw->forceomit); decoded_field_length = field_presence.RAW_decode(SI2quaterExtInfoOpt_presence_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); if (limit > 0 && field_presence == bs_0){ if (force_omit != NULL && (*force_omit)(1)) { field_info = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_1_force_omit(1, force_omit, SI2quaterExtInfoOpt_info_descr_.raw->forceomit); decoded_field_length = field_info().RAW_decode(SI2quaterExtInfoOpt_info_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 1) { field_info = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } else field_info=OMIT_VALUE; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int SI2quaterExtInfoOpt::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, SI2quaterExtInfoOpt_presence_descr_.raw); if (field_info.ispresent()) { myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, SI2quaterExtInfoOpt_info_descr_.raw); } else myleaf.body.node.nodes[1] = NULL; encoded_length += field_presence.RAW_encode(SI2quaterExtInfoOpt_presence_descr_, *myleaf.body.node.nodes[0]); if (field_info.ispresent()) { encoded_length += field_info().RAW_encode(SI2quaterExtInfoOpt_info_descr_, *myleaf.body.node.nodes[1]); } if (field_info.ispresent() && (field_presence != bs_0)) { 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){ bs_0.RAW_encode(SI2quaterExtInfoOpt_presence_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 SI2quaterExtInfoOpt_template::single_value_struct { BITSTRING_template field_presence; SI2quaterExtInfo_template field_info; }; void SI2quaterExtInfoOpt_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_presence = ANY_VALUE; single_value->field_info = ANY_OR_OMIT; } } } void SI2quaterExtInfoOpt_template::copy_value(const SI2quaterExtInfoOpt& other_value) { single_value = new single_value_struct; if (other_value.presence().is_bound()) { single_value->field_presence = other_value.presence(); } else { single_value->field_presence.clean_up(); } if (other_value.info().is_bound()) { if (other_value.info().ispresent()) single_value->field_info = other_value.info()(); else single_value->field_info = OMIT_VALUE; } else { single_value->field_info.clean_up(); } set_selection(SPECIFIC_VALUE); } void SI2quaterExtInfoOpt_template::copy_template(const SI2quaterExtInfoOpt_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.presence().get_selection()) { single_value->field_presence = other_value.presence(); } else { single_value->field_presence.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.info().get_selection()) { single_value->field_info = other_value.info(); } else { single_value->field_info.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 SI2quaterExtInfoOpt_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 SI2quaterExtInfoOpt_template(*other_value.implication_.precondition); implication_.implied_template = new SI2quaterExtInfoOpt_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of type @GSM_RestOctets.SI2quaterExtInfoOpt."); break; } set_selection(other_value); } SI2quaterExtInfoOpt_template::SI2quaterExtInfoOpt_template() { } SI2quaterExtInfoOpt_template::SI2quaterExtInfoOpt_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } SI2quaterExtInfoOpt_template::SI2quaterExtInfoOpt_template(const SI2quaterExtInfoOpt& other_value) { copy_value(other_value); } SI2quaterExtInfoOpt_template::SI2quaterExtInfoOpt_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI2quaterExtInfoOpt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.SI2quaterExtInfoOpt from an unbound optional field."); } } SI2quaterExtInfoOpt_template::SI2quaterExtInfoOpt_template(SI2quaterExtInfoOpt_template* p_precondition, SI2quaterExtInfoOpt_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } SI2quaterExtInfoOpt_template::SI2quaterExtInfoOpt_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; } SI2quaterExtInfoOpt_template::SI2quaterExtInfoOpt_template(const SI2quaterExtInfoOpt_template& other_value) : Base_Template() { copy_template(other_value); } SI2quaterExtInfoOpt_template::~SI2quaterExtInfoOpt_template() { clean_up(); } SI2quaterExtInfoOpt_template& SI2quaterExtInfoOpt_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } SI2quaterExtInfoOpt_template& SI2quaterExtInfoOpt_template::operator=(const SI2quaterExtInfoOpt& other_value) { clean_up(); copy_value(other_value); return *this; } SI2quaterExtInfoOpt_template& SI2quaterExtInfoOpt_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI2quaterExtInfoOpt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @GSM_RestOctets.SI2quaterExtInfoOpt."); } return *this; } SI2quaterExtInfoOpt_template& SI2quaterExtInfoOpt_template::operator=(const SI2quaterExtInfoOpt_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean SI2quaterExtInfoOpt_template::match(const SI2quaterExtInfoOpt& 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.presence().is_bound()) return FALSE; if(!single_value->field_presence.match(other_value.presence(), legacy))return FALSE; if(!other_value.info().is_bound()) return FALSE; if((other_value.info().ispresent() ? !single_value->field_info.match((const SI2quaterExtInfo&)other_value.info(), legacy) : !single_value->field_info.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 @GSM_RestOctets.SI2quaterExtInfoOpt."); } return FALSE; } boolean SI2quaterExtInfoOpt_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_presence.is_bound() || (single_value->field_info.is_omit() || single_value->field_info.is_bound()); } boolean SI2quaterExtInfoOpt_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_presence.is_value() && (single_value->field_info.is_omit() || single_value->field_info.is_value()); } void SI2quaterExtInfoOpt_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; } SI2quaterExtInfoOpt SI2quaterExtInfoOpt_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @GSM_RestOctets.SI2quaterExtInfoOpt."); SI2quaterExtInfoOpt ret_val; if (single_value->field_presence.is_bound()) { ret_val.presence() = single_value->field_presence.valueof(); } if (single_value->field_info.is_omit()) ret_val.info() = OMIT_VALUE; else if (single_value->field_info.is_bound()) { ret_val.info() = single_value->field_info.valueof(); } return ret_val; } void SI2quaterExtInfoOpt_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list for a template of type @GSM_RestOctets.SI2quaterExtInfoOpt."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new SI2quaterExtInfoOpt_template[list_length]; } SI2quaterExtInfoOpt_template& SI2quaterExtInfoOpt_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element of a non-list template of type @GSM_RestOctets.SI2quaterExtInfoOpt."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.SI2quaterExtInfoOpt."); return value_list.list_value[list_index]; } BITSTRING_template& SI2quaterExtInfoOpt_template::presence() { set_specific(); return single_value->field_presence; } const BITSTRING_template& SI2quaterExtInfoOpt_template::presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field presence of a non-specific template of type @GSM_RestOctets.SI2quaterExtInfoOpt."); return single_value->field_presence; } SI2quaterExtInfo_template& SI2quaterExtInfoOpt_template::info() { set_specific(); return single_value->field_info; } const SI2quaterExtInfo_template& SI2quaterExtInfoOpt_template::info() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field info of a non-specific template of type @GSM_RestOctets.SI2quaterExtInfoOpt."); return single_value->field_info; } int SI2quaterExtInfoOpt_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterExtInfoOpt which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 1; if (single_value->field_info.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 @GSM_RestOctets.SI2quaterExtInfoOpt containing an empty list."); int item_size = value_list.list_value[0].size_of(); for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++) { if (value_list.list_value[l_idx].size_of()!=item_size) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterExtInfoOpt containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterExtInfoOpt containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterExtInfoOpt containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterExtInfoOpt containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterExtInfoOpt containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterExtInfoOpt containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterExtInfoOpt containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.SI2quaterExtInfoOpt."); } return 0; } void SI2quaterExtInfoOpt_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ presence := "); single_value->field_presence.log(); TTCN_Logger::log_event_str(", info := "); single_value->field_info.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 SI2quaterExtInfoOpt_template::log_match(const SI2quaterExtInfoOpt& 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_presence.match(match_value.presence(), legacy)){ TTCN_Logger::log_logmatch_info(".presence"); single_value->field_presence.log_match(match_value.presence(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.info().ispresent()){ if(!single_value->field_info.match(match_value.info(), legacy)){ TTCN_Logger::log_logmatch_info(".info"); single_value->field_info.log_match(match_value.info(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_info.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".info := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_info.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("{ presence := "); single_value->field_presence.log_match(match_value.presence(), legacy); TTCN_Logger::log_event_str(", info := "); if (match_value.info().ispresent()) { single_value->field_info.log_match(match_value.info(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_info.log(); if (single_value->field_info.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 SI2quaterExtInfoOpt_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (presence().is_bound()) presence().set_implicit_omit(); if (!info().is_bound()) info() = OMIT_VALUE; else info().set_implicit_omit(); } void SI2quaterExtInfoOpt_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_presence.encode_text(text_buf); single_value->field_info.encode_text(text_buf); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @GSM_RestOctets.SI2quaterExtInfoOpt."); } } void SI2quaterExtInfoOpt_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_presence.decode_text(text_buf); single_value->field_info.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 SI2quaterExtInfoOpt_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @GSM_RestOctets.SI2quaterExtInfoOpt."); } } void SI2quaterExtInfoOpt_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: { SI2quaterExtInfoOpt_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) presence().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) info().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(), "presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "info")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { info().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.SI2quaterExtInfoOpt: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { SI2quaterExtInfoOpt_template* precondition = new SI2quaterExtInfoOpt_template; precondition->set_param(*param.get_elem(0)); SI2quaterExtInfoOpt_template* implied_template = new SI2quaterExtInfoOpt_template; implied_template->set_param(*param.get_elem(1)); *this = SI2quaterExtInfoOpt_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.SI2quaterExtInfoOpt"); } is_ifpresent = param.get_ifpresent(); } void SI2quaterExtInfoOpt_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_presence.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI2quaterExtInfoOpt"); single_value->field_info.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI2quaterExtInfoOpt"); return; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@GSM_RestOctets.SI2quaterExtInfoOpt"); } boolean SI2quaterExtInfoOpt_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean SI2quaterExtInfoOpt_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_ccn__supp__desc, const BITSTRING& par_padding) : field_len(par_len), field_ccn__supp__desc(par_ccn__supp__desc), field_padding(par_padding) { } SI2quaterExtInfo::SI2quaterExtInfo(const SI2quaterExtInfo& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.SI2quaterExtInfo."); if (other_value.len().is_bound()) field_len = other_value.len(); else field_len.clean_up(); if (other_value.ccn__supp__desc().is_bound()) field_ccn__supp__desc = other_value.ccn__supp__desc(); else field_ccn__supp__desc.clean_up(); if (other_value.padding().is_bound()) field_padding = other_value.padding(); else field_padding.clean_up(); } void SI2quaterExtInfo::clean_up() { field_len.clean_up(); field_ccn__supp__desc.clean_up(); field_padding.clean_up(); } const TTCN_Typedescriptor_t* SI2quaterExtInfo::get_descriptor() const { return &SI2quaterExtInfo_descr_; } SI2quaterExtInfo& SI2quaterExtInfo::operator=(const SI2quaterExtInfo& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.SI2quaterExtInfo."); if (other_value.len().is_bound()) field_len = other_value.len(); else field_len.clean_up(); if (other_value.ccn__supp__desc().is_bound()) field_ccn__supp__desc = other_value.ccn__supp__desc(); else field_ccn__supp__desc.clean_up(); if (other_value.padding().is_bound()) field_padding = other_value.padding(); else field_padding.clean_up(); } return *this; } boolean SI2quaterExtInfo::operator==(const SI2quaterExtInfo& other_value) const { return field_len==other_value.field_len && field_ccn__supp__desc==other_value.field_ccn__supp__desc && field_padding==other_value.field_padding; } boolean SI2quaterExtInfo::is_bound() const { return (field_len.is_bound()) || (OPTIONAL_OMIT == field_ccn__supp__desc.get_selection() || field_ccn__supp__desc.is_bound()) || (field_padding.is_bound()); } boolean SI2quaterExtInfo::is_value() const { return field_len.is_value() && (OPTIONAL_OMIT == field_ccn__supp__desc.get_selection() || field_ccn__supp__desc.is_value()) && field_padding.is_value(); } int SI2quaterExtInfo::size_of() const { int ret_val = 2; if (field_ccn__supp__desc.ispresent()) ret_val++; return ret_val; } void SI2quaterExtInfo::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ len := "); field_len.log(); TTCN_Logger::log_event_str(", ccn_supp_desc := "); field_ccn__supp__desc.log(); TTCN_Logger::log_event_str(", padding := "); field_padding.log(); TTCN_Logger::log_event_str(" }"); } void SI2quaterExtInfo::set_implicit_omit() { if (len().is_bound()) len().set_implicit_omit(); if (!ccn__supp__desc().is_bound()) ccn__supp__desc() = OMIT_VALUE; else ccn__supp__desc().set_implicit_omit(); if (padding().is_bound()) padding().set_implicit_omit(); } void SI2quaterExtInfo::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) len().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ccn__supp__desc().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) padding().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(), "len")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { len().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ccn_supp_desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ccn__supp__desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "padding")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { padding().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.SI2quaterExtInfo: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.SI2quaterExtInfo"); } } void SI2quaterExtInfo::encode_text(Text_Buf& text_buf) const { field_len.encode_text(text_buf); field_ccn__supp__desc.encode_text(text_buf); field_padding.encode_text(text_buf); } void SI2quaterExtInfo::decode_text(Text_Buf& text_buf) { field_len.decode_text(text_buf); field_ccn__supp__desc.decode_text(text_buf); field_padding.decode_text(text_buf); } void SI2quaterExtInfo::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name); if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); PER_encode(p_td, p_buf, opt); break; } default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void SI2quaterExtInfo::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name); if(!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); try { PER_decode(p_td, p_buf, opt); p_buf.PER_octet_align(FALSE); } catch (PER_Buffer_Exception) { } break; } default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int SI2quaterExtInfo::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, SI2quaterExtInfo_len_descr_.raw->forceomit); decoded_field_length = field_len.RAW_decode(SI2quaterExtInfo_len_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_len.convert_to_Integer(SI2quaterExtInfo_len_descr_); tmp0 = tmp0 - 1; field_len = tmp0; value_of_length_field0 += tmp0.get_long_long_val() * 1; if (limit > 0 && value_of_length_field0 > 0){ if (force_omit != NULL && (*force_omit)(1)) { field_ccn__supp__desc = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_1_force_omit(1, force_omit, SI2quaterExtInfo_ccn__supp__desc_descr_.raw->forceomit); decoded_field_length = field_ccn__supp__desc().RAW_decode(SI2quaterExtInfo_ccn__supp__desc_descr_, p_buf, min_of_ints(2, limit, value_of_length_field0), local_top_order, TRUE, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 1) { field_ccn__supp__desc = 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_field0 -= decoded_field_length; } } } else field_ccn__supp__desc=OMIT_VALUE; RAW_Force_Omit field_2_force_omit(2, force_omit, SI2quaterExtInfo_padding_descr_.raw->forceomit); decoded_field_length = field_padding.RAW_decode(SI2quaterExtInfo_padding_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 SI2quaterExtInfo::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, SI2quaterExtInfo_len_descr_.raw); if (field_ccn__supp__desc.ispresent()) { myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, SI2quaterExtInfo_ccn__supp__desc_descr_.raw); } else myleaf.body.node.nodes[1] = NULL; myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, SI2quaterExtInfo_padding_descr_.raw); encoded_length += 8; myleaf.body.node.nodes[0]->calc = CALC_LENGTH; myleaf.body.node.nodes[0]->coding_descr = &SI2quaterExtInfo_len_descr_; myleaf.body.node.nodes[0]->calcof.lengthto.num_of_fields = 2; myleaf.body.node.nodes[0]->calcof.lengthto.unit = 1; myleaf.body.node.nodes[0]->calcof.lengthto.offset = 1; myleaf.body.node.nodes[0]->calcof.lengthto.fields = init_lengthto_fields_list(2); myleaf.body.node.nodes[0]->length = 8; if (field_ccn__supp__desc.ispresent()) { myleaf.body.node.nodes[0]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[1]->curr_pos.level; myleaf.body.node.nodes[0]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[1]->curr_pos.pos; } else { myleaf.body.node.nodes[0]->calcof.lengthto.fields[0].level = 0; myleaf.body.node.nodes[0]->calcof.lengthto.fields[0].pos = 0; } myleaf.body.node.nodes[0]->calcof.lengthto.fields[1].level = myleaf.body.node.nodes[2]->curr_pos.level; myleaf.body.node.nodes[0]->calcof.lengthto.fields[1].pos = myleaf.body.node.nodes[2]->curr_pos.pos; if (field_ccn__supp__desc.ispresent()) { encoded_length += field_ccn__supp__desc().RAW_encode(SI2quaterExtInfo_ccn__supp__desc_descr_, *myleaf.body.node.nodes[1]); } encoded_length += field_padding.RAW_encode(SI2quaterExtInfo_padding_descr_, *myleaf.body.node.nodes[2]); return myleaf.length = encoded_length; } struct SI2quaterExtInfo_template::single_value_struct { INTEGER_template field_len; CCNSupportDescOpt_template field_ccn__supp__desc; BITSTRING_template field_padding; }; void SI2quaterExtInfo_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_len = ANY_VALUE; single_value->field_ccn__supp__desc = ANY_OR_OMIT; single_value->field_padding = ANY_VALUE; } } } void SI2quaterExtInfo_template::copy_value(const SI2quaterExtInfo& other_value) { single_value = new single_value_struct; if (other_value.len().is_bound()) { single_value->field_len = other_value.len(); } else { single_value->field_len.clean_up(); } if (other_value.ccn__supp__desc().is_bound()) { if (other_value.ccn__supp__desc().ispresent()) single_value->field_ccn__supp__desc = other_value.ccn__supp__desc()(); else single_value->field_ccn__supp__desc = OMIT_VALUE; } else { single_value->field_ccn__supp__desc.clean_up(); } if (other_value.padding().is_bound()) { single_value->field_padding = other_value.padding(); } else { single_value->field_padding.clean_up(); } set_selection(SPECIFIC_VALUE); } void SI2quaterExtInfo_template::copy_template(const SI2quaterExtInfo_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.len().get_selection()) { single_value->field_len = other_value.len(); } else { single_value->field_len.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.ccn__supp__desc().get_selection()) { single_value->field_ccn__supp__desc = other_value.ccn__supp__desc(); } else { single_value->field_ccn__supp__desc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.padding().get_selection()) { single_value->field_padding = other_value.padding(); } else { single_value->field_padding.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 SI2quaterExtInfo_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 SI2quaterExtInfo_template(*other_value.implication_.precondition); implication_.implied_template = new SI2quaterExtInfo_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of type @GSM_RestOctets.SI2quaterExtInfo."); break; } set_selection(other_value); } SI2quaterExtInfo_template::SI2quaterExtInfo_template() { } SI2quaterExtInfo_template::SI2quaterExtInfo_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } SI2quaterExtInfo_template::SI2quaterExtInfo_template(const SI2quaterExtInfo& other_value) { copy_value(other_value); } SI2quaterExtInfo_template::SI2quaterExtInfo_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI2quaterExtInfo&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.SI2quaterExtInfo from an unbound optional field."); } } SI2quaterExtInfo_template::SI2quaterExtInfo_template(SI2quaterExtInfo_template* p_precondition, SI2quaterExtInfo_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } SI2quaterExtInfo_template::SI2quaterExtInfo_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; } SI2quaterExtInfo_template::SI2quaterExtInfo_template(const SI2quaterExtInfo_template& other_value) : Base_Template() { copy_template(other_value); } SI2quaterExtInfo_template::~SI2quaterExtInfo_template() { clean_up(); } SI2quaterExtInfo_template& SI2quaterExtInfo_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } SI2quaterExtInfo_template& SI2quaterExtInfo_template::operator=(const SI2quaterExtInfo& other_value) { clean_up(); copy_value(other_value); return *this; } SI2quaterExtInfo_template& SI2quaterExtInfo_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI2quaterExtInfo&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @GSM_RestOctets.SI2quaterExtInfo."); } return *this; } SI2quaterExtInfo_template& SI2quaterExtInfo_template::operator=(const SI2quaterExtInfo_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean SI2quaterExtInfo_template::match(const SI2quaterExtInfo& 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.len().is_bound()) return FALSE; if(!single_value->field_len.match(other_value.len(), legacy))return FALSE; if(!other_value.ccn__supp__desc().is_bound()) return FALSE; if((other_value.ccn__supp__desc().ispresent() ? !single_value->field_ccn__supp__desc.match((const CCNSupportDescOpt&)other_value.ccn__supp__desc(), legacy) : !single_value->field_ccn__supp__desc.match_omit(legacy)))return FALSE; if(!other_value.padding().is_bound()) return FALSE; if(!single_value->field_padding.match(other_value.padding(), legacy))return FALSE; return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of type @GSM_RestOctets.SI2quaterExtInfo."); } return FALSE; } boolean SI2quaterExtInfo_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_len.is_bound() || (single_value->field_ccn__supp__desc.is_omit() || single_value->field_ccn__supp__desc.is_bound()) || single_value->field_padding.is_bound(); } boolean SI2quaterExtInfo_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_len.is_value() && (single_value->field_ccn__supp__desc.is_omit() || single_value->field_ccn__supp__desc.is_value()) && single_value->field_padding.is_value(); } void SI2quaterExtInfo_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; } SI2quaterExtInfo SI2quaterExtInfo_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @GSM_RestOctets.SI2quaterExtInfo."); SI2quaterExtInfo ret_val; if (single_value->field_len.is_bound()) { ret_val.len() = single_value->field_len.valueof(); } if (single_value->field_ccn__supp__desc.is_omit()) ret_val.ccn__supp__desc() = OMIT_VALUE; else if (single_value->field_ccn__supp__desc.is_bound()) { ret_val.ccn__supp__desc() = single_value->field_ccn__supp__desc.valueof(); } if (single_value->field_padding.is_bound()) { ret_val.padding() = single_value->field_padding.valueof(); } return ret_val; } void SI2quaterExtInfo_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list for a template of type @GSM_RestOctets.SI2quaterExtInfo."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new SI2quaterExtInfo_template[list_length]; } SI2quaterExtInfo_template& SI2quaterExtInfo_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element of a non-list template of type @GSM_RestOctets.SI2quaterExtInfo."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.SI2quaterExtInfo."); return value_list.list_value[list_index]; } INTEGER_template& SI2quaterExtInfo_template::len() { set_specific(); return single_value->field_len; } const INTEGER_template& SI2quaterExtInfo_template::len() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field len of a non-specific template of type @GSM_RestOctets.SI2quaterExtInfo."); return single_value->field_len; } CCNSupportDescOpt_template& SI2quaterExtInfo_template::ccn__supp__desc() { set_specific(); return single_value->field_ccn__supp__desc; } const CCNSupportDescOpt_template& SI2quaterExtInfo_template::ccn__supp__desc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ccn_supp_desc of a non-specific template of type @GSM_RestOctets.SI2quaterExtInfo."); return single_value->field_ccn__supp__desc; } BITSTRING_template& SI2quaterExtInfo_template::padding() { set_specific(); return single_value->field_padding; } const BITSTRING_template& SI2quaterExtInfo_template::padding() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field padding of a non-specific template of type @GSM_RestOctets.SI2quaterExtInfo."); return single_value->field_padding; } int SI2quaterExtInfo_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterExtInfo which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 2; if (single_value->field_ccn__supp__desc.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 @GSM_RestOctets.SI2quaterExtInfo containing an empty list."); int item_size = value_list.list_value[0].size_of(); for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++) { if (value_list.list_value[l_idx].size_of()!=item_size) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterExtInfo containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterExtInfo containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterExtInfo containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterExtInfo containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterExtInfo containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterExtInfo containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterExtInfo containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.SI2quaterExtInfo."); } return 0; } void SI2quaterExtInfo_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ len := "); single_value->field_len.log(); TTCN_Logger::log_event_str(", ccn_supp_desc := "); single_value->field_ccn__supp__desc.log(); TTCN_Logger::log_event_str(", padding := "); single_value->field_padding.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 SI2quaterExtInfo_template::log_match(const SI2quaterExtInfo& 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_len.match(match_value.len(), legacy)){ TTCN_Logger::log_logmatch_info(".len"); single_value->field_len.log_match(match_value.len(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.ccn__supp__desc().ispresent()){ if(!single_value->field_ccn__supp__desc.match(match_value.ccn__supp__desc(), legacy)){ TTCN_Logger::log_logmatch_info(".ccn_supp_desc"); single_value->field_ccn__supp__desc.log_match(match_value.ccn__supp__desc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_ccn__supp__desc.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".ccn_supp_desc := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_ccn__supp__desc.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if(!single_value->field_padding.match(match_value.padding(), legacy)){ TTCN_Logger::log_logmatch_info(".padding"); single_value->field_padding.log_match(match_value.padding(), 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("{ len := "); single_value->field_len.log_match(match_value.len(), legacy); TTCN_Logger::log_event_str(", ccn_supp_desc := "); if (match_value.ccn__supp__desc().ispresent()) { single_value->field_ccn__supp__desc.log_match(match_value.ccn__supp__desc(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_ccn__supp__desc.log(); if (single_value->field_ccn__supp__desc.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", padding := "); single_value->field_padding.log_match(match_value.padding(), 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 SI2quaterExtInfo_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (len().is_bound()) len().set_implicit_omit(); if (!ccn__supp__desc().is_bound()) ccn__supp__desc() = OMIT_VALUE; else ccn__supp__desc().set_implicit_omit(); if (padding().is_bound()) padding().set_implicit_omit(); } void SI2quaterExtInfo_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_len.encode_text(text_buf); single_value->field_ccn__supp__desc.encode_text(text_buf); single_value->field_padding.encode_text(text_buf); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @GSM_RestOctets.SI2quaterExtInfo."); } } void SI2quaterExtInfo_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_len.decode_text(text_buf); single_value->field_ccn__supp__desc.decode_text(text_buf); single_value->field_padding.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 SI2quaterExtInfo_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @GSM_RestOctets.SI2quaterExtInfo."); } } void SI2quaterExtInfo_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: { SI2quaterExtInfo_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) len().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ccn__supp__desc().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) padding().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(), "len")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { len().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ccn_supp_desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ccn__supp__desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "padding")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { padding().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.SI2quaterExtInfo: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { SI2quaterExtInfo_template* precondition = new SI2quaterExtInfo_template; precondition->set_param(*param.get_elem(0)); SI2quaterExtInfo_template* implied_template = new SI2quaterExtInfo_template; implied_template->set_param(*param.get_elem(1)); *this = SI2quaterExtInfo_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.SI2quaterExtInfo"); } is_ifpresent = param.get_ifpresent(); } void SI2quaterExtInfo_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_len.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI2quaterExtInfo"); single_value->field_ccn__supp__desc.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI2quaterExtInfo"); single_value->field_padding.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI2quaterExtInfo"); return; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@GSM_RestOctets.SI2quaterExtInfo"); } boolean SI2quaterExtInfo_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean SI2quaterExtInfo_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_desc) : field_presence(par_presence), field_desc(par_desc) { } CCNSupportDescOpt::CCNSupportDescOpt(const CCNSupportDescOpt& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.CCNSupportDescOpt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.desc().is_bound()) field_desc = other_value.desc(); else field_desc.clean_up(); } void CCNSupportDescOpt::clean_up() { field_presence.clean_up(); field_desc.clean_up(); } const TTCN_Typedescriptor_t* CCNSupportDescOpt::get_descriptor() const { return &CCNSupportDescOpt_descr_; } CCNSupportDescOpt& CCNSupportDescOpt::operator=(const CCNSupportDescOpt& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.CCNSupportDescOpt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.desc().is_bound()) field_desc = other_value.desc(); else field_desc.clean_up(); } return *this; } boolean CCNSupportDescOpt::operator==(const CCNSupportDescOpt& other_value) const { return field_presence==other_value.field_presence && field_desc==other_value.field_desc; } boolean CCNSupportDescOpt::is_bound() const { return (field_presence.is_bound()) || (OPTIONAL_OMIT == field_desc.get_selection() || field_desc.is_bound()); } boolean CCNSupportDescOpt::is_value() const { return field_presence.is_value() && (OPTIONAL_OMIT == field_desc.get_selection() || field_desc.is_value()); } int CCNSupportDescOpt::size_of() const { int ret_val = 1; if (field_desc.ispresent()) ret_val++; return ret_val; } void CCNSupportDescOpt::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ presence := "); field_presence.log(); TTCN_Logger::log_event_str(", desc := "); field_desc.log(); TTCN_Logger::log_event_str(" }"); } void CCNSupportDescOpt::set_implicit_omit() { if (presence().is_bound()) presence().set_implicit_omit(); if (!desc().is_bound()) desc() = OMIT_VALUE; else desc().set_implicit_omit(); } void CCNSupportDescOpt::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) presence().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) desc().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(), "presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.CCNSupportDescOpt: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.CCNSupportDescOpt"); } } void CCNSupportDescOpt::encode_text(Text_Buf& text_buf) const { field_presence.encode_text(text_buf); field_desc.encode_text(text_buf); } void CCNSupportDescOpt::decode_text(Text_Buf& text_buf) { field_presence.decode_text(text_buf); field_desc.decode_text(text_buf); } void CCNSupportDescOpt::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name); if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); PER_encode(p_td, p_buf, opt); break; } default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void CCNSupportDescOpt::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name); if(!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); try { PER_decode(p_td, p_buf, opt); p_buf.PER_octet_align(FALSE); } catch (PER_Buffer_Exception) { } break; } default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int CCNSupportDescOpt::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, CCNSupportDescOpt_presence_descr_.raw->forceomit); decoded_field_length = field_presence.RAW_decode(CCNSupportDescOpt_presence_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); if (limit > 0 && field_presence == bs_0){ if (force_omit != NULL && (*force_omit)(1)) { field_desc = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_1_force_omit(1, force_omit, CCNSupportDescOpt_desc_descr_.raw->forceomit); decoded_field_length = field_desc().RAW_decode(CCNSupportDescOpt_desc_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 1) { field_desc = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } else field_desc=OMIT_VALUE; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int CCNSupportDescOpt::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, CCNSupportDescOpt_presence_descr_.raw); if (field_desc.ispresent()) { myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, CCNSupportDescOpt_desc_descr_.raw); } else myleaf.body.node.nodes[1] = NULL; encoded_length += field_presence.RAW_encode(CCNSupportDescOpt_presence_descr_, *myleaf.body.node.nodes[0]); if (field_desc.ispresent()) { encoded_length += field_desc().RAW_encode(CCNSupportDescOpt_desc_descr_, *myleaf.body.node.nodes[1]); } if (field_desc.ispresent() && (field_presence != bs_0)) { 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){ bs_0.RAW_encode(CCNSupportDescOpt_presence_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 CCNSupportDescOpt_template::single_value_struct { BITSTRING_template field_presence; CCNSupportDesc_template field_desc; }; void CCNSupportDescOpt_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_presence = ANY_VALUE; single_value->field_desc = ANY_OR_OMIT; } } } void CCNSupportDescOpt_template::copy_value(const CCNSupportDescOpt& other_value) { single_value = new single_value_struct; if (other_value.presence().is_bound()) { single_value->field_presence = other_value.presence(); } else { single_value->field_presence.clean_up(); } if (other_value.desc().is_bound()) { if (other_value.desc().ispresent()) single_value->field_desc = other_value.desc()(); else single_value->field_desc = OMIT_VALUE; } else { single_value->field_desc.clean_up(); } set_selection(SPECIFIC_VALUE); } void CCNSupportDescOpt_template::copy_template(const CCNSupportDescOpt_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.presence().get_selection()) { single_value->field_presence = other_value.presence(); } else { single_value->field_presence.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.desc().get_selection()) { single_value->field_desc = other_value.desc(); } else { single_value->field_desc.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 CCNSupportDescOpt_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 CCNSupportDescOpt_template(*other_value.implication_.precondition); implication_.implied_template = new CCNSupportDescOpt_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of type @GSM_RestOctets.CCNSupportDescOpt."); break; } set_selection(other_value); } CCNSupportDescOpt_template::CCNSupportDescOpt_template() { } CCNSupportDescOpt_template::CCNSupportDescOpt_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } CCNSupportDescOpt_template::CCNSupportDescOpt_template(const CCNSupportDescOpt& other_value) { copy_value(other_value); } CCNSupportDescOpt_template::CCNSupportDescOpt_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const CCNSupportDescOpt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.CCNSupportDescOpt from an unbound optional field."); } } CCNSupportDescOpt_template::CCNSupportDescOpt_template(CCNSupportDescOpt_template* p_precondition, CCNSupportDescOpt_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } CCNSupportDescOpt_template::CCNSupportDescOpt_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; } CCNSupportDescOpt_template::CCNSupportDescOpt_template(const CCNSupportDescOpt_template& other_value) : Base_Template() { copy_template(other_value); } CCNSupportDescOpt_template::~CCNSupportDescOpt_template() { clean_up(); } CCNSupportDescOpt_template& CCNSupportDescOpt_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } CCNSupportDescOpt_template& CCNSupportDescOpt_template::operator=(const CCNSupportDescOpt& other_value) { clean_up(); copy_value(other_value); return *this; } CCNSupportDescOpt_template& CCNSupportDescOpt_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const CCNSupportDescOpt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @GSM_RestOctets.CCNSupportDescOpt."); } return *this; } CCNSupportDescOpt_template& CCNSupportDescOpt_template::operator=(const CCNSupportDescOpt_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean CCNSupportDescOpt_template::match(const CCNSupportDescOpt& 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.presence().is_bound()) return FALSE; if(!single_value->field_presence.match(other_value.presence(), legacy))return FALSE; if(!other_value.desc().is_bound()) return FALSE; if((other_value.desc().ispresent() ? !single_value->field_desc.match((const CCNSupportDesc&)other_value.desc(), legacy) : !single_value->field_desc.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 @GSM_RestOctets.CCNSupportDescOpt."); } return FALSE; } boolean CCNSupportDescOpt_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_presence.is_bound() || (single_value->field_desc.is_omit() || single_value->field_desc.is_bound()); } boolean CCNSupportDescOpt_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_presence.is_value() && (single_value->field_desc.is_omit() || single_value->field_desc.is_value()); } void CCNSupportDescOpt_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; } CCNSupportDescOpt CCNSupportDescOpt_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @GSM_RestOctets.CCNSupportDescOpt."); CCNSupportDescOpt ret_val; if (single_value->field_presence.is_bound()) { ret_val.presence() = single_value->field_presence.valueof(); } if (single_value->field_desc.is_omit()) ret_val.desc() = OMIT_VALUE; else if (single_value->field_desc.is_bound()) { ret_val.desc() = single_value->field_desc.valueof(); } return ret_val; } void CCNSupportDescOpt_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list for a template of type @GSM_RestOctets.CCNSupportDescOpt."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new CCNSupportDescOpt_template[list_length]; } CCNSupportDescOpt_template& CCNSupportDescOpt_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element of a non-list template of type @GSM_RestOctets.CCNSupportDescOpt."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.CCNSupportDescOpt."); return value_list.list_value[list_index]; } BITSTRING_template& CCNSupportDescOpt_template::presence() { set_specific(); return single_value->field_presence; } const BITSTRING_template& CCNSupportDescOpt_template::presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field presence of a non-specific template of type @GSM_RestOctets.CCNSupportDescOpt."); return single_value->field_presence; } CCNSupportDesc_template& CCNSupportDescOpt_template::desc() { set_specific(); return single_value->field_desc; } const CCNSupportDesc_template& CCNSupportDescOpt_template::desc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field desc of a non-specific template of type @GSM_RestOctets.CCNSupportDescOpt."); return single_value->field_desc; } int CCNSupportDescOpt_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.CCNSupportDescOpt which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 1; if (single_value->field_desc.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 @GSM_RestOctets.CCNSupportDescOpt containing an empty list."); int item_size = value_list.list_value[0].size_of(); for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++) { if (value_list.list_value[l_idx].size_of()!=item_size) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.CCNSupportDescOpt containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.CCNSupportDescOpt containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.CCNSupportDescOpt containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.CCNSupportDescOpt containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.CCNSupportDescOpt containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.CCNSupportDescOpt containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.CCNSupportDescOpt containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.CCNSupportDescOpt."); } return 0; } void CCNSupportDescOpt_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ presence := "); single_value->field_presence.log(); TTCN_Logger::log_event_str(", desc := "); single_value->field_desc.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 CCNSupportDescOpt_template::log_match(const CCNSupportDescOpt& 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_presence.match(match_value.presence(), legacy)){ TTCN_Logger::log_logmatch_info(".presence"); single_value->field_presence.log_match(match_value.presence(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.desc().ispresent()){ if(!single_value->field_desc.match(match_value.desc(), legacy)){ TTCN_Logger::log_logmatch_info(".desc"); single_value->field_desc.log_match(match_value.desc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_desc.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".desc := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_desc.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("{ presence := "); single_value->field_presence.log_match(match_value.presence(), legacy); TTCN_Logger::log_event_str(", desc := "); if (match_value.desc().ispresent()) { single_value->field_desc.log_match(match_value.desc(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_desc.log(); if (single_value->field_desc.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 CCNSupportDescOpt_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (presence().is_bound()) presence().set_implicit_omit(); if (!desc().is_bound()) desc() = OMIT_VALUE; else desc().set_implicit_omit(); } void CCNSupportDescOpt_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_presence.encode_text(text_buf); single_value->field_desc.encode_text(text_buf); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @GSM_RestOctets.CCNSupportDescOpt."); } } void CCNSupportDescOpt_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_presence.decode_text(text_buf); single_value->field_desc.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 CCNSupportDescOpt_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @GSM_RestOctets.CCNSupportDescOpt."); } } void CCNSupportDescOpt_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: { CCNSupportDescOpt_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) presence().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) desc().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(), "presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.CCNSupportDescOpt: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { CCNSupportDescOpt_template* precondition = new CCNSupportDescOpt_template; precondition->set_param(*param.get_elem(0)); CCNSupportDescOpt_template* implied_template = new CCNSupportDescOpt_template; implied_template->set_param(*param.get_elem(1)); *this = CCNSupportDescOpt_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.CCNSupportDescOpt"); } is_ifpresent = param.get_ifpresent(); } void CCNSupportDescOpt_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_presence.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.CCNSupportDescOpt"); single_value->field_desc.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.CCNSupportDescOpt"); return; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@GSM_RestOctets.CCNSupportDescOpt"); } boolean CCNSupportDescOpt_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean CCNSupportDescOpt_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) nr__of__cells().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ccn__supported().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(), "nr_of_cells")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nr__of__cells().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ccn_supported")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ccn__supported().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.CCNSupportDesc: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.CCNSupportDesc"); } } void CCNSupportDesc::encode_text(Text_Buf& text_buf) const { field_nr__of__cells.encode_text(text_buf); field_ccn__supported.encode_text(text_buf); } void CCNSupportDesc::decode_text(Text_Buf& text_buf) { field_nr__of__cells.decode_text(text_buf); field_ccn__supported.decode_text(text_buf); } void CCNSupportDesc::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name); if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); PER_encode(p_td, p_buf, opt); break; } default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void CCNSupportDesc::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name); if(!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); try { PER_decode(p_td, p_buf, opt); p_buf.PER_octet_align(FALSE); } catch (PER_Buffer_Exception) { } break; } default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int CCNSupportDesc::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, CCNSupportDesc_nr__of__cells_descr_.raw->forceomit); decoded_field_length = field_nr__of__cells.RAW_decode(CCNSupportDesc_nr__of__cells_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_nr__of__cells.convert_to_Integer(CCNSupportDesc_nr__of__cells_descr_); field_nr__of__cells = tmp0; value_of_length_field0 += tmp0.get_long_long_val() * 1; RAW_Force_Omit field_1_force_omit(1, force_omit, CCNSupportDesc_ccn__supported_descr_.raw->forceomit); decoded_field_length = field_ccn__supported.RAW_decode(CCNSupportDesc_ccn__supported_descr_, p_buf, min_of_ints(2, limit, value_of_length_field0), 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()); 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 CCNSupportDesc::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, CCNSupportDesc_nr__of__cells_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, CCNSupportDesc_ccn__supported_descr_.raw); encoded_length += 7; myleaf.body.node.nodes[0]->calc = CALC_LENGTH; myleaf.body.node.nodes[0]->coding_descr = &CCNSupportDesc_nr__of__cells_descr_; myleaf.body.node.nodes[0]->calcof.lengthto.num_of_fields = 1; myleaf.body.node.nodes[0]->calcof.lengthto.unit = 1; 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 = 7; myleaf.body.node.nodes[0]->calcof.lengthto.fields[0].level = myleaf.body.node.nodes[1]->curr_pos.level; myleaf.body.node.nodes[0]->calcof.lengthto.fields[0].pos = myleaf.body.node.nodes[1]->curr_pos.pos; encoded_length += field_ccn__supported.RAW_encode(CCNSupportDesc_ccn__supported_descr_, *myleaf.body.node.nodes[1]); return myleaf.length = encoded_length; } struct CCNSupportDesc_template::single_value_struct { INTEGER_template field_nr__of__cells; BITSTRING_template field_ccn__supported; }; void CCNSupportDesc_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_nr__of__cells = ANY_VALUE; single_value->field_ccn__supported = ANY_VALUE; } } } void CCNSupportDesc_template::copy_value(const CCNSupportDesc& other_value) { single_value = new single_value_struct; if (other_value.nr__of__cells().is_bound()) { single_value->field_nr__of__cells = other_value.nr__of__cells(); } else { single_value->field_nr__of__cells.clean_up(); } if (other_value.ccn__supported().is_bound()) { single_value->field_ccn__supported = other_value.ccn__supported(); } else { single_value->field_ccn__supported.clean_up(); } set_selection(SPECIFIC_VALUE); } void CCNSupportDesc_template::copy_template(const CCNSupportDesc_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.nr__of__cells().get_selection()) { single_value->field_nr__of__cells = other_value.nr__of__cells(); } else { single_value->field_nr__of__cells.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.ccn__supported().get_selection()) { single_value->field_ccn__supported = other_value.ccn__supported(); } else { single_value->field_ccn__supported.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 CCNSupportDesc_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 CCNSupportDesc_template(*other_value.implication_.precondition); implication_.implied_template = new CCNSupportDesc_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of type @GSM_RestOctets.CCNSupportDesc."); break; } set_selection(other_value); } CCNSupportDesc_template::CCNSupportDesc_template() { } CCNSupportDesc_template::CCNSupportDesc_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } CCNSupportDesc_template::CCNSupportDesc_template(const CCNSupportDesc& other_value) { copy_value(other_value); } CCNSupportDesc_template::CCNSupportDesc_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const CCNSupportDesc&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.CCNSupportDesc from an unbound optional field."); } } CCNSupportDesc_template::CCNSupportDesc_template(CCNSupportDesc_template* p_precondition, CCNSupportDesc_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } CCNSupportDesc_template::CCNSupportDesc_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; } CCNSupportDesc_template::CCNSupportDesc_template(const CCNSupportDesc_template& other_value) : Base_Template() { copy_template(other_value); } CCNSupportDesc_template::~CCNSupportDesc_template() { clean_up(); } CCNSupportDesc_template& CCNSupportDesc_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } CCNSupportDesc_template& CCNSupportDesc_template::operator=(const CCNSupportDesc& other_value) { clean_up(); copy_value(other_value); return *this; } CCNSupportDesc_template& CCNSupportDesc_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const CCNSupportDesc&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @GSM_RestOctets.CCNSupportDesc."); } return *this; } CCNSupportDesc_template& CCNSupportDesc_template::operator=(const CCNSupportDesc_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean CCNSupportDesc_template::match(const CCNSupportDesc& 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.nr__of__cells().is_bound()) return FALSE; if(!single_value->field_nr__of__cells.match(other_value.nr__of__cells(), legacy))return FALSE; if(!other_value.ccn__supported().is_bound()) return FALSE; if(!single_value->field_ccn__supported.match(other_value.ccn__supported(), legacy))return FALSE; return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of type @GSM_RestOctets.CCNSupportDesc."); } return FALSE; } boolean CCNSupportDesc_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_nr__of__cells.is_bound() || single_value->field_ccn__supported.is_bound(); } boolean CCNSupportDesc_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_nr__of__cells.is_value() && single_value->field_ccn__supported.is_value(); } void CCNSupportDesc_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; } CCNSupportDesc CCNSupportDesc_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @GSM_RestOctets.CCNSupportDesc."); CCNSupportDesc ret_val; if (single_value->field_nr__of__cells.is_bound()) { ret_val.nr__of__cells() = single_value->field_nr__of__cells.valueof(); } if (single_value->field_ccn__supported.is_bound()) { ret_val.ccn__supported() = single_value->field_ccn__supported.valueof(); } return ret_val; } void CCNSupportDesc_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list for a template of type @GSM_RestOctets.CCNSupportDesc."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new CCNSupportDesc_template[list_length]; } CCNSupportDesc_template& CCNSupportDesc_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element of a non-list template of type @GSM_RestOctets.CCNSupportDesc."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.CCNSupportDesc."); return value_list.list_value[list_index]; } INTEGER_template& CCNSupportDesc_template::nr__of__cells() { set_specific(); return single_value->field_nr__of__cells; } const INTEGER_template& CCNSupportDesc_template::nr__of__cells() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nr_of_cells of a non-specific template of type @GSM_RestOctets.CCNSupportDesc."); return single_value->field_nr__of__cells; } BITSTRING_template& CCNSupportDesc_template::ccn__supported() { set_specific(); return single_value->field_ccn__supported; } const BITSTRING_template& CCNSupportDesc_template::ccn__supported() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ccn_supported of a non-specific template of type @GSM_RestOctets.CCNSupportDesc."); return single_value->field_ccn__supported; } int CCNSupportDesc_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.CCNSupportDesc which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 2; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @GSM_RestOctets.CCNSupportDesc containing an empty list."); int item_size = value_list.list_value[0].size_of(); for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++) { if (value_list.list_value[l_idx].size_of()!=item_size) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.CCNSupportDesc containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.CCNSupportDesc containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.CCNSupportDesc containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.CCNSupportDesc containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.CCNSupportDesc containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.CCNSupportDesc containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.CCNSupportDesc containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.CCNSupportDesc."); } return 0; } void CCNSupportDesc_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ nr_of_cells := "); single_value->field_nr__of__cells.log(); TTCN_Logger::log_event_str(", ccn_supported := "); single_value->field_ccn__supported.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 CCNSupportDesc_template::log_match(const CCNSupportDesc& 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_nr__of__cells.match(match_value.nr__of__cells(), legacy)){ TTCN_Logger::log_logmatch_info(".nr_of_cells"); single_value->field_nr__of__cells.log_match(match_value.nr__of__cells(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_ccn__supported.match(match_value.ccn__supported(), legacy)){ TTCN_Logger::log_logmatch_info(".ccn_supported"); single_value->field_ccn__supported.log_match(match_value.ccn__supported(), 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("{ nr_of_cells := "); single_value->field_nr__of__cells.log_match(match_value.nr__of__cells(), legacy); TTCN_Logger::log_event_str(", ccn_supported := "); single_value->field_ccn__supported.log_match(match_value.ccn__supported(), 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 CCNSupportDesc_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (nr__of__cells().is_bound()) nr__of__cells().set_implicit_omit(); if (ccn__supported().is_bound()) ccn__supported().set_implicit_omit(); } void CCNSupportDesc_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_nr__of__cells.encode_text(text_buf); single_value->field_ccn__supported.encode_text(text_buf); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @GSM_RestOctets.CCNSupportDesc."); } } void CCNSupportDesc_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_nr__of__cells.decode_text(text_buf); single_value->field_ccn__supported.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 CCNSupportDesc_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @GSM_RestOctets.CCNSupportDesc."); } } void CCNSupportDesc_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: { CCNSupportDesc_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) nr__of__cells().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ccn__supported().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(), "nr_of_cells")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nr__of__cells().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ccn_supported")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ccn__supported().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.CCNSupportDesc: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { CCNSupportDesc_template* precondition = new CCNSupportDesc_template; precondition->set_param(*param.get_elem(0)); CCNSupportDesc_template* implied_template = new CCNSupportDesc_template; implied_template->set_param(*param.get_elem(1)); *this = CCNSupportDesc_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.CCNSupportDesc"); } is_ifpresent = param.get_ifpresent(); } void CCNSupportDesc_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_nr__of__cells.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.CCNSupportDesc"); single_value->field_ccn__supported.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.CCNSupportDesc"); return; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@GSM_RestOctets.CCNSupportDesc"); } boolean CCNSupportDesc_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean CCNSupportDesc_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_desc) : field_presence(par_presence), field_desc(par_desc) { } UTRAN__NeighDescOpt::UTRAN__NeighDescOpt(const UTRAN__NeighDescOpt& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.UTRAN_NeighDescOpt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.desc().is_bound()) field_desc = other_value.desc(); else field_desc.clean_up(); } void UTRAN__NeighDescOpt::clean_up() { field_presence.clean_up(); field_desc.clean_up(); } const TTCN_Typedescriptor_t* UTRAN__NeighDescOpt::get_descriptor() const { return &UTRAN__NeighDescOpt_descr_; } UTRAN__NeighDescOpt& UTRAN__NeighDescOpt::operator=(const UTRAN__NeighDescOpt& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.UTRAN_NeighDescOpt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.desc().is_bound()) field_desc = other_value.desc(); else field_desc.clean_up(); } return *this; } boolean UTRAN__NeighDescOpt::operator==(const UTRAN__NeighDescOpt& other_value) const { return field_presence==other_value.field_presence && field_desc==other_value.field_desc; } boolean UTRAN__NeighDescOpt::is_bound() const { return (field_presence.is_bound()) || (OPTIONAL_OMIT == field_desc.get_selection() || field_desc.is_bound()); } boolean UTRAN__NeighDescOpt::is_value() const { return field_presence.is_value() && (OPTIONAL_OMIT == field_desc.get_selection() || field_desc.is_value()); } int UTRAN__NeighDescOpt::size_of() const { int ret_val = 1; if (field_desc.ispresent()) ret_val++; return ret_val; } void UTRAN__NeighDescOpt::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ presence := "); field_presence.log(); TTCN_Logger::log_event_str(", desc := "); field_desc.log(); TTCN_Logger::log_event_str(" }"); } void UTRAN__NeighDescOpt::set_implicit_omit() { if (presence().is_bound()) presence().set_implicit_omit(); if (!desc().is_bound()) desc() = OMIT_VALUE; else desc().set_implicit_omit(); } void UTRAN__NeighDescOpt::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) presence().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) desc().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(), "presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.UTRAN_NeighDescOpt: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.UTRAN_NeighDescOpt"); } } void UTRAN__NeighDescOpt::encode_text(Text_Buf& text_buf) const { field_presence.encode_text(text_buf); field_desc.encode_text(text_buf); } void UTRAN__NeighDescOpt::decode_text(Text_Buf& text_buf) { field_presence.decode_text(text_buf); field_desc.decode_text(text_buf); } void UTRAN__NeighDescOpt::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name); if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); PER_encode(p_td, p_buf, opt); break; } default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void UTRAN__NeighDescOpt::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name); if(!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); try { PER_decode(p_td, p_buf, opt); p_buf.PER_octet_align(FALSE); } catch (PER_Buffer_Exception) { } break; } default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int UTRAN__NeighDescOpt::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, UTRAN__NeighDescOpt_presence_descr_.raw->forceomit); decoded_field_length = field_presence.RAW_decode(UTRAN__NeighDescOpt_presence_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); if (limit > 0 && field_presence == bs_0){ if (force_omit != NULL && (*force_omit)(1)) { field_desc = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_1_force_omit(1, force_omit, UTRAN__NeighDescOpt_desc_descr_.raw->forceomit); decoded_field_length = field_desc().RAW_decode(UTRAN__NeighDescOpt_desc_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 1) { field_desc = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } else field_desc=OMIT_VALUE; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int UTRAN__NeighDescOpt::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, UTRAN__NeighDescOpt_presence_descr_.raw); if (field_desc.ispresent()) { myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, UTRAN__NeighDescOpt_desc_descr_.raw); } else myleaf.body.node.nodes[1] = NULL; encoded_length += field_presence.RAW_encode(UTRAN__NeighDescOpt_presence_descr_, *myleaf.body.node.nodes[0]); if (field_desc.ispresent()) { encoded_length += field_desc().RAW_encode(UTRAN__NeighDescOpt_desc_descr_, *myleaf.body.node.nodes[1]); } if (field_desc.ispresent() && (field_presence != bs_0)) { 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){ bs_0.RAW_encode(UTRAN__NeighDescOpt_presence_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 UTRAN__NeighDescOpt_template::single_value_struct { BITSTRING_template field_presence; UTRAN__NeighDesc_template field_desc; }; void UTRAN__NeighDescOpt_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_presence = ANY_VALUE; single_value->field_desc = ANY_OR_OMIT; } } } void UTRAN__NeighDescOpt_template::copy_value(const UTRAN__NeighDescOpt& other_value) { single_value = new single_value_struct; if (other_value.presence().is_bound()) { single_value->field_presence = other_value.presence(); } else { single_value->field_presence.clean_up(); } if (other_value.desc().is_bound()) { if (other_value.desc().ispresent()) single_value->field_desc = other_value.desc()(); else single_value->field_desc = OMIT_VALUE; } else { single_value->field_desc.clean_up(); } set_selection(SPECIFIC_VALUE); } void UTRAN__NeighDescOpt_template::copy_template(const UTRAN__NeighDescOpt_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.presence().get_selection()) { single_value->field_presence = other_value.presence(); } else { single_value->field_presence.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.desc().get_selection()) { single_value->field_desc = other_value.desc(); } else { single_value->field_desc.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 UTRAN__NeighDescOpt_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 UTRAN__NeighDescOpt_template(*other_value.implication_.precondition); implication_.implied_template = new UTRAN__NeighDescOpt_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of type @GSM_RestOctets.UTRAN_NeighDescOpt."); break; } set_selection(other_value); } UTRAN__NeighDescOpt_template::UTRAN__NeighDescOpt_template() { } UTRAN__NeighDescOpt_template::UTRAN__NeighDescOpt_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } UTRAN__NeighDescOpt_template::UTRAN__NeighDescOpt_template(const UTRAN__NeighDescOpt& other_value) { copy_value(other_value); } UTRAN__NeighDescOpt_template::UTRAN__NeighDescOpt_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const UTRAN__NeighDescOpt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.UTRAN_NeighDescOpt from an unbound optional field."); } } UTRAN__NeighDescOpt_template::UTRAN__NeighDescOpt_template(UTRAN__NeighDescOpt_template* p_precondition, UTRAN__NeighDescOpt_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } UTRAN__NeighDescOpt_template::UTRAN__NeighDescOpt_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; } UTRAN__NeighDescOpt_template::UTRAN__NeighDescOpt_template(const UTRAN__NeighDescOpt_template& other_value) : Base_Template() { copy_template(other_value); } UTRAN__NeighDescOpt_template::~UTRAN__NeighDescOpt_template() { clean_up(); } UTRAN__NeighDescOpt_template& UTRAN__NeighDescOpt_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } UTRAN__NeighDescOpt_template& UTRAN__NeighDescOpt_template::operator=(const UTRAN__NeighDescOpt& other_value) { clean_up(); copy_value(other_value); return *this; } UTRAN__NeighDescOpt_template& UTRAN__NeighDescOpt_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const UTRAN__NeighDescOpt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @GSM_RestOctets.UTRAN_NeighDescOpt."); } return *this; } UTRAN__NeighDescOpt_template& UTRAN__NeighDescOpt_template::operator=(const UTRAN__NeighDescOpt_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean UTRAN__NeighDescOpt_template::match(const UTRAN__NeighDescOpt& 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.presence().is_bound()) return FALSE; if(!single_value->field_presence.match(other_value.presence(), legacy))return FALSE; if(!other_value.desc().is_bound()) return FALSE; if((other_value.desc().ispresent() ? !single_value->field_desc.match((const UTRAN__NeighDesc&)other_value.desc(), legacy) : !single_value->field_desc.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 @GSM_RestOctets.UTRAN_NeighDescOpt."); } return FALSE; } boolean UTRAN__NeighDescOpt_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_presence.is_bound() || (single_value->field_desc.is_omit() || single_value->field_desc.is_bound()); } boolean UTRAN__NeighDescOpt_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_presence.is_value() && (single_value->field_desc.is_omit() || single_value->field_desc.is_value()); } void UTRAN__NeighDescOpt_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; } UTRAN__NeighDescOpt UTRAN__NeighDescOpt_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @GSM_RestOctets.UTRAN_NeighDescOpt."); UTRAN__NeighDescOpt ret_val; if (single_value->field_presence.is_bound()) { ret_val.presence() = single_value->field_presence.valueof(); } if (single_value->field_desc.is_omit()) ret_val.desc() = OMIT_VALUE; else if (single_value->field_desc.is_bound()) { ret_val.desc() = single_value->field_desc.valueof(); } return ret_val; } void UTRAN__NeighDescOpt_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list for a template of type @GSM_RestOctets.UTRAN_NeighDescOpt."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new UTRAN__NeighDescOpt_template[list_length]; } UTRAN__NeighDescOpt_template& UTRAN__NeighDescOpt_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element of a non-list template of type @GSM_RestOctets.UTRAN_NeighDescOpt."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.UTRAN_NeighDescOpt."); return value_list.list_value[list_index]; } BITSTRING_template& UTRAN__NeighDescOpt_template::presence() { set_specific(); return single_value->field_presence; } const BITSTRING_template& UTRAN__NeighDescOpt_template::presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field presence of a non-specific template of type @GSM_RestOctets.UTRAN_NeighDescOpt."); return single_value->field_presence; } UTRAN__NeighDesc_template& UTRAN__NeighDescOpt_template::desc() { set_specific(); return single_value->field_desc; } const UTRAN__NeighDesc_template& UTRAN__NeighDescOpt_template::desc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field desc of a non-specific template of type @GSM_RestOctets.UTRAN_NeighDescOpt."); return single_value->field_desc; } int UTRAN__NeighDescOpt_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_NeighDescOpt which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 1; if (single_value->field_desc.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 @GSM_RestOctets.UTRAN_NeighDescOpt containing an empty list."); int item_size = value_list.list_value[0].size_of(); for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++) { if (value_list.list_value[l_idx].size_of()!=item_size) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_NeighDescOpt containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_NeighDescOpt containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_NeighDescOpt containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_NeighDescOpt containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_NeighDescOpt containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_NeighDescOpt containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_NeighDescOpt containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.UTRAN_NeighDescOpt."); } return 0; } void UTRAN__NeighDescOpt_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ presence := "); single_value->field_presence.log(); TTCN_Logger::log_event_str(", desc := "); single_value->field_desc.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 UTRAN__NeighDescOpt_template::log_match(const UTRAN__NeighDescOpt& 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_presence.match(match_value.presence(), legacy)){ TTCN_Logger::log_logmatch_info(".presence"); single_value->field_presence.log_match(match_value.presence(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.desc().ispresent()){ if(!single_value->field_desc.match(match_value.desc(), legacy)){ TTCN_Logger::log_logmatch_info(".desc"); single_value->field_desc.log_match(match_value.desc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_desc.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".desc := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_desc.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("{ presence := "); single_value->field_presence.log_match(match_value.presence(), legacy); TTCN_Logger::log_event_str(", desc := "); if (match_value.desc().ispresent()) { single_value->field_desc.log_match(match_value.desc(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_desc.log(); if (single_value->field_desc.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 UTRAN__NeighDescOpt_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (presence().is_bound()) presence().set_implicit_omit(); if (!desc().is_bound()) desc() = OMIT_VALUE; else desc().set_implicit_omit(); } void UTRAN__NeighDescOpt_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_presence.encode_text(text_buf); single_value->field_desc.encode_text(text_buf); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @GSM_RestOctets.UTRAN_NeighDescOpt."); } } void UTRAN__NeighDescOpt_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_presence.decode_text(text_buf); single_value->field_desc.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 UTRAN__NeighDescOpt_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @GSM_RestOctets.UTRAN_NeighDescOpt."); } } void UTRAN__NeighDescOpt_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: { UTRAN__NeighDescOpt_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) presence().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) desc().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(), "presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.UTRAN_NeighDescOpt: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { UTRAN__NeighDescOpt_template* precondition = new UTRAN__NeighDescOpt_template; precondition->set_param(*param.get_elem(0)); UTRAN__NeighDescOpt_template* implied_template = new UTRAN__NeighDescOpt_template; implied_template->set_param(*param.get_elem(1)); *this = UTRAN__NeighDescOpt_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.UTRAN_NeighDescOpt"); } is_ifpresent = param.get_ifpresent(); } void UTRAN__NeighDescOpt_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_presence.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.UTRAN_NeighDescOpt"); single_value->field_desc.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.UTRAN_NeighDescOpt"); return; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@GSM_RestOctets.UTRAN_NeighDescOpt"); } boolean UTRAN__NeighDescOpt_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean UTRAN__NeighDescOpt_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_desc) : field_presence(par_presence), field_desc(par_desc) { } UTRAN__FDDDescOpt::UTRAN__FDDDescOpt(const UTRAN__FDDDescOpt& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.UTRAN_FDDDescOpt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.desc().is_bound()) field_desc = other_value.desc(); else field_desc.clean_up(); } void UTRAN__FDDDescOpt::clean_up() { field_presence.clean_up(); field_desc.clean_up(); } const TTCN_Typedescriptor_t* UTRAN__FDDDescOpt::get_descriptor() const { return &UTRAN__FDDDescOpt_descr_; } UTRAN__FDDDescOpt& UTRAN__FDDDescOpt::operator=(const UTRAN__FDDDescOpt& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.UTRAN_FDDDescOpt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.desc().is_bound()) field_desc = other_value.desc(); else field_desc.clean_up(); } return *this; } boolean UTRAN__FDDDescOpt::operator==(const UTRAN__FDDDescOpt& other_value) const { return field_presence==other_value.field_presence && field_desc==other_value.field_desc; } boolean UTRAN__FDDDescOpt::is_bound() const { return (field_presence.is_bound()) || (OPTIONAL_OMIT == field_desc.get_selection() || field_desc.is_bound()); } boolean UTRAN__FDDDescOpt::is_value() const { return field_presence.is_value() && (OPTIONAL_OMIT == field_desc.get_selection() || field_desc.is_value()); } int UTRAN__FDDDescOpt::size_of() const { int ret_val = 1; if (field_desc.ispresent()) ret_val++; return ret_val; } void UTRAN__FDDDescOpt::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ presence := "); field_presence.log(); TTCN_Logger::log_event_str(", desc := "); field_desc.log(); TTCN_Logger::log_event_str(" }"); } void UTRAN__FDDDescOpt::set_implicit_omit() { if (presence().is_bound()) presence().set_implicit_omit(); if (!desc().is_bound()) desc() = OMIT_VALUE; else desc().set_implicit_omit(); } void UTRAN__FDDDescOpt::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) presence().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) desc().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(), "presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.UTRAN_FDDDescOpt: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.UTRAN_FDDDescOpt"); } } void UTRAN__FDDDescOpt::encode_text(Text_Buf& text_buf) const { field_presence.encode_text(text_buf); field_desc.encode_text(text_buf); } void UTRAN__FDDDescOpt::decode_text(Text_Buf& text_buf) { field_presence.decode_text(text_buf); field_desc.decode_text(text_buf); } void UTRAN__FDDDescOpt::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name); if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); PER_encode(p_td, p_buf, opt); break; } default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void UTRAN__FDDDescOpt::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name); if(!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); try { PER_decode(p_td, p_buf, opt); p_buf.PER_octet_align(FALSE); } catch (PER_Buffer_Exception) { } break; } default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int UTRAN__FDDDescOpt::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, UTRAN__FDDDescOpt_presence_descr_.raw->forceomit); decoded_field_length = field_presence.RAW_decode(UTRAN__FDDDescOpt_presence_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); if (limit > 0 && field_presence == bs_0){ if (force_omit != NULL && (*force_omit)(1)) { field_desc = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_1_force_omit(1, force_omit, UTRAN__FDDDescOpt_desc_descr_.raw->forceomit); decoded_field_length = field_desc().RAW_decode(UTRAN__FDDDescOpt_desc_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 1) { field_desc = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } else field_desc=OMIT_VALUE; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int UTRAN__FDDDescOpt::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, UTRAN__FDDDescOpt_presence_descr_.raw); if (field_desc.ispresent()) { myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, UTRAN__FDDDescOpt_desc_descr_.raw); } else myleaf.body.node.nodes[1] = NULL; encoded_length += field_presence.RAW_encode(UTRAN__FDDDescOpt_presence_descr_, *myleaf.body.node.nodes[0]); if (field_desc.ispresent()) { encoded_length += field_desc().RAW_encode(UTRAN__FDDDescOpt_desc_descr_, *myleaf.body.node.nodes[1]); } if (field_desc.ispresent() && (field_presence != bs_0)) { 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){ bs_0.RAW_encode(UTRAN__FDDDescOpt_presence_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 UTRAN__FDDDescOpt_template::single_value_struct { BITSTRING_template field_presence; BITSTRING_template field_desc; }; void UTRAN__FDDDescOpt_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_presence = ANY_VALUE; single_value->field_desc = ANY_OR_OMIT; } } } void UTRAN__FDDDescOpt_template::copy_value(const UTRAN__FDDDescOpt& other_value) { single_value = new single_value_struct; if (other_value.presence().is_bound()) { single_value->field_presence = other_value.presence(); } else { single_value->field_presence.clean_up(); } if (other_value.desc().is_bound()) { if (other_value.desc().ispresent()) single_value->field_desc = other_value.desc()(); else single_value->field_desc = OMIT_VALUE; } else { single_value->field_desc.clean_up(); } set_selection(SPECIFIC_VALUE); } void UTRAN__FDDDescOpt_template::copy_template(const UTRAN__FDDDescOpt_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.presence().get_selection()) { single_value->field_presence = other_value.presence(); } else { single_value->field_presence.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.desc().get_selection()) { single_value->field_desc = other_value.desc(); } else { single_value->field_desc.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 UTRAN__FDDDescOpt_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 UTRAN__FDDDescOpt_template(*other_value.implication_.precondition); implication_.implied_template = new UTRAN__FDDDescOpt_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of type @GSM_RestOctets.UTRAN_FDDDescOpt."); break; } set_selection(other_value); } UTRAN__FDDDescOpt_template::UTRAN__FDDDescOpt_template() { } UTRAN__FDDDescOpt_template::UTRAN__FDDDescOpt_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } UTRAN__FDDDescOpt_template::UTRAN__FDDDescOpt_template(const UTRAN__FDDDescOpt& other_value) { copy_value(other_value); } UTRAN__FDDDescOpt_template::UTRAN__FDDDescOpt_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const UTRAN__FDDDescOpt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.UTRAN_FDDDescOpt from an unbound optional field."); } } UTRAN__FDDDescOpt_template::UTRAN__FDDDescOpt_template(UTRAN__FDDDescOpt_template* p_precondition, UTRAN__FDDDescOpt_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } UTRAN__FDDDescOpt_template::UTRAN__FDDDescOpt_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; } UTRAN__FDDDescOpt_template::UTRAN__FDDDescOpt_template(const UTRAN__FDDDescOpt_template& other_value) : Base_Template() { copy_template(other_value); } UTRAN__FDDDescOpt_template::~UTRAN__FDDDescOpt_template() { clean_up(); } UTRAN__FDDDescOpt_template& UTRAN__FDDDescOpt_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } UTRAN__FDDDescOpt_template& UTRAN__FDDDescOpt_template::operator=(const UTRAN__FDDDescOpt& other_value) { clean_up(); copy_value(other_value); return *this; } UTRAN__FDDDescOpt_template& UTRAN__FDDDescOpt_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const UTRAN__FDDDescOpt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @GSM_RestOctets.UTRAN_FDDDescOpt."); } return *this; } UTRAN__FDDDescOpt_template& UTRAN__FDDDescOpt_template::operator=(const UTRAN__FDDDescOpt_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean UTRAN__FDDDescOpt_template::match(const UTRAN__FDDDescOpt& 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.presence().is_bound()) return FALSE; if(!single_value->field_presence.match(other_value.presence(), legacy))return FALSE; if(!other_value.desc().is_bound()) return FALSE; if((other_value.desc().ispresent() ? !single_value->field_desc.match((const BITSTRING&)other_value.desc(), legacy) : !single_value->field_desc.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 @GSM_RestOctets.UTRAN_FDDDescOpt."); } return FALSE; } boolean UTRAN__FDDDescOpt_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_presence.is_bound() || (single_value->field_desc.is_omit() || single_value->field_desc.is_bound()); } boolean UTRAN__FDDDescOpt_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_presence.is_value() && (single_value->field_desc.is_omit() || single_value->field_desc.is_value()); } void UTRAN__FDDDescOpt_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; } UTRAN__FDDDescOpt UTRAN__FDDDescOpt_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @GSM_RestOctets.UTRAN_FDDDescOpt."); UTRAN__FDDDescOpt ret_val; if (single_value->field_presence.is_bound()) { ret_val.presence() = single_value->field_presence.valueof(); } if (single_value->field_desc.is_omit()) ret_val.desc() = OMIT_VALUE; else if (single_value->field_desc.is_bound()) { ret_val.desc() = single_value->field_desc.valueof(); } return ret_val; } void UTRAN__FDDDescOpt_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list for a template of type @GSM_RestOctets.UTRAN_FDDDescOpt."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new UTRAN__FDDDescOpt_template[list_length]; } UTRAN__FDDDescOpt_template& UTRAN__FDDDescOpt_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element of a non-list template of type @GSM_RestOctets.UTRAN_FDDDescOpt."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.UTRAN_FDDDescOpt."); return value_list.list_value[list_index]; } BITSTRING_template& UTRAN__FDDDescOpt_template::presence() { set_specific(); return single_value->field_presence; } const BITSTRING_template& UTRAN__FDDDescOpt_template::presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field presence of a non-specific template of type @GSM_RestOctets.UTRAN_FDDDescOpt."); return single_value->field_presence; } BITSTRING_template& UTRAN__FDDDescOpt_template::desc() { set_specific(); return single_value->field_desc; } const BITSTRING_template& UTRAN__FDDDescOpt_template::desc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field desc of a non-specific template of type @GSM_RestOctets.UTRAN_FDDDescOpt."); return single_value->field_desc; } int UTRAN__FDDDescOpt_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_FDDDescOpt which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 1; if (single_value->field_desc.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 @GSM_RestOctets.UTRAN_FDDDescOpt containing an empty list."); int item_size = value_list.list_value[0].size_of(); for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++) { if (value_list.list_value[l_idx].size_of()!=item_size) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_FDDDescOpt containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_FDDDescOpt containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_FDDDescOpt containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_FDDDescOpt containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_FDDDescOpt containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_FDDDescOpt containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_FDDDescOpt containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.UTRAN_FDDDescOpt."); } return 0; } void UTRAN__FDDDescOpt_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ presence := "); single_value->field_presence.log(); TTCN_Logger::log_event_str(", desc := "); single_value->field_desc.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 UTRAN__FDDDescOpt_template::log_match(const UTRAN__FDDDescOpt& 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_presence.match(match_value.presence(), legacy)){ TTCN_Logger::log_logmatch_info(".presence"); single_value->field_presence.log_match(match_value.presence(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.desc().ispresent()){ if(!single_value->field_desc.match(match_value.desc(), legacy)){ TTCN_Logger::log_logmatch_info(".desc"); single_value->field_desc.log_match(match_value.desc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_desc.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".desc := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_desc.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("{ presence := "); single_value->field_presence.log_match(match_value.presence(), legacy); TTCN_Logger::log_event_str(", desc := "); if (match_value.desc().ispresent()) { single_value->field_desc.log_match(match_value.desc(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_desc.log(); if (single_value->field_desc.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 UTRAN__FDDDescOpt_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (presence().is_bound()) presence().set_implicit_omit(); if (!desc().is_bound()) desc() = OMIT_VALUE; else desc().set_implicit_omit(); } void UTRAN__FDDDescOpt_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_presence.encode_text(text_buf); single_value->field_desc.encode_text(text_buf); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @GSM_RestOctets.UTRAN_FDDDescOpt."); } } void UTRAN__FDDDescOpt_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_presence.decode_text(text_buf); single_value->field_desc.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 UTRAN__FDDDescOpt_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @GSM_RestOctets.UTRAN_FDDDescOpt."); } } void UTRAN__FDDDescOpt_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: { UTRAN__FDDDescOpt_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) presence().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) desc().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(), "presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.UTRAN_FDDDescOpt: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { UTRAN__FDDDescOpt_template* precondition = new UTRAN__FDDDescOpt_template; precondition->set_param(*param.get_elem(0)); UTRAN__FDDDescOpt_template* implied_template = new UTRAN__FDDDescOpt_template; implied_template->set_param(*param.get_elem(1)); *this = UTRAN__FDDDescOpt_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.UTRAN_FDDDescOpt"); } is_ifpresent = param.get_ifpresent(); } void UTRAN__FDDDescOpt_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_presence.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.UTRAN_FDDDescOpt"); single_value->field_desc.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.UTRAN_FDDDescOpt"); return; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@GSM_RestOctets.UTRAN_FDDDescOpt"); } boolean UTRAN__FDDDescOpt_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean UTRAN__FDDDescOpt_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_desc) : field_presence(par_presence), field_desc(par_desc) { } UTRAN__TDDDescOpt::UTRAN__TDDDescOpt(const UTRAN__TDDDescOpt& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.UTRAN_TDDDescOpt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.desc().is_bound()) field_desc = other_value.desc(); else field_desc.clean_up(); } void UTRAN__TDDDescOpt::clean_up() { field_presence.clean_up(); field_desc.clean_up(); } const TTCN_Typedescriptor_t* UTRAN__TDDDescOpt::get_descriptor() const { return &UTRAN__TDDDescOpt_descr_; } UTRAN__TDDDescOpt& UTRAN__TDDDescOpt::operator=(const UTRAN__TDDDescOpt& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.UTRAN_TDDDescOpt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.desc().is_bound()) field_desc = other_value.desc(); else field_desc.clean_up(); } return *this; } boolean UTRAN__TDDDescOpt::operator==(const UTRAN__TDDDescOpt& other_value) const { return field_presence==other_value.field_presence && field_desc==other_value.field_desc; } boolean UTRAN__TDDDescOpt::is_bound() const { return (field_presence.is_bound()) || (OPTIONAL_OMIT == field_desc.get_selection() || field_desc.is_bound()); } boolean UTRAN__TDDDescOpt::is_value() const { return field_presence.is_value() && (OPTIONAL_OMIT == field_desc.get_selection() || field_desc.is_value()); } int UTRAN__TDDDescOpt::size_of() const { int ret_val = 1; if (field_desc.ispresent()) ret_val++; return ret_val; } void UTRAN__TDDDescOpt::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ presence := "); field_presence.log(); TTCN_Logger::log_event_str(", desc := "); field_desc.log(); TTCN_Logger::log_event_str(" }"); } void UTRAN__TDDDescOpt::set_implicit_omit() { if (presence().is_bound()) presence().set_implicit_omit(); if (!desc().is_bound()) desc() = OMIT_VALUE; else desc().set_implicit_omit(); } void UTRAN__TDDDescOpt::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) presence().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) desc().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(), "presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.UTRAN_TDDDescOpt: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.UTRAN_TDDDescOpt"); } } void UTRAN__TDDDescOpt::encode_text(Text_Buf& text_buf) const { field_presence.encode_text(text_buf); field_desc.encode_text(text_buf); } void UTRAN__TDDDescOpt::decode_text(Text_Buf& text_buf) { field_presence.decode_text(text_buf); field_desc.decode_text(text_buf); } void UTRAN__TDDDescOpt::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name); if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); PER_encode(p_td, p_buf, opt); break; } default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void UTRAN__TDDDescOpt::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name); if(!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); try { PER_decode(p_td, p_buf, opt); p_buf.PER_octet_align(FALSE); } catch (PER_Buffer_Exception) { } break; } default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int UTRAN__TDDDescOpt::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, UTRAN__TDDDescOpt_presence_descr_.raw->forceomit); decoded_field_length = field_presence.RAW_decode(UTRAN__TDDDescOpt_presence_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); if (limit > 0 && field_presence == bs_0){ if (force_omit != NULL && (*force_omit)(1)) { field_desc = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_1_force_omit(1, force_omit, UTRAN__TDDDescOpt_desc_descr_.raw->forceomit); decoded_field_length = field_desc().RAW_decode(UTRAN__TDDDescOpt_desc_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 1) { field_desc = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } else field_desc=OMIT_VALUE; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int UTRAN__TDDDescOpt::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, UTRAN__TDDDescOpt_presence_descr_.raw); if (field_desc.ispresent()) { myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, UTRAN__TDDDescOpt_desc_descr_.raw); } else myleaf.body.node.nodes[1] = NULL; encoded_length += field_presence.RAW_encode(UTRAN__TDDDescOpt_presence_descr_, *myleaf.body.node.nodes[0]); if (field_desc.ispresent()) { encoded_length += field_desc().RAW_encode(UTRAN__TDDDescOpt_desc_descr_, *myleaf.body.node.nodes[1]); } if (field_desc.ispresent() && (field_presence != bs_0)) { 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){ bs_0.RAW_encode(UTRAN__TDDDescOpt_presence_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 UTRAN__TDDDescOpt_template::single_value_struct { BITSTRING_template field_presence; BITSTRING_template field_desc; }; void UTRAN__TDDDescOpt_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_presence = ANY_VALUE; single_value->field_desc = ANY_OR_OMIT; } } } void UTRAN__TDDDescOpt_template::copy_value(const UTRAN__TDDDescOpt& other_value) { single_value = new single_value_struct; if (other_value.presence().is_bound()) { single_value->field_presence = other_value.presence(); } else { single_value->field_presence.clean_up(); } if (other_value.desc().is_bound()) { if (other_value.desc().ispresent()) single_value->field_desc = other_value.desc()(); else single_value->field_desc = OMIT_VALUE; } else { single_value->field_desc.clean_up(); } set_selection(SPECIFIC_VALUE); } void UTRAN__TDDDescOpt_template::copy_template(const UTRAN__TDDDescOpt_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.presence().get_selection()) { single_value->field_presence = other_value.presence(); } else { single_value->field_presence.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.desc().get_selection()) { single_value->field_desc = other_value.desc(); } else { single_value->field_desc.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 UTRAN__TDDDescOpt_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 UTRAN__TDDDescOpt_template(*other_value.implication_.precondition); implication_.implied_template = new UTRAN__TDDDescOpt_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of type @GSM_RestOctets.UTRAN_TDDDescOpt."); break; } set_selection(other_value); } UTRAN__TDDDescOpt_template::UTRAN__TDDDescOpt_template() { } UTRAN__TDDDescOpt_template::UTRAN__TDDDescOpt_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } UTRAN__TDDDescOpt_template::UTRAN__TDDDescOpt_template(const UTRAN__TDDDescOpt& other_value) { copy_value(other_value); } UTRAN__TDDDescOpt_template::UTRAN__TDDDescOpt_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const UTRAN__TDDDescOpt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.UTRAN_TDDDescOpt from an unbound optional field."); } } UTRAN__TDDDescOpt_template::UTRAN__TDDDescOpt_template(UTRAN__TDDDescOpt_template* p_precondition, UTRAN__TDDDescOpt_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } UTRAN__TDDDescOpt_template::UTRAN__TDDDescOpt_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; } UTRAN__TDDDescOpt_template::UTRAN__TDDDescOpt_template(const UTRAN__TDDDescOpt_template& other_value) : Base_Template() { copy_template(other_value); } UTRAN__TDDDescOpt_template::~UTRAN__TDDDescOpt_template() { clean_up(); } UTRAN__TDDDescOpt_template& UTRAN__TDDDescOpt_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } UTRAN__TDDDescOpt_template& UTRAN__TDDDescOpt_template::operator=(const UTRAN__TDDDescOpt& other_value) { clean_up(); copy_value(other_value); return *this; } UTRAN__TDDDescOpt_template& UTRAN__TDDDescOpt_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const UTRAN__TDDDescOpt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @GSM_RestOctets.UTRAN_TDDDescOpt."); } return *this; } UTRAN__TDDDescOpt_template& UTRAN__TDDDescOpt_template::operator=(const UTRAN__TDDDescOpt_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean UTRAN__TDDDescOpt_template::match(const UTRAN__TDDDescOpt& 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.presence().is_bound()) return FALSE; if(!single_value->field_presence.match(other_value.presence(), legacy))return FALSE; if(!other_value.desc().is_bound()) return FALSE; if((other_value.desc().ispresent() ? !single_value->field_desc.match((const BITSTRING&)other_value.desc(), legacy) : !single_value->field_desc.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 @GSM_RestOctets.UTRAN_TDDDescOpt."); } return FALSE; } boolean UTRAN__TDDDescOpt_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_presence.is_bound() || (single_value->field_desc.is_omit() || single_value->field_desc.is_bound()); } boolean UTRAN__TDDDescOpt_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_presence.is_value() && (single_value->field_desc.is_omit() || single_value->field_desc.is_value()); } void UTRAN__TDDDescOpt_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; } UTRAN__TDDDescOpt UTRAN__TDDDescOpt_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @GSM_RestOctets.UTRAN_TDDDescOpt."); UTRAN__TDDDescOpt ret_val; if (single_value->field_presence.is_bound()) { ret_val.presence() = single_value->field_presence.valueof(); } if (single_value->field_desc.is_omit()) ret_val.desc() = OMIT_VALUE; else if (single_value->field_desc.is_bound()) { ret_val.desc() = single_value->field_desc.valueof(); } return ret_val; } void UTRAN__TDDDescOpt_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list for a template of type @GSM_RestOctets.UTRAN_TDDDescOpt."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new UTRAN__TDDDescOpt_template[list_length]; } UTRAN__TDDDescOpt_template& UTRAN__TDDDescOpt_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element of a non-list template of type @GSM_RestOctets.UTRAN_TDDDescOpt."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.UTRAN_TDDDescOpt."); return value_list.list_value[list_index]; } BITSTRING_template& UTRAN__TDDDescOpt_template::presence() { set_specific(); return single_value->field_presence; } const BITSTRING_template& UTRAN__TDDDescOpt_template::presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field presence of a non-specific template of type @GSM_RestOctets.UTRAN_TDDDescOpt."); return single_value->field_presence; } BITSTRING_template& UTRAN__TDDDescOpt_template::desc() { set_specific(); return single_value->field_desc; } const BITSTRING_template& UTRAN__TDDDescOpt_template::desc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field desc of a non-specific template of type @GSM_RestOctets.UTRAN_TDDDescOpt."); return single_value->field_desc; } int UTRAN__TDDDescOpt_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_TDDDescOpt which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 1; if (single_value->field_desc.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 @GSM_RestOctets.UTRAN_TDDDescOpt containing an empty list."); int item_size = value_list.list_value[0].size_of(); for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++) { if (value_list.list_value[l_idx].size_of()!=item_size) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_TDDDescOpt containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_TDDDescOpt containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_TDDDescOpt containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_TDDDescOpt containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_TDDDescOpt containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_TDDDescOpt containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_TDDDescOpt containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.UTRAN_TDDDescOpt."); } return 0; } void UTRAN__TDDDescOpt_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ presence := "); single_value->field_presence.log(); TTCN_Logger::log_event_str(", desc := "); single_value->field_desc.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 UTRAN__TDDDescOpt_template::log_match(const UTRAN__TDDDescOpt& 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_presence.match(match_value.presence(), legacy)){ TTCN_Logger::log_logmatch_info(".presence"); single_value->field_presence.log_match(match_value.presence(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.desc().ispresent()){ if(!single_value->field_desc.match(match_value.desc(), legacy)){ TTCN_Logger::log_logmatch_info(".desc"); single_value->field_desc.log_match(match_value.desc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_desc.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".desc := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_desc.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("{ presence := "); single_value->field_presence.log_match(match_value.presence(), legacy); TTCN_Logger::log_event_str(", desc := "); if (match_value.desc().ispresent()) { single_value->field_desc.log_match(match_value.desc(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_desc.log(); if (single_value->field_desc.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 UTRAN__TDDDescOpt_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (presence().is_bound()) presence().set_implicit_omit(); if (!desc().is_bound()) desc() = OMIT_VALUE; else desc().set_implicit_omit(); } void UTRAN__TDDDescOpt_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_presence.encode_text(text_buf); single_value->field_desc.encode_text(text_buf); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @GSM_RestOctets.UTRAN_TDDDescOpt."); } } void UTRAN__TDDDescOpt_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_presence.decode_text(text_buf); single_value->field_desc.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 UTRAN__TDDDescOpt_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @GSM_RestOctets.UTRAN_TDDDescOpt."); } } void UTRAN__TDDDescOpt_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: { UTRAN__TDDDescOpt_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) presence().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) desc().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(), "presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.UTRAN_TDDDescOpt: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { UTRAN__TDDDescOpt_template* precondition = new UTRAN__TDDDescOpt_template; precondition->set_param(*param.get_elem(0)); UTRAN__TDDDescOpt_template* implied_template = new UTRAN__TDDDescOpt_template; implied_template->set_param(*param.get_elem(1)); *this = UTRAN__TDDDescOpt_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.UTRAN_TDDDescOpt"); } is_ifpresent = param.get_ifpresent(); } void UTRAN__TDDDescOpt_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_presence.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.UTRAN_TDDDescOpt"); single_value->field_desc.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.UTRAN_TDDDescOpt"); return; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@GSM_RestOctets.UTRAN_TDDDescOpt"); } boolean UTRAN__TDDDescOpt_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean UTRAN__TDDDescOpt_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_idx__start__3g, const BITSTRING& par_abs__idx__start__emr__presence, const OPTIONAL< INTEGER >& par_abs__idx__start__emr, const UTRAN__FDDDescOpt& par_fdd__desc, const UTRAN__TDDDescOpt& par_tdd__desc) : field_idx__start__3g__presence(par_idx__start__3g__presence), field_idx__start__3g(par_idx__start__3g), field_abs__idx__start__emr__presence(par_abs__idx__start__emr__presence), field_abs__idx__start__emr(par_abs__idx__start__emr), field_fdd__desc(par_fdd__desc), field_tdd__desc(par_tdd__desc) { } UTRAN__NeighDesc::UTRAN__NeighDesc(const UTRAN__NeighDesc& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.UTRAN_NeighDesc."); if (other_value.idx__start__3g__presence().is_bound()) field_idx__start__3g__presence = other_value.idx__start__3g__presence(); else field_idx__start__3g__presence.clean_up(); if (other_value.idx__start__3g().is_bound()) field_idx__start__3g = other_value.idx__start__3g(); else field_idx__start__3g.clean_up(); if (other_value.abs__idx__start__emr__presence().is_bound()) field_abs__idx__start__emr__presence = other_value.abs__idx__start__emr__presence(); else field_abs__idx__start__emr__presence.clean_up(); if (other_value.abs__idx__start__emr().is_bound()) field_abs__idx__start__emr = other_value.abs__idx__start__emr(); else field_abs__idx__start__emr.clean_up(); if (other_value.fdd__desc().is_bound()) field_fdd__desc = other_value.fdd__desc(); else field_fdd__desc.clean_up(); if (other_value.tdd__desc().is_bound()) field_tdd__desc = other_value.tdd__desc(); else field_tdd__desc.clean_up(); } void UTRAN__NeighDesc::clean_up() { field_idx__start__3g__presence.clean_up(); field_idx__start__3g.clean_up(); field_abs__idx__start__emr__presence.clean_up(); field_abs__idx__start__emr.clean_up(); field_fdd__desc.clean_up(); field_tdd__desc.clean_up(); } const TTCN_Typedescriptor_t* UTRAN__NeighDesc::get_descriptor() const { return &UTRAN__NeighDesc_descr_; } UTRAN__NeighDesc& UTRAN__NeighDesc::operator=(const UTRAN__NeighDesc& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.UTRAN_NeighDesc."); if (other_value.idx__start__3g__presence().is_bound()) field_idx__start__3g__presence = other_value.idx__start__3g__presence(); else field_idx__start__3g__presence.clean_up(); if (other_value.idx__start__3g().is_bound()) field_idx__start__3g = other_value.idx__start__3g(); else field_idx__start__3g.clean_up(); if (other_value.abs__idx__start__emr__presence().is_bound()) field_abs__idx__start__emr__presence = other_value.abs__idx__start__emr__presence(); else field_abs__idx__start__emr__presence.clean_up(); if (other_value.abs__idx__start__emr().is_bound()) field_abs__idx__start__emr = other_value.abs__idx__start__emr(); else field_abs__idx__start__emr.clean_up(); if (other_value.fdd__desc().is_bound()) field_fdd__desc = other_value.fdd__desc(); else field_fdd__desc.clean_up(); if (other_value.tdd__desc().is_bound()) field_tdd__desc = other_value.tdd__desc(); else field_tdd__desc.clean_up(); } return *this; } boolean UTRAN__NeighDesc::operator==(const UTRAN__NeighDesc& other_value) const { return field_idx__start__3g__presence==other_value.field_idx__start__3g__presence && field_idx__start__3g==other_value.field_idx__start__3g && field_abs__idx__start__emr__presence==other_value.field_abs__idx__start__emr__presence && field_abs__idx__start__emr==other_value.field_abs__idx__start__emr && field_fdd__desc==other_value.field_fdd__desc && field_tdd__desc==other_value.field_tdd__desc; } boolean UTRAN__NeighDesc::is_bound() const { return (field_idx__start__3g__presence.is_bound()) || (OPTIONAL_OMIT == field_idx__start__3g.get_selection() || field_idx__start__3g.is_bound()) || (field_abs__idx__start__emr__presence.is_bound()) || (OPTIONAL_OMIT == field_abs__idx__start__emr.get_selection() || field_abs__idx__start__emr.is_bound()) || (field_fdd__desc.is_bound()) || (field_tdd__desc.is_bound()); } boolean UTRAN__NeighDesc::is_value() const { return field_idx__start__3g__presence.is_value() && (OPTIONAL_OMIT == field_idx__start__3g.get_selection() || field_idx__start__3g.is_value()) && field_abs__idx__start__emr__presence.is_value() && (OPTIONAL_OMIT == field_abs__idx__start__emr.get_selection() || field_abs__idx__start__emr.is_value()) && field_fdd__desc.is_value() && field_tdd__desc.is_value(); } int UTRAN__NeighDesc::size_of() const { int ret_val = 4; if (field_idx__start__3g.ispresent()) ret_val++; if (field_abs__idx__start__emr.ispresent()) ret_val++; return ret_val; } void UTRAN__NeighDesc::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ idx_start_3g_presence := "); field_idx__start__3g__presence.log(); TTCN_Logger::log_event_str(", idx_start_3g := "); field_idx__start__3g.log(); TTCN_Logger::log_event_str(", abs_idx_start_emr_presence := "); field_abs__idx__start__emr__presence.log(); TTCN_Logger::log_event_str(", abs_idx_start_emr := "); field_abs__idx__start__emr.log(); TTCN_Logger::log_event_str(", fdd_desc := "); field_fdd__desc.log(); TTCN_Logger::log_event_str(", tdd_desc := "); field_tdd__desc.log(); TTCN_Logger::log_event_str(" }"); } void UTRAN__NeighDesc::set_implicit_omit() { if (idx__start__3g__presence().is_bound()) idx__start__3g__presence().set_implicit_omit(); if (!idx__start__3g().is_bound()) idx__start__3g() = OMIT_VALUE; else idx__start__3g().set_implicit_omit(); if (abs__idx__start__emr__presence().is_bound()) abs__idx__start__emr__presence().set_implicit_omit(); if (!abs__idx__start__emr().is_bound()) abs__idx__start__emr() = OMIT_VALUE; else abs__idx__start__emr().set_implicit_omit(); if (fdd__desc().is_bound()) fdd__desc().set_implicit_omit(); if (tdd__desc().is_bound()) tdd__desc().set_implicit_omit(); } void UTRAN__NeighDesc::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) idx__start__3g__presence().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) idx__start__3g().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) abs__idx__start__emr__presence().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) abs__idx__start__emr().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) fdd__desc().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) tdd__desc().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(), "idx_start_3g_presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { idx__start__3g__presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "idx_start_3g")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { idx__start__3g().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "abs_idx_start_emr_presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { abs__idx__start__emr__presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "abs_idx_start_emr")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { abs__idx__start__emr().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "fdd_desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { fdd__desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "tdd_desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { tdd__desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.UTRAN_NeighDesc: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.UTRAN_NeighDesc"); } } void UTRAN__NeighDesc::encode_text(Text_Buf& text_buf) const { field_idx__start__3g__presence.encode_text(text_buf); field_idx__start__3g.encode_text(text_buf); field_abs__idx__start__emr__presence.encode_text(text_buf); field_abs__idx__start__emr.encode_text(text_buf); field_fdd__desc.encode_text(text_buf); field_tdd__desc.encode_text(text_buf); } void UTRAN__NeighDesc::decode_text(Text_Buf& text_buf) { field_idx__start__3g__presence.decode_text(text_buf); field_idx__start__3g.decode_text(text_buf); field_abs__idx__start__emr__presence.decode_text(text_buf); field_abs__idx__start__emr.decode_text(text_buf); field_fdd__desc.decode_text(text_buf); field_tdd__desc.decode_text(text_buf); } void UTRAN__NeighDesc::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name); if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); PER_encode(p_td, p_buf, opt); break; } default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void UTRAN__NeighDesc::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name); if(!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); try { PER_decode(p_td, p_buf, opt); p_buf.PER_octet_align(FALSE); } catch (PER_Buffer_Exception) { } break; } default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int UTRAN__NeighDesc::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, UTRAN__NeighDesc_idx__start__3g__presence_descr_.raw->forceomit); decoded_field_length = field_idx__start__3g__presence.RAW_decode(UTRAN__NeighDesc_idx__start__3g__presence_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); if (limit > 0 && field_idx__start__3g__presence == bs_0){ if (force_omit != NULL && (*force_omit)(1)) { field_idx__start__3g = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_1_force_omit(1, force_omit, UTRAN__NeighDesc_idx__start__3g_descr_.raw->forceomit); decoded_field_length = field_idx__start__3g().RAW_decode(UTRAN__NeighDesc_idx__start__3g_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 1) { field_idx__start__3g = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } else field_idx__start__3g=OMIT_VALUE; RAW_Force_Omit field_2_force_omit(2, force_omit, UTRAN__NeighDesc_abs__idx__start__emr__presence_descr_.raw->forceomit); decoded_field_length = field_abs__idx__start__emr__presence.RAW_decode(UTRAN__NeighDesc_abs__idx__start__emr__presence_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_2_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); if (limit > 0 && field_abs__idx__start__emr__presence == bs_0){ if (force_omit != NULL && (*force_omit)(3)) { field_abs__idx__start__emr = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_3_force_omit(3, force_omit, UTRAN__NeighDesc_abs__idx__start__emr_descr_.raw->forceomit); decoded_field_length = field_abs__idx__start__emr().RAW_decode(UTRAN__NeighDesc_abs__idx__start__emr_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_3_force_omit); if (decoded_field_length < 1) { field_abs__idx__start__emr = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } else field_abs__idx__start__emr=OMIT_VALUE; RAW_Force_Omit field_4_force_omit(4, force_omit, UTRAN__NeighDesc_fdd__desc_descr_.raw->forceomit); decoded_field_length = field_fdd__desc.RAW_decode(UTRAN__NeighDesc_fdd__desc_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, UTRAN__NeighDesc_tdd__desc_descr_.raw->forceomit); decoded_field_length = field_tdd__desc.RAW_decode(UTRAN__NeighDesc_tdd__desc_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()); p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int UTRAN__NeighDesc::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, UTRAN__NeighDesc_idx__start__3g__presence_descr_.raw); if (field_idx__start__3g.ispresent()) { myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, UTRAN__NeighDesc_idx__start__3g_descr_.raw); } else myleaf.body.node.nodes[1] = NULL; myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, UTRAN__NeighDesc_abs__idx__start__emr__presence_descr_.raw); if (field_abs__idx__start__emr.ispresent()) { myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, UTRAN__NeighDesc_abs__idx__start__emr_descr_.raw); } else myleaf.body.node.nodes[3] = NULL; myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, UTRAN__NeighDesc_fdd__desc_descr_.raw); myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, UTRAN__NeighDesc_tdd__desc_descr_.raw); encoded_length += field_idx__start__3g__presence.RAW_encode(UTRAN__NeighDesc_idx__start__3g__presence_descr_, *myleaf.body.node.nodes[0]); if (field_idx__start__3g.ispresent()) { encoded_length += field_idx__start__3g().RAW_encode(UTRAN__NeighDesc_idx__start__3g_descr_, *myleaf.body.node.nodes[1]); } encoded_length += field_abs__idx__start__emr__presence.RAW_encode(UTRAN__NeighDesc_abs__idx__start__emr__presence_descr_, *myleaf.body.node.nodes[2]); if (field_abs__idx__start__emr.ispresent()) { encoded_length += field_abs__idx__start__emr().RAW_encode(UTRAN__NeighDesc_abs__idx__start__emr_descr_, *myleaf.body.node.nodes[3]); } encoded_length += field_fdd__desc.RAW_encode(UTRAN__NeighDesc_fdd__desc_descr_, *myleaf.body.node.nodes[4]); encoded_length += field_tdd__desc.RAW_encode(UTRAN__NeighDesc_tdd__desc_descr_, *myleaf.body.node.nodes[5]); if (field_idx__start__3g.ispresent() && (field_idx__start__3g__presence != bs_0)) { 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){ bs_0.RAW_encode(UTRAN__NeighDesc_idx__start__3g__presence_descr_,*temp_leaf); } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value."); } free_tree_pos(pr_pos0.pos); } } if (field_abs__idx__start__emr.ispresent() && (field_abs__idx__start__emr__presence != bs_0)) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={2}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ bs_0.RAW_encode(UTRAN__NeighDesc_abs__idx__start__emr__presence_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 UTRAN__NeighDesc_template::single_value_struct { BITSTRING_template field_idx__start__3g__presence; INTEGER_template field_idx__start__3g; BITSTRING_template field_abs__idx__start__emr__presence; INTEGER_template field_abs__idx__start__emr; UTRAN__FDDDescOpt_template field_fdd__desc; UTRAN__TDDDescOpt_template field_tdd__desc; }; void UTRAN__NeighDesc_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_idx__start__3g__presence = ANY_VALUE; single_value->field_idx__start__3g = ANY_OR_OMIT; single_value->field_abs__idx__start__emr__presence = ANY_VALUE; single_value->field_abs__idx__start__emr = ANY_OR_OMIT; single_value->field_fdd__desc = ANY_VALUE; single_value->field_tdd__desc = ANY_VALUE; } } } void UTRAN__NeighDesc_template::copy_value(const UTRAN__NeighDesc& other_value) { single_value = new single_value_struct; if (other_value.idx__start__3g__presence().is_bound()) { single_value->field_idx__start__3g__presence = other_value.idx__start__3g__presence(); } else { single_value->field_idx__start__3g__presence.clean_up(); } if (other_value.idx__start__3g().is_bound()) { if (other_value.idx__start__3g().ispresent()) single_value->field_idx__start__3g = other_value.idx__start__3g()(); else single_value->field_idx__start__3g = OMIT_VALUE; } else { single_value->field_idx__start__3g.clean_up(); } if (other_value.abs__idx__start__emr__presence().is_bound()) { single_value->field_abs__idx__start__emr__presence = other_value.abs__idx__start__emr__presence(); } else { single_value->field_abs__idx__start__emr__presence.clean_up(); } if (other_value.abs__idx__start__emr().is_bound()) { if (other_value.abs__idx__start__emr().ispresent()) single_value->field_abs__idx__start__emr = other_value.abs__idx__start__emr()(); else single_value->field_abs__idx__start__emr = OMIT_VALUE; } else { single_value->field_abs__idx__start__emr.clean_up(); } if (other_value.fdd__desc().is_bound()) { single_value->field_fdd__desc = other_value.fdd__desc(); } else { single_value->field_fdd__desc.clean_up(); } if (other_value.tdd__desc().is_bound()) { single_value->field_tdd__desc = other_value.tdd__desc(); } else { single_value->field_tdd__desc.clean_up(); } set_selection(SPECIFIC_VALUE); } void UTRAN__NeighDesc_template::copy_template(const UTRAN__NeighDesc_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.idx__start__3g__presence().get_selection()) { single_value->field_idx__start__3g__presence = other_value.idx__start__3g__presence(); } else { single_value->field_idx__start__3g__presence.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.idx__start__3g().get_selection()) { single_value->field_idx__start__3g = other_value.idx__start__3g(); } else { single_value->field_idx__start__3g.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.abs__idx__start__emr__presence().get_selection()) { single_value->field_abs__idx__start__emr__presence = other_value.abs__idx__start__emr__presence(); } else { single_value->field_abs__idx__start__emr__presence.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.abs__idx__start__emr().get_selection()) { single_value->field_abs__idx__start__emr = other_value.abs__idx__start__emr(); } else { single_value->field_abs__idx__start__emr.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.fdd__desc().get_selection()) { single_value->field_fdd__desc = other_value.fdd__desc(); } else { single_value->field_fdd__desc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.tdd__desc().get_selection()) { single_value->field_tdd__desc = other_value.tdd__desc(); } else { single_value->field_tdd__desc.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 UTRAN__NeighDesc_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 UTRAN__NeighDesc_template(*other_value.implication_.precondition); implication_.implied_template = new UTRAN__NeighDesc_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of type @GSM_RestOctets.UTRAN_NeighDesc."); break; } set_selection(other_value); } UTRAN__NeighDesc_template::UTRAN__NeighDesc_template() { } UTRAN__NeighDesc_template::UTRAN__NeighDesc_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } UTRAN__NeighDesc_template::UTRAN__NeighDesc_template(const UTRAN__NeighDesc& other_value) { copy_value(other_value); } UTRAN__NeighDesc_template::UTRAN__NeighDesc_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const UTRAN__NeighDesc&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.UTRAN_NeighDesc from an unbound optional field."); } } UTRAN__NeighDesc_template::UTRAN__NeighDesc_template(UTRAN__NeighDesc_template* p_precondition, UTRAN__NeighDesc_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } UTRAN__NeighDesc_template::UTRAN__NeighDesc_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; } UTRAN__NeighDesc_template::UTRAN__NeighDesc_template(const UTRAN__NeighDesc_template& other_value) : Base_Template() { copy_template(other_value); } UTRAN__NeighDesc_template::~UTRAN__NeighDesc_template() { clean_up(); } UTRAN__NeighDesc_template& UTRAN__NeighDesc_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } UTRAN__NeighDesc_template& UTRAN__NeighDesc_template::operator=(const UTRAN__NeighDesc& other_value) { clean_up(); copy_value(other_value); return *this; } UTRAN__NeighDesc_template& UTRAN__NeighDesc_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const UTRAN__NeighDesc&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @GSM_RestOctets.UTRAN_NeighDesc."); } return *this; } UTRAN__NeighDesc_template& UTRAN__NeighDesc_template::operator=(const UTRAN__NeighDesc_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean UTRAN__NeighDesc_template::match(const UTRAN__NeighDesc& 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.idx__start__3g__presence().is_bound()) return FALSE; if(!single_value->field_idx__start__3g__presence.match(other_value.idx__start__3g__presence(), legacy))return FALSE; if(!other_value.idx__start__3g().is_bound()) return FALSE; if((other_value.idx__start__3g().ispresent() ? !single_value->field_idx__start__3g.match((const INTEGER&)other_value.idx__start__3g(), legacy) : !single_value->field_idx__start__3g.match_omit(legacy)))return FALSE; if(!other_value.abs__idx__start__emr__presence().is_bound()) return FALSE; if(!single_value->field_abs__idx__start__emr__presence.match(other_value.abs__idx__start__emr__presence(), legacy))return FALSE; if(!other_value.abs__idx__start__emr().is_bound()) return FALSE; if((other_value.abs__idx__start__emr().ispresent() ? !single_value->field_abs__idx__start__emr.match((const INTEGER&)other_value.abs__idx__start__emr(), legacy) : !single_value->field_abs__idx__start__emr.match_omit(legacy)))return FALSE; if(!other_value.fdd__desc().is_bound()) return FALSE; if(!single_value->field_fdd__desc.match(other_value.fdd__desc(), legacy))return FALSE; if(!other_value.tdd__desc().is_bound()) return FALSE; if(!single_value->field_tdd__desc.match(other_value.tdd__desc(), legacy))return FALSE; return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of type @GSM_RestOctets.UTRAN_NeighDesc."); } return FALSE; } boolean UTRAN__NeighDesc_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_idx__start__3g__presence.is_bound() || (single_value->field_idx__start__3g.is_omit() || single_value->field_idx__start__3g.is_bound()) || single_value->field_abs__idx__start__emr__presence.is_bound() || (single_value->field_abs__idx__start__emr.is_omit() || single_value->field_abs__idx__start__emr.is_bound()) || single_value->field_fdd__desc.is_bound() || single_value->field_tdd__desc.is_bound(); } boolean UTRAN__NeighDesc_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_idx__start__3g__presence.is_value() && (single_value->field_idx__start__3g.is_omit() || single_value->field_idx__start__3g.is_value()) && single_value->field_abs__idx__start__emr__presence.is_value() && (single_value->field_abs__idx__start__emr.is_omit() || single_value->field_abs__idx__start__emr.is_value()) && single_value->field_fdd__desc.is_value() && single_value->field_tdd__desc.is_value(); } void UTRAN__NeighDesc_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; } UTRAN__NeighDesc UTRAN__NeighDesc_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @GSM_RestOctets.UTRAN_NeighDesc."); UTRAN__NeighDesc ret_val; if (single_value->field_idx__start__3g__presence.is_bound()) { ret_val.idx__start__3g__presence() = single_value->field_idx__start__3g__presence.valueof(); } if (single_value->field_idx__start__3g.is_omit()) ret_val.idx__start__3g() = OMIT_VALUE; else if (single_value->field_idx__start__3g.is_bound()) { ret_val.idx__start__3g() = single_value->field_idx__start__3g.valueof(); } if (single_value->field_abs__idx__start__emr__presence.is_bound()) { ret_val.abs__idx__start__emr__presence() = single_value->field_abs__idx__start__emr__presence.valueof(); } if (single_value->field_abs__idx__start__emr.is_omit()) ret_val.abs__idx__start__emr() = OMIT_VALUE; else if (single_value->field_abs__idx__start__emr.is_bound()) { ret_val.abs__idx__start__emr() = single_value->field_abs__idx__start__emr.valueof(); } if (single_value->field_fdd__desc.is_bound()) { ret_val.fdd__desc() = single_value->field_fdd__desc.valueof(); } if (single_value->field_tdd__desc.is_bound()) { ret_val.tdd__desc() = single_value->field_tdd__desc.valueof(); } return ret_val; } void UTRAN__NeighDesc_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list for a template of type @GSM_RestOctets.UTRAN_NeighDesc."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new UTRAN__NeighDesc_template[list_length]; } UTRAN__NeighDesc_template& UTRAN__NeighDesc_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element of a non-list template of type @GSM_RestOctets.UTRAN_NeighDesc."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.UTRAN_NeighDesc."); return value_list.list_value[list_index]; } BITSTRING_template& UTRAN__NeighDesc_template::idx__start__3g__presence() { set_specific(); return single_value->field_idx__start__3g__presence; } const BITSTRING_template& UTRAN__NeighDesc_template::idx__start__3g__presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field idx_start_3g_presence of a non-specific template of type @GSM_RestOctets.UTRAN_NeighDesc."); return single_value->field_idx__start__3g__presence; } INTEGER_template& UTRAN__NeighDesc_template::idx__start__3g() { set_specific(); return single_value->field_idx__start__3g; } const INTEGER_template& UTRAN__NeighDesc_template::idx__start__3g() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field idx_start_3g of a non-specific template of type @GSM_RestOctets.UTRAN_NeighDesc."); return single_value->field_idx__start__3g; } BITSTRING_template& UTRAN__NeighDesc_template::abs__idx__start__emr__presence() { set_specific(); return single_value->field_abs__idx__start__emr__presence; } const BITSTRING_template& UTRAN__NeighDesc_template::abs__idx__start__emr__presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field abs_idx_start_emr_presence of a non-specific template of type @GSM_RestOctets.UTRAN_NeighDesc."); return single_value->field_abs__idx__start__emr__presence; } INTEGER_template& UTRAN__NeighDesc_template::abs__idx__start__emr() { set_specific(); return single_value->field_abs__idx__start__emr; } const INTEGER_template& UTRAN__NeighDesc_template::abs__idx__start__emr() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field abs_idx_start_emr of a non-specific template of type @GSM_RestOctets.UTRAN_NeighDesc."); return single_value->field_abs__idx__start__emr; } UTRAN__FDDDescOpt_template& UTRAN__NeighDesc_template::fdd__desc() { set_specific(); return single_value->field_fdd__desc; } const UTRAN__FDDDescOpt_template& UTRAN__NeighDesc_template::fdd__desc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field fdd_desc of a non-specific template of type @GSM_RestOctets.UTRAN_NeighDesc."); return single_value->field_fdd__desc; } UTRAN__TDDDescOpt_template& UTRAN__NeighDesc_template::tdd__desc() { set_specific(); return single_value->field_tdd__desc; } const UTRAN__TDDDescOpt_template& UTRAN__NeighDesc_template::tdd__desc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field tdd_desc of a non-specific template of type @GSM_RestOctets.UTRAN_NeighDesc."); return single_value->field_tdd__desc; } int UTRAN__NeighDesc_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_NeighDesc which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 4; if (single_value->field_idx__start__3g.is_present()) ret_val++; if (single_value->field_abs__idx__start__emr.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 @GSM_RestOctets.UTRAN_NeighDesc containing an empty list."); int item_size = value_list.list_value[0].size_of(); for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++) { if (value_list.list_value[l_idx].size_of()!=item_size) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_NeighDesc containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_NeighDesc containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_NeighDesc containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_NeighDesc containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_NeighDesc containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_NeighDesc containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_NeighDesc containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.UTRAN_NeighDesc."); } return 0; } void UTRAN__NeighDesc_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ idx_start_3g_presence := "); single_value->field_idx__start__3g__presence.log(); TTCN_Logger::log_event_str(", idx_start_3g := "); single_value->field_idx__start__3g.log(); TTCN_Logger::log_event_str(", abs_idx_start_emr_presence := "); single_value->field_abs__idx__start__emr__presence.log(); TTCN_Logger::log_event_str(", abs_idx_start_emr := "); single_value->field_abs__idx__start__emr.log(); TTCN_Logger::log_event_str(", fdd_desc := "); single_value->field_fdd__desc.log(); TTCN_Logger::log_event_str(", tdd_desc := "); single_value->field_tdd__desc.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 UTRAN__NeighDesc_template::log_match(const UTRAN__NeighDesc& 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_idx__start__3g__presence.match(match_value.idx__start__3g__presence(), legacy)){ TTCN_Logger::log_logmatch_info(".idx_start_3g_presence"); single_value->field_idx__start__3g__presence.log_match(match_value.idx__start__3g__presence(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.idx__start__3g().ispresent()){ if(!single_value->field_idx__start__3g.match(match_value.idx__start__3g(), legacy)){ TTCN_Logger::log_logmatch_info(".idx_start_3g"); single_value->field_idx__start__3g.log_match(match_value.idx__start__3g(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_idx__start__3g.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".idx_start_3g := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_idx__start__3g.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if(!single_value->field_abs__idx__start__emr__presence.match(match_value.abs__idx__start__emr__presence(), legacy)){ TTCN_Logger::log_logmatch_info(".abs_idx_start_emr_presence"); single_value->field_abs__idx__start__emr__presence.log_match(match_value.abs__idx__start__emr__presence(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.abs__idx__start__emr().ispresent()){ if(!single_value->field_abs__idx__start__emr.match(match_value.abs__idx__start__emr(), legacy)){ TTCN_Logger::log_logmatch_info(".abs_idx_start_emr"); single_value->field_abs__idx__start__emr.log_match(match_value.abs__idx__start__emr(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_abs__idx__start__emr.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".abs_idx_start_emr := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_abs__idx__start__emr.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if(!single_value->field_fdd__desc.match(match_value.fdd__desc(), legacy)){ TTCN_Logger::log_logmatch_info(".fdd_desc"); single_value->field_fdd__desc.log_match(match_value.fdd__desc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_tdd__desc.match(match_value.tdd__desc(), legacy)){ TTCN_Logger::log_logmatch_info(".tdd_desc"); single_value->field_tdd__desc.log_match(match_value.tdd__desc(), 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("{ idx_start_3g_presence := "); single_value->field_idx__start__3g__presence.log_match(match_value.idx__start__3g__presence(), legacy); TTCN_Logger::log_event_str(", idx_start_3g := "); if (match_value.idx__start__3g().ispresent()) { single_value->field_idx__start__3g.log_match(match_value.idx__start__3g(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_idx__start__3g.log(); if (single_value->field_idx__start__3g.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", abs_idx_start_emr_presence := "); single_value->field_abs__idx__start__emr__presence.log_match(match_value.abs__idx__start__emr__presence(), legacy); TTCN_Logger::log_event_str(", abs_idx_start_emr := "); if (match_value.abs__idx__start__emr().ispresent()) { single_value->field_abs__idx__start__emr.log_match(match_value.abs__idx__start__emr(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_abs__idx__start__emr.log(); if (single_value->field_abs__idx__start__emr.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", fdd_desc := "); single_value->field_fdd__desc.log_match(match_value.fdd__desc(), legacy); TTCN_Logger::log_event_str(", tdd_desc := "); single_value->field_tdd__desc.log_match(match_value.tdd__desc(), 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 UTRAN__NeighDesc_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (idx__start__3g__presence().is_bound()) idx__start__3g__presence().set_implicit_omit(); if (!idx__start__3g().is_bound()) idx__start__3g() = OMIT_VALUE; else idx__start__3g().set_implicit_omit(); if (abs__idx__start__emr__presence().is_bound()) abs__idx__start__emr__presence().set_implicit_omit(); if (!abs__idx__start__emr().is_bound()) abs__idx__start__emr() = OMIT_VALUE; else abs__idx__start__emr().set_implicit_omit(); if (fdd__desc().is_bound()) fdd__desc().set_implicit_omit(); if (tdd__desc().is_bound()) tdd__desc().set_implicit_omit(); } void UTRAN__NeighDesc_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_idx__start__3g__presence.encode_text(text_buf); single_value->field_idx__start__3g.encode_text(text_buf); single_value->field_abs__idx__start__emr__presence.encode_text(text_buf); single_value->field_abs__idx__start__emr.encode_text(text_buf); single_value->field_fdd__desc.encode_text(text_buf); single_value->field_tdd__desc.encode_text(text_buf); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @GSM_RestOctets.UTRAN_NeighDesc."); } } void UTRAN__NeighDesc_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_idx__start__3g__presence.decode_text(text_buf); single_value->field_idx__start__3g.decode_text(text_buf); single_value->field_abs__idx__start__emr__presence.decode_text(text_buf); single_value->field_abs__idx__start__emr.decode_text(text_buf); single_value->field_fdd__desc.decode_text(text_buf); single_value->field_tdd__desc.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 UTRAN__NeighDesc_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @GSM_RestOctets.UTRAN_NeighDesc."); } } void UTRAN__NeighDesc_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: { UTRAN__NeighDesc_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) idx__start__3g__presence().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) idx__start__3g().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) abs__idx__start__emr__presence().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) abs__idx__start__emr().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) fdd__desc().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) tdd__desc().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(), "idx_start_3g_presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { idx__start__3g__presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "idx_start_3g")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { idx__start__3g().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "abs_idx_start_emr_presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { abs__idx__start__emr__presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "abs_idx_start_emr")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { abs__idx__start__emr().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "fdd_desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { fdd__desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "tdd_desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { tdd__desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.UTRAN_NeighDesc: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { UTRAN__NeighDesc_template* precondition = new UTRAN__NeighDesc_template; precondition->set_param(*param.get_elem(0)); UTRAN__NeighDesc_template* implied_template = new UTRAN__NeighDesc_template; implied_template->set_param(*param.get_elem(1)); *this = UTRAN__NeighDesc_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.UTRAN_NeighDesc"); } is_ifpresent = param.get_ifpresent(); } void UTRAN__NeighDesc_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_idx__start__3g__presence.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.UTRAN_NeighDesc"); single_value->field_idx__start__3g.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.UTRAN_NeighDesc"); single_value->field_abs__idx__start__emr__presence.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.UTRAN_NeighDesc"); single_value->field_abs__idx__start__emr.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.UTRAN_NeighDesc"); single_value->field_fdd__desc.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.UTRAN_NeighDesc"); single_value->field_tdd__desc.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.UTRAN_NeighDesc"); return; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@GSM_RestOctets.UTRAN_NeighDesc"); } boolean UTRAN__NeighDesc_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean UTRAN__NeighDesc_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_desc) : field_presence(par_presence), field_desc(par_desc) { } UTRAN__MeasParamsDescOpt::UTRAN__MeasParamsDescOpt(const UTRAN__MeasParamsDescOpt& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.UTRAN_MeasParamsDescOpt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.desc().is_bound()) field_desc = other_value.desc(); else field_desc.clean_up(); } void UTRAN__MeasParamsDescOpt::clean_up() { field_presence.clean_up(); field_desc.clean_up(); } const TTCN_Typedescriptor_t* UTRAN__MeasParamsDescOpt::get_descriptor() const { return &UTRAN__MeasParamsDescOpt_descr_; } UTRAN__MeasParamsDescOpt& UTRAN__MeasParamsDescOpt::operator=(const UTRAN__MeasParamsDescOpt& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.UTRAN_MeasParamsDescOpt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.desc().is_bound()) field_desc = other_value.desc(); else field_desc.clean_up(); } return *this; } boolean UTRAN__MeasParamsDescOpt::operator==(const UTRAN__MeasParamsDescOpt& other_value) const { return field_presence==other_value.field_presence && field_desc==other_value.field_desc; } boolean UTRAN__MeasParamsDescOpt::is_bound() const { return (field_presence.is_bound()) || (OPTIONAL_OMIT == field_desc.get_selection() || field_desc.is_bound()); } boolean UTRAN__MeasParamsDescOpt::is_value() const { return field_presence.is_value() && (OPTIONAL_OMIT == field_desc.get_selection() || field_desc.is_value()); } int UTRAN__MeasParamsDescOpt::size_of() const { int ret_val = 1; if (field_desc.ispresent()) ret_val++; return ret_val; } void UTRAN__MeasParamsDescOpt::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ presence := "); field_presence.log(); TTCN_Logger::log_event_str(", desc := "); field_desc.log(); TTCN_Logger::log_event_str(" }"); } void UTRAN__MeasParamsDescOpt::set_implicit_omit() { if (presence().is_bound()) presence().set_implicit_omit(); if (!desc().is_bound()) desc() = OMIT_VALUE; else desc().set_implicit_omit(); } void UTRAN__MeasParamsDescOpt::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) presence().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) desc().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(), "presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.UTRAN_MeasParamsDescOpt: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.UTRAN_MeasParamsDescOpt"); } } void UTRAN__MeasParamsDescOpt::encode_text(Text_Buf& text_buf) const { field_presence.encode_text(text_buf); field_desc.encode_text(text_buf); } void UTRAN__MeasParamsDescOpt::decode_text(Text_Buf& text_buf) { field_presence.decode_text(text_buf); field_desc.decode_text(text_buf); } void UTRAN__MeasParamsDescOpt::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name); if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); PER_encode(p_td, p_buf, opt); break; } default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void UTRAN__MeasParamsDescOpt::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name); if(!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); try { PER_decode(p_td, p_buf, opt); p_buf.PER_octet_align(FALSE); } catch (PER_Buffer_Exception) { } break; } default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int UTRAN__MeasParamsDescOpt::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, UTRAN__MeasParamsDescOpt_presence_descr_.raw->forceomit); decoded_field_length = field_presence.RAW_decode(UTRAN__MeasParamsDescOpt_presence_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); if (limit > 0 && field_presence == bs_0){ if (force_omit != NULL && (*force_omit)(1)) { field_desc = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_1_force_omit(1, force_omit, UTRAN__MeasParamsDescOpt_desc_descr_.raw->forceomit); decoded_field_length = field_desc().RAW_decode(UTRAN__MeasParamsDescOpt_desc_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 1) { field_desc = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } else field_desc=OMIT_VALUE; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int UTRAN__MeasParamsDescOpt::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, UTRAN__MeasParamsDescOpt_presence_descr_.raw); if (field_desc.ispresent()) { myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, UTRAN__MeasParamsDescOpt_desc_descr_.raw); } else myleaf.body.node.nodes[1] = NULL; encoded_length += field_presence.RAW_encode(UTRAN__MeasParamsDescOpt_presence_descr_, *myleaf.body.node.nodes[0]); if (field_desc.ispresent()) { encoded_length += field_desc().RAW_encode(UTRAN__MeasParamsDescOpt_desc_descr_, *myleaf.body.node.nodes[1]); } if (field_desc.ispresent() && (field_presence != bs_0)) { 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){ bs_0.RAW_encode(UTRAN__MeasParamsDescOpt_presence_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 UTRAN__MeasParamsDescOpt_template::single_value_struct { BITSTRING_template field_presence; BITSTRING_template field_desc; }; void UTRAN__MeasParamsDescOpt_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_presence = ANY_VALUE; single_value->field_desc = ANY_OR_OMIT; } } } void UTRAN__MeasParamsDescOpt_template::copy_value(const UTRAN__MeasParamsDescOpt& other_value) { single_value = new single_value_struct; if (other_value.presence().is_bound()) { single_value->field_presence = other_value.presence(); } else { single_value->field_presence.clean_up(); } if (other_value.desc().is_bound()) { if (other_value.desc().ispresent()) single_value->field_desc = other_value.desc()(); else single_value->field_desc = OMIT_VALUE; } else { single_value->field_desc.clean_up(); } set_selection(SPECIFIC_VALUE); } void UTRAN__MeasParamsDescOpt_template::copy_template(const UTRAN__MeasParamsDescOpt_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.presence().get_selection()) { single_value->field_presence = other_value.presence(); } else { single_value->field_presence.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.desc().get_selection()) { single_value->field_desc = other_value.desc(); } else { single_value->field_desc.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 UTRAN__MeasParamsDescOpt_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 UTRAN__MeasParamsDescOpt_template(*other_value.implication_.precondition); implication_.implied_template = new UTRAN__MeasParamsDescOpt_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of type @GSM_RestOctets.UTRAN_MeasParamsDescOpt."); break; } set_selection(other_value); } UTRAN__MeasParamsDescOpt_template::UTRAN__MeasParamsDescOpt_template() { } UTRAN__MeasParamsDescOpt_template::UTRAN__MeasParamsDescOpt_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } UTRAN__MeasParamsDescOpt_template::UTRAN__MeasParamsDescOpt_template(const UTRAN__MeasParamsDescOpt& other_value) { copy_value(other_value); } UTRAN__MeasParamsDescOpt_template::UTRAN__MeasParamsDescOpt_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const UTRAN__MeasParamsDescOpt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.UTRAN_MeasParamsDescOpt from an unbound optional field."); } } UTRAN__MeasParamsDescOpt_template::UTRAN__MeasParamsDescOpt_template(UTRAN__MeasParamsDescOpt_template* p_precondition, UTRAN__MeasParamsDescOpt_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } UTRAN__MeasParamsDescOpt_template::UTRAN__MeasParamsDescOpt_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; } UTRAN__MeasParamsDescOpt_template::UTRAN__MeasParamsDescOpt_template(const UTRAN__MeasParamsDescOpt_template& other_value) : Base_Template() { copy_template(other_value); } UTRAN__MeasParamsDescOpt_template::~UTRAN__MeasParamsDescOpt_template() { clean_up(); } UTRAN__MeasParamsDescOpt_template& UTRAN__MeasParamsDescOpt_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } UTRAN__MeasParamsDescOpt_template& UTRAN__MeasParamsDescOpt_template::operator=(const UTRAN__MeasParamsDescOpt& other_value) { clean_up(); copy_value(other_value); return *this; } UTRAN__MeasParamsDescOpt_template& UTRAN__MeasParamsDescOpt_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const UTRAN__MeasParamsDescOpt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @GSM_RestOctets.UTRAN_MeasParamsDescOpt."); } return *this; } UTRAN__MeasParamsDescOpt_template& UTRAN__MeasParamsDescOpt_template::operator=(const UTRAN__MeasParamsDescOpt_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean UTRAN__MeasParamsDescOpt_template::match(const UTRAN__MeasParamsDescOpt& 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.presence().is_bound()) return FALSE; if(!single_value->field_presence.match(other_value.presence(), legacy))return FALSE; if(!other_value.desc().is_bound()) return FALSE; if((other_value.desc().ispresent() ? !single_value->field_desc.match((const BITSTRING&)other_value.desc(), legacy) : !single_value->field_desc.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 @GSM_RestOctets.UTRAN_MeasParamsDescOpt."); } return FALSE; } boolean UTRAN__MeasParamsDescOpt_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_presence.is_bound() || (single_value->field_desc.is_omit() || single_value->field_desc.is_bound()); } boolean UTRAN__MeasParamsDescOpt_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_presence.is_value() && (single_value->field_desc.is_omit() || single_value->field_desc.is_value()); } void UTRAN__MeasParamsDescOpt_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; } UTRAN__MeasParamsDescOpt UTRAN__MeasParamsDescOpt_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @GSM_RestOctets.UTRAN_MeasParamsDescOpt."); UTRAN__MeasParamsDescOpt ret_val; if (single_value->field_presence.is_bound()) { ret_val.presence() = single_value->field_presence.valueof(); } if (single_value->field_desc.is_omit()) ret_val.desc() = OMIT_VALUE; else if (single_value->field_desc.is_bound()) { ret_val.desc() = single_value->field_desc.valueof(); } return ret_val; } void UTRAN__MeasParamsDescOpt_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list for a template of type @GSM_RestOctets.UTRAN_MeasParamsDescOpt."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new UTRAN__MeasParamsDescOpt_template[list_length]; } UTRAN__MeasParamsDescOpt_template& UTRAN__MeasParamsDescOpt_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element of a non-list template of type @GSM_RestOctets.UTRAN_MeasParamsDescOpt."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.UTRAN_MeasParamsDescOpt."); return value_list.list_value[list_index]; } BITSTRING_template& UTRAN__MeasParamsDescOpt_template::presence() { set_specific(); return single_value->field_presence; } const BITSTRING_template& UTRAN__MeasParamsDescOpt_template::presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field presence of a non-specific template of type @GSM_RestOctets.UTRAN_MeasParamsDescOpt."); return single_value->field_presence; } BITSTRING_template& UTRAN__MeasParamsDescOpt_template::desc() { set_specific(); return single_value->field_desc; } const BITSTRING_template& UTRAN__MeasParamsDescOpt_template::desc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field desc of a non-specific template of type @GSM_RestOctets.UTRAN_MeasParamsDescOpt."); return single_value->field_desc; } int UTRAN__MeasParamsDescOpt_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_MeasParamsDescOpt which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 1; if (single_value->field_desc.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 @GSM_RestOctets.UTRAN_MeasParamsDescOpt containing an empty list."); int item_size = value_list.list_value[0].size_of(); for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++) { if (value_list.list_value[l_idx].size_of()!=item_size) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_MeasParamsDescOpt containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_MeasParamsDescOpt containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_MeasParamsDescOpt containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_MeasParamsDescOpt containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_MeasParamsDescOpt containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_MeasParamsDescOpt containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_MeasParamsDescOpt containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.UTRAN_MeasParamsDescOpt."); } return 0; } void UTRAN__MeasParamsDescOpt_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ presence := "); single_value->field_presence.log(); TTCN_Logger::log_event_str(", desc := "); single_value->field_desc.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 UTRAN__MeasParamsDescOpt_template::log_match(const UTRAN__MeasParamsDescOpt& 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_presence.match(match_value.presence(), legacy)){ TTCN_Logger::log_logmatch_info(".presence"); single_value->field_presence.log_match(match_value.presence(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.desc().ispresent()){ if(!single_value->field_desc.match(match_value.desc(), legacy)){ TTCN_Logger::log_logmatch_info(".desc"); single_value->field_desc.log_match(match_value.desc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_desc.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".desc := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_desc.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("{ presence := "); single_value->field_presence.log_match(match_value.presence(), legacy); TTCN_Logger::log_event_str(", desc := "); if (match_value.desc().ispresent()) { single_value->field_desc.log_match(match_value.desc(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_desc.log(); if (single_value->field_desc.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 UTRAN__MeasParamsDescOpt_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (presence().is_bound()) presence().set_implicit_omit(); if (!desc().is_bound()) desc() = OMIT_VALUE; else desc().set_implicit_omit(); } void UTRAN__MeasParamsDescOpt_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_presence.encode_text(text_buf); single_value->field_desc.encode_text(text_buf); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @GSM_RestOctets.UTRAN_MeasParamsDescOpt."); } } void UTRAN__MeasParamsDescOpt_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_presence.decode_text(text_buf); single_value->field_desc.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 UTRAN__MeasParamsDescOpt_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @GSM_RestOctets.UTRAN_MeasParamsDescOpt."); } } void UTRAN__MeasParamsDescOpt_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: { UTRAN__MeasParamsDescOpt_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) presence().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) desc().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(), "presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.UTRAN_MeasParamsDescOpt: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { UTRAN__MeasParamsDescOpt_template* precondition = new UTRAN__MeasParamsDescOpt_template; precondition->set_param(*param.get_elem(0)); UTRAN__MeasParamsDescOpt_template* implied_template = new UTRAN__MeasParamsDescOpt_template; implied_template->set_param(*param.get_elem(1)); *this = UTRAN__MeasParamsDescOpt_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.UTRAN_MeasParamsDescOpt"); } is_ifpresent = param.get_ifpresent(); } void UTRAN__MeasParamsDescOpt_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_presence.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.UTRAN_MeasParamsDescOpt"); single_value->field_desc.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.UTRAN_MeasParamsDescOpt"); return; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@GSM_RestOctets.UTRAN_MeasParamsDescOpt"); } boolean UTRAN__MeasParamsDescOpt_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean UTRAN__MeasParamsDescOpt_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_desc) : field_presence(par_presence), field_desc(par_desc) { } UTRAN__GPRSMeasParamsDescOpt::UTRAN__GPRSMeasParamsDescOpt(const UTRAN__GPRSMeasParamsDescOpt& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.UTRAN_GPRSMeasParamsDescOpt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.desc().is_bound()) field_desc = other_value.desc(); else field_desc.clean_up(); } void UTRAN__GPRSMeasParamsDescOpt::clean_up() { field_presence.clean_up(); field_desc.clean_up(); } const TTCN_Typedescriptor_t* UTRAN__GPRSMeasParamsDescOpt::get_descriptor() const { return &UTRAN__GPRSMeasParamsDescOpt_descr_; } UTRAN__GPRSMeasParamsDescOpt& UTRAN__GPRSMeasParamsDescOpt::operator=(const UTRAN__GPRSMeasParamsDescOpt& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.UTRAN_GPRSMeasParamsDescOpt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.desc().is_bound()) field_desc = other_value.desc(); else field_desc.clean_up(); } return *this; } boolean UTRAN__GPRSMeasParamsDescOpt::operator==(const UTRAN__GPRSMeasParamsDescOpt& other_value) const { return field_presence==other_value.field_presence && field_desc==other_value.field_desc; } boolean UTRAN__GPRSMeasParamsDescOpt::is_bound() const { return (field_presence.is_bound()) || (OPTIONAL_OMIT == field_desc.get_selection() || field_desc.is_bound()); } boolean UTRAN__GPRSMeasParamsDescOpt::is_value() const { return field_presence.is_value() && (OPTIONAL_OMIT == field_desc.get_selection() || field_desc.is_value()); } int UTRAN__GPRSMeasParamsDescOpt::size_of() const { int ret_val = 1; if (field_desc.ispresent()) ret_val++; return ret_val; } void UTRAN__GPRSMeasParamsDescOpt::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ presence := "); field_presence.log(); TTCN_Logger::log_event_str(", desc := "); field_desc.log(); TTCN_Logger::log_event_str(" }"); } void UTRAN__GPRSMeasParamsDescOpt::set_implicit_omit() { if (presence().is_bound()) presence().set_implicit_omit(); if (!desc().is_bound()) desc() = OMIT_VALUE; else desc().set_implicit_omit(); } void UTRAN__GPRSMeasParamsDescOpt::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) presence().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) desc().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(), "presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.UTRAN_GPRSMeasParamsDescOpt: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.UTRAN_GPRSMeasParamsDescOpt"); } } void UTRAN__GPRSMeasParamsDescOpt::encode_text(Text_Buf& text_buf) const { field_presence.encode_text(text_buf); field_desc.encode_text(text_buf); } void UTRAN__GPRSMeasParamsDescOpt::decode_text(Text_Buf& text_buf) { field_presence.decode_text(text_buf); field_desc.decode_text(text_buf); } void UTRAN__GPRSMeasParamsDescOpt::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name); if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); PER_encode(p_td, p_buf, opt); break; } default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void UTRAN__GPRSMeasParamsDescOpt::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name); if(!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); try { PER_decode(p_td, p_buf, opt); p_buf.PER_octet_align(FALSE); } catch (PER_Buffer_Exception) { } break; } default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int UTRAN__GPRSMeasParamsDescOpt::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, UTRAN__GPRSMeasParamsDescOpt_presence_descr_.raw->forceomit); decoded_field_length = field_presence.RAW_decode(UTRAN__GPRSMeasParamsDescOpt_presence_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); if (limit > 0 && field_presence == bs_0){ if (force_omit != NULL && (*force_omit)(1)) { field_desc = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_1_force_omit(1, force_omit, UTRAN__GPRSMeasParamsDescOpt_desc_descr_.raw->forceomit); decoded_field_length = field_desc().RAW_decode(UTRAN__GPRSMeasParamsDescOpt_desc_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 1) { field_desc = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } else field_desc=OMIT_VALUE; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int UTRAN__GPRSMeasParamsDescOpt::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, UTRAN__GPRSMeasParamsDescOpt_presence_descr_.raw); if (field_desc.ispresent()) { myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, UTRAN__GPRSMeasParamsDescOpt_desc_descr_.raw); } else myleaf.body.node.nodes[1] = NULL; encoded_length += field_presence.RAW_encode(UTRAN__GPRSMeasParamsDescOpt_presence_descr_, *myleaf.body.node.nodes[0]); if (field_desc.ispresent()) { encoded_length += field_desc().RAW_encode(UTRAN__GPRSMeasParamsDescOpt_desc_descr_, *myleaf.body.node.nodes[1]); } if (field_desc.ispresent() && (field_presence != bs_0)) { 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){ bs_0.RAW_encode(UTRAN__GPRSMeasParamsDescOpt_presence_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 UTRAN__GPRSMeasParamsDescOpt_template::single_value_struct { BITSTRING_template field_presence; BITSTRING_template field_desc; }; void UTRAN__GPRSMeasParamsDescOpt_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_presence = ANY_VALUE; single_value->field_desc = ANY_OR_OMIT; } } } void UTRAN__GPRSMeasParamsDescOpt_template::copy_value(const UTRAN__GPRSMeasParamsDescOpt& other_value) { single_value = new single_value_struct; if (other_value.presence().is_bound()) { single_value->field_presence = other_value.presence(); } else { single_value->field_presence.clean_up(); } if (other_value.desc().is_bound()) { if (other_value.desc().ispresent()) single_value->field_desc = other_value.desc()(); else single_value->field_desc = OMIT_VALUE; } else { single_value->field_desc.clean_up(); } set_selection(SPECIFIC_VALUE); } void UTRAN__GPRSMeasParamsDescOpt_template::copy_template(const UTRAN__GPRSMeasParamsDescOpt_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.presence().get_selection()) { single_value->field_presence = other_value.presence(); } else { single_value->field_presence.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.desc().get_selection()) { single_value->field_desc = other_value.desc(); } else { single_value->field_desc.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 UTRAN__GPRSMeasParamsDescOpt_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 UTRAN__GPRSMeasParamsDescOpt_template(*other_value.implication_.precondition); implication_.implied_template = new UTRAN__GPRSMeasParamsDescOpt_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of type @GSM_RestOctets.UTRAN_GPRSMeasParamsDescOpt."); break; } set_selection(other_value); } UTRAN__GPRSMeasParamsDescOpt_template::UTRAN__GPRSMeasParamsDescOpt_template() { } UTRAN__GPRSMeasParamsDescOpt_template::UTRAN__GPRSMeasParamsDescOpt_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } UTRAN__GPRSMeasParamsDescOpt_template::UTRAN__GPRSMeasParamsDescOpt_template(const UTRAN__GPRSMeasParamsDescOpt& other_value) { copy_value(other_value); } UTRAN__GPRSMeasParamsDescOpt_template::UTRAN__GPRSMeasParamsDescOpt_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const UTRAN__GPRSMeasParamsDescOpt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.UTRAN_GPRSMeasParamsDescOpt from an unbound optional field."); } } UTRAN__GPRSMeasParamsDescOpt_template::UTRAN__GPRSMeasParamsDescOpt_template(UTRAN__GPRSMeasParamsDescOpt_template* p_precondition, UTRAN__GPRSMeasParamsDescOpt_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } UTRAN__GPRSMeasParamsDescOpt_template::UTRAN__GPRSMeasParamsDescOpt_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; } UTRAN__GPRSMeasParamsDescOpt_template::UTRAN__GPRSMeasParamsDescOpt_template(const UTRAN__GPRSMeasParamsDescOpt_template& other_value) : Base_Template() { copy_template(other_value); } UTRAN__GPRSMeasParamsDescOpt_template::~UTRAN__GPRSMeasParamsDescOpt_template() { clean_up(); } UTRAN__GPRSMeasParamsDescOpt_template& UTRAN__GPRSMeasParamsDescOpt_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } UTRAN__GPRSMeasParamsDescOpt_template& UTRAN__GPRSMeasParamsDescOpt_template::operator=(const UTRAN__GPRSMeasParamsDescOpt& other_value) { clean_up(); copy_value(other_value); return *this; } UTRAN__GPRSMeasParamsDescOpt_template& UTRAN__GPRSMeasParamsDescOpt_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const UTRAN__GPRSMeasParamsDescOpt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @GSM_RestOctets.UTRAN_GPRSMeasParamsDescOpt."); } return *this; } UTRAN__GPRSMeasParamsDescOpt_template& UTRAN__GPRSMeasParamsDescOpt_template::operator=(const UTRAN__GPRSMeasParamsDescOpt_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean UTRAN__GPRSMeasParamsDescOpt_template::match(const UTRAN__GPRSMeasParamsDescOpt& 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.presence().is_bound()) return FALSE; if(!single_value->field_presence.match(other_value.presence(), legacy))return FALSE; if(!other_value.desc().is_bound()) return FALSE; if((other_value.desc().ispresent() ? !single_value->field_desc.match((const BITSTRING&)other_value.desc(), legacy) : !single_value->field_desc.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 @GSM_RestOctets.UTRAN_GPRSMeasParamsDescOpt."); } return FALSE; } boolean UTRAN__GPRSMeasParamsDescOpt_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_presence.is_bound() || (single_value->field_desc.is_omit() || single_value->field_desc.is_bound()); } boolean UTRAN__GPRSMeasParamsDescOpt_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_presence.is_value() && (single_value->field_desc.is_omit() || single_value->field_desc.is_value()); } void UTRAN__GPRSMeasParamsDescOpt_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; } UTRAN__GPRSMeasParamsDescOpt UTRAN__GPRSMeasParamsDescOpt_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @GSM_RestOctets.UTRAN_GPRSMeasParamsDescOpt."); UTRAN__GPRSMeasParamsDescOpt ret_val; if (single_value->field_presence.is_bound()) { ret_val.presence() = single_value->field_presence.valueof(); } if (single_value->field_desc.is_omit()) ret_val.desc() = OMIT_VALUE; else if (single_value->field_desc.is_bound()) { ret_val.desc() = single_value->field_desc.valueof(); } return ret_val; } void UTRAN__GPRSMeasParamsDescOpt_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list for a template of type @GSM_RestOctets.UTRAN_GPRSMeasParamsDescOpt."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new UTRAN__GPRSMeasParamsDescOpt_template[list_length]; } UTRAN__GPRSMeasParamsDescOpt_template& UTRAN__GPRSMeasParamsDescOpt_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element of a non-list template of type @GSM_RestOctets.UTRAN_GPRSMeasParamsDescOpt."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.UTRAN_GPRSMeasParamsDescOpt."); return value_list.list_value[list_index]; } BITSTRING_template& UTRAN__GPRSMeasParamsDescOpt_template::presence() { set_specific(); return single_value->field_presence; } const BITSTRING_template& UTRAN__GPRSMeasParamsDescOpt_template::presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field presence of a non-specific template of type @GSM_RestOctets.UTRAN_GPRSMeasParamsDescOpt."); return single_value->field_presence; } BITSTRING_template& UTRAN__GPRSMeasParamsDescOpt_template::desc() { set_specific(); return single_value->field_desc; } const BITSTRING_template& UTRAN__GPRSMeasParamsDescOpt_template::desc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field desc of a non-specific template of type @GSM_RestOctets.UTRAN_GPRSMeasParamsDescOpt."); return single_value->field_desc; } int UTRAN__GPRSMeasParamsDescOpt_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_GPRSMeasParamsDescOpt which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 1; if (single_value->field_desc.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 @GSM_RestOctets.UTRAN_GPRSMeasParamsDescOpt containing an empty list."); int item_size = value_list.list_value[0].size_of(); for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++) { if (value_list.list_value[l_idx].size_of()!=item_size) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_GPRSMeasParamsDescOpt containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_GPRSMeasParamsDescOpt containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_GPRSMeasParamsDescOpt containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_GPRSMeasParamsDescOpt containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_GPRSMeasParamsDescOpt containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_GPRSMeasParamsDescOpt containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_GPRSMeasParamsDescOpt containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.UTRAN_GPRSMeasParamsDescOpt."); } return 0; } void UTRAN__GPRSMeasParamsDescOpt_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ presence := "); single_value->field_presence.log(); TTCN_Logger::log_event_str(", desc := "); single_value->field_desc.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 UTRAN__GPRSMeasParamsDescOpt_template::log_match(const UTRAN__GPRSMeasParamsDescOpt& 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_presence.match(match_value.presence(), legacy)){ TTCN_Logger::log_logmatch_info(".presence"); single_value->field_presence.log_match(match_value.presence(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.desc().ispresent()){ if(!single_value->field_desc.match(match_value.desc(), legacy)){ TTCN_Logger::log_logmatch_info(".desc"); single_value->field_desc.log_match(match_value.desc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_desc.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".desc := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_desc.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("{ presence := "); single_value->field_presence.log_match(match_value.presence(), legacy); TTCN_Logger::log_event_str(", desc := "); if (match_value.desc().ispresent()) { single_value->field_desc.log_match(match_value.desc(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_desc.log(); if (single_value->field_desc.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 UTRAN__GPRSMeasParamsDescOpt_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (presence().is_bound()) presence().set_implicit_omit(); if (!desc().is_bound()) desc() = OMIT_VALUE; else desc().set_implicit_omit(); } void UTRAN__GPRSMeasParamsDescOpt_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_presence.encode_text(text_buf); single_value->field_desc.encode_text(text_buf); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @GSM_RestOctets.UTRAN_GPRSMeasParamsDescOpt."); } } void UTRAN__GPRSMeasParamsDescOpt_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_presence.decode_text(text_buf); single_value->field_desc.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 UTRAN__GPRSMeasParamsDescOpt_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @GSM_RestOctets.UTRAN_GPRSMeasParamsDescOpt."); } } void UTRAN__GPRSMeasParamsDescOpt_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: { UTRAN__GPRSMeasParamsDescOpt_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) presence().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) desc().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(), "presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.UTRAN_GPRSMeasParamsDescOpt: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { UTRAN__GPRSMeasParamsDescOpt_template* precondition = new UTRAN__GPRSMeasParamsDescOpt_template; precondition->set_param(*param.get_elem(0)); UTRAN__GPRSMeasParamsDescOpt_template* implied_template = new UTRAN__GPRSMeasParamsDescOpt_template; implied_template->set_param(*param.get_elem(1)); *this = UTRAN__GPRSMeasParamsDescOpt_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.UTRAN_GPRSMeasParamsDescOpt"); } is_ifpresent = param.get_ifpresent(); } void UTRAN__GPRSMeasParamsDescOpt_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_presence.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.UTRAN_GPRSMeasParamsDescOpt"); single_value->field_desc.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.UTRAN_GPRSMeasParamsDescOpt"); return; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@GSM_RestOctets.UTRAN_GPRSMeasParamsDescOpt"); } boolean UTRAN__GPRSMeasParamsDescOpt_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean UTRAN__GPRSMeasParamsDescOpt_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_rel5) : field_rel5__presence(par_rel5__presence), field_rel5(par_rel5) { } SI2quaterAdditions::SI2quaterAdditions(const SI2quaterAdditions& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.SI2quaterAdditions."); if (other_value.rel5__presence().is_bound()) field_rel5__presence = other_value.rel5__presence(); else field_rel5__presence.clean_up(); if (other_value.rel5().is_bound()) field_rel5 = other_value.rel5(); else field_rel5.clean_up(); } void SI2quaterAdditions::clean_up() { field_rel5__presence.clean_up(); field_rel5.clean_up(); } const TTCN_Typedescriptor_t* SI2quaterAdditions::get_descriptor() const { return &SI2quaterAdditions_descr_; } SI2quaterAdditions& SI2quaterAdditions::operator=(const SI2quaterAdditions& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.SI2quaterAdditions."); if (other_value.rel5__presence().is_bound()) field_rel5__presence = other_value.rel5__presence(); else field_rel5__presence.clean_up(); if (other_value.rel5().is_bound()) field_rel5 = other_value.rel5(); else field_rel5.clean_up(); } return *this; } boolean SI2quaterAdditions::operator==(const SI2quaterAdditions& other_value) const { return field_rel5__presence==other_value.field_rel5__presence && field_rel5==other_value.field_rel5; } boolean SI2quaterAdditions::is_bound() const { return (field_rel5__presence.is_bound()) || (OPTIONAL_OMIT == field_rel5.get_selection() || field_rel5.is_bound()); } boolean SI2quaterAdditions::is_value() const { return field_rel5__presence.is_value() && (OPTIONAL_OMIT == field_rel5.get_selection() || field_rel5.is_value()); } int SI2quaterAdditions::size_of() const { int ret_val = 1; if (field_rel5.ispresent()) ret_val++; return ret_val; } void SI2quaterAdditions::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ rel5_presence := "); field_rel5__presence.log(); TTCN_Logger::log_event_str(", rel5 := "); field_rel5.log(); TTCN_Logger::log_event_str(" }"); } void SI2quaterAdditions::set_implicit_omit() { if (rel5__presence().is_bound()) rel5__presence().set_implicit_omit(); if (!rel5().is_bound()) rel5() = OMIT_VALUE; else rel5().set_implicit_omit(); } void SI2quaterAdditions::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) rel5__presence().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) rel5().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(), "rel5_presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rel5__presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "rel5")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rel5().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.SI2quaterAdditions: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.SI2quaterAdditions"); } } void SI2quaterAdditions::encode_text(Text_Buf& text_buf) const { field_rel5__presence.encode_text(text_buf); field_rel5.encode_text(text_buf); } void SI2quaterAdditions::decode_text(Text_Buf& text_buf) { field_rel5__presence.decode_text(text_buf); field_rel5.decode_text(text_buf); } void SI2quaterAdditions::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name); if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); PER_encode(p_td, p_buf, opt); break; } default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void SI2quaterAdditions::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name); if(!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); try { PER_decode(p_td, p_buf, opt); p_buf.PER_octet_align(FALSE); } catch (PER_Buffer_Exception) { } break; } default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int SI2quaterAdditions::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, SI2quaterAdditions_rel5__presence_descr_.raw->forceomit); decoded_field_length = field_rel5__presence.RAW_decode(SI2quaterAdditions_rel5__presence_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); if (limit > 0 && field_rel5__presence == bs_0){ if (force_omit != NULL && (*force_omit)(1)) { field_rel5 = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_1_force_omit(1, force_omit, SI2quaterAdditions_rel5_descr_.raw->forceomit); decoded_field_length = field_rel5().RAW_decode(SI2quaterAdditions_rel5_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 1) { field_rel5 = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } else field_rel5=OMIT_VALUE; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int SI2quaterAdditions::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, SI2quaterAdditions_rel5__presence_descr_.raw); if (field_rel5.ispresent()) { myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, SI2quaterAdditions_rel5_descr_.raw); } else myleaf.body.node.nodes[1] = NULL; encoded_length += field_rel5__presence.RAW_encode(SI2quaterAdditions_rel5__presence_descr_, *myleaf.body.node.nodes[0]); if (field_rel5.ispresent()) { encoded_length += field_rel5().RAW_encode(SI2quaterAdditions_rel5_descr_, *myleaf.body.node.nodes[1]); } if (field_rel5.ispresent() && (field_rel5__presence != bs_0)) { 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){ bs_0.RAW_encode(SI2quaterAdditions_rel5__presence_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 SI2quaterAdditions_template::single_value_struct { BITSTRING_template field_rel5__presence; SI2quaterR5Additions_template field_rel5; }; void SI2quaterAdditions_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_rel5__presence = ANY_VALUE; single_value->field_rel5 = ANY_OR_OMIT; } } } void SI2quaterAdditions_template::copy_value(const SI2quaterAdditions& other_value) { single_value = new single_value_struct; if (other_value.rel5__presence().is_bound()) { single_value->field_rel5__presence = other_value.rel5__presence(); } else { single_value->field_rel5__presence.clean_up(); } if (other_value.rel5().is_bound()) { if (other_value.rel5().ispresent()) single_value->field_rel5 = other_value.rel5()(); else single_value->field_rel5 = OMIT_VALUE; } else { single_value->field_rel5.clean_up(); } set_selection(SPECIFIC_VALUE); } void SI2quaterAdditions_template::copy_template(const SI2quaterAdditions_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.rel5__presence().get_selection()) { single_value->field_rel5__presence = other_value.rel5__presence(); } else { single_value->field_rel5__presence.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.rel5().get_selection()) { single_value->field_rel5 = other_value.rel5(); } else { single_value->field_rel5.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 SI2quaterAdditions_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 SI2quaterAdditions_template(*other_value.implication_.precondition); implication_.implied_template = new SI2quaterAdditions_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of type @GSM_RestOctets.SI2quaterAdditions."); break; } set_selection(other_value); } SI2quaterAdditions_template::SI2quaterAdditions_template() { } SI2quaterAdditions_template::SI2quaterAdditions_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } SI2quaterAdditions_template::SI2quaterAdditions_template(const SI2quaterAdditions& other_value) { copy_value(other_value); } SI2quaterAdditions_template::SI2quaterAdditions_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI2quaterAdditions&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.SI2quaterAdditions from an unbound optional field."); } } SI2quaterAdditions_template::SI2quaterAdditions_template(SI2quaterAdditions_template* p_precondition, SI2quaterAdditions_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } SI2quaterAdditions_template::SI2quaterAdditions_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; } SI2quaterAdditions_template::SI2quaterAdditions_template(const SI2quaterAdditions_template& other_value) : Base_Template() { copy_template(other_value); } SI2quaterAdditions_template::~SI2quaterAdditions_template() { clean_up(); } SI2quaterAdditions_template& SI2quaterAdditions_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } SI2quaterAdditions_template& SI2quaterAdditions_template::operator=(const SI2quaterAdditions& other_value) { clean_up(); copy_value(other_value); return *this; } SI2quaterAdditions_template& SI2quaterAdditions_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI2quaterAdditions&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @GSM_RestOctets.SI2quaterAdditions."); } return *this; } SI2quaterAdditions_template& SI2quaterAdditions_template::operator=(const SI2quaterAdditions_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean SI2quaterAdditions_template::match(const SI2quaterAdditions& 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.rel5__presence().is_bound()) return FALSE; if(!single_value->field_rel5__presence.match(other_value.rel5__presence(), legacy))return FALSE; if(!other_value.rel5().is_bound()) return FALSE; if((other_value.rel5().ispresent() ? !single_value->field_rel5.match((const SI2quaterR5Additions&)other_value.rel5(), legacy) : !single_value->field_rel5.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 @GSM_RestOctets.SI2quaterAdditions."); } return FALSE; } boolean SI2quaterAdditions_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_rel5__presence.is_bound() || (single_value->field_rel5.is_omit() || single_value->field_rel5.is_bound()); } boolean SI2quaterAdditions_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_rel5__presence.is_value() && (single_value->field_rel5.is_omit() || single_value->field_rel5.is_value()); } void SI2quaterAdditions_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; } SI2quaterAdditions SI2quaterAdditions_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @GSM_RestOctets.SI2quaterAdditions."); SI2quaterAdditions ret_val; if (single_value->field_rel5__presence.is_bound()) { ret_val.rel5__presence() = single_value->field_rel5__presence.valueof(); } if (single_value->field_rel5.is_omit()) ret_val.rel5() = OMIT_VALUE; else if (single_value->field_rel5.is_bound()) { ret_val.rel5() = single_value->field_rel5.valueof(); } return ret_val; } void SI2quaterAdditions_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list for a template of type @GSM_RestOctets.SI2quaterAdditions."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new SI2quaterAdditions_template[list_length]; } SI2quaterAdditions_template& SI2quaterAdditions_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element of a non-list template of type @GSM_RestOctets.SI2quaterAdditions."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.SI2quaterAdditions."); return value_list.list_value[list_index]; } BITSTRING_template& SI2quaterAdditions_template::rel5__presence() { set_specific(); return single_value->field_rel5__presence; } const BITSTRING_template& SI2quaterAdditions_template::rel5__presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field rel5_presence of a non-specific template of type @GSM_RestOctets.SI2quaterAdditions."); return single_value->field_rel5__presence; } SI2quaterR5Additions_template& SI2quaterAdditions_template::rel5() { set_specific(); return single_value->field_rel5; } const SI2quaterR5Additions_template& SI2quaterAdditions_template::rel5() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field rel5 of a non-specific template of type @GSM_RestOctets.SI2quaterAdditions."); return single_value->field_rel5; } int SI2quaterAdditions_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterAdditions which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 1; if (single_value->field_rel5.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 @GSM_RestOctets.SI2quaterAdditions containing an empty list."); int item_size = value_list.list_value[0].size_of(); for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++) { if (value_list.list_value[l_idx].size_of()!=item_size) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterAdditions containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterAdditions containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterAdditions containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterAdditions containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterAdditions containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterAdditions containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterAdditions containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.SI2quaterAdditions."); } return 0; } void SI2quaterAdditions_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ rel5_presence := "); single_value->field_rel5__presence.log(); TTCN_Logger::log_event_str(", rel5 := "); single_value->field_rel5.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 SI2quaterAdditions_template::log_match(const SI2quaterAdditions& 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_rel5__presence.match(match_value.rel5__presence(), legacy)){ TTCN_Logger::log_logmatch_info(".rel5_presence"); single_value->field_rel5__presence.log_match(match_value.rel5__presence(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.rel5().ispresent()){ if(!single_value->field_rel5.match(match_value.rel5(), legacy)){ TTCN_Logger::log_logmatch_info(".rel5"); single_value->field_rel5.log_match(match_value.rel5(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_rel5.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".rel5 := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_rel5.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("{ rel5_presence := "); single_value->field_rel5__presence.log_match(match_value.rel5__presence(), legacy); TTCN_Logger::log_event_str(", rel5 := "); if (match_value.rel5().ispresent()) { single_value->field_rel5.log_match(match_value.rel5(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_rel5.log(); if (single_value->field_rel5.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 SI2quaterAdditions_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (rel5__presence().is_bound()) rel5__presence().set_implicit_omit(); if (!rel5().is_bound()) rel5() = OMIT_VALUE; else rel5().set_implicit_omit(); } void SI2quaterAdditions_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_rel5__presence.encode_text(text_buf); single_value->field_rel5.encode_text(text_buf); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @GSM_RestOctets.SI2quaterAdditions."); } } void SI2quaterAdditions_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_rel5__presence.decode_text(text_buf); single_value->field_rel5.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 SI2quaterAdditions_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @GSM_RestOctets.SI2quaterAdditions."); } } void SI2quaterAdditions_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: { SI2quaterAdditions_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) rel5__presence().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) rel5().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(), "rel5_presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rel5__presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "rel5")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rel5().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.SI2quaterAdditions: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { SI2quaterAdditions_template* precondition = new SI2quaterAdditions_template; precondition->set_param(*param.get_elem(0)); SI2quaterAdditions_template* implied_template = new SI2quaterAdditions_template; implied_template->set_param(*param.get_elem(1)); *this = SI2quaterAdditions_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.SI2quaterAdditions"); } is_ifpresent = param.get_ifpresent(); } void SI2quaterAdditions_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_rel5__presence.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI2quaterAdditions"); single_value->field_rel5.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI2quaterAdditions"); return; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@GSM_RestOctets.SI2quaterAdditions"); } boolean SI2quaterAdditions_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean SI2quaterAdditions_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_desc) : field_presence(par_presence), field_desc(par_desc) { } UMTS__AddMeasParamsDescOpt::UMTS__AddMeasParamsDescOpt(const UMTS__AddMeasParamsDescOpt& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.UMTS_AddMeasParamsDescOpt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.desc().is_bound()) field_desc = other_value.desc(); else field_desc.clean_up(); } void UMTS__AddMeasParamsDescOpt::clean_up() { field_presence.clean_up(); field_desc.clean_up(); } const TTCN_Typedescriptor_t* UMTS__AddMeasParamsDescOpt::get_descriptor() const { return &UMTS__AddMeasParamsDescOpt_descr_; } UMTS__AddMeasParamsDescOpt& UMTS__AddMeasParamsDescOpt::operator=(const UMTS__AddMeasParamsDescOpt& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.UMTS_AddMeasParamsDescOpt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.desc().is_bound()) field_desc = other_value.desc(); else field_desc.clean_up(); } return *this; } boolean UMTS__AddMeasParamsDescOpt::operator==(const UMTS__AddMeasParamsDescOpt& other_value) const { return field_presence==other_value.field_presence && field_desc==other_value.field_desc; } boolean UMTS__AddMeasParamsDescOpt::is_bound() const { return (field_presence.is_bound()) || (OPTIONAL_OMIT == field_desc.get_selection() || field_desc.is_bound()); } boolean UMTS__AddMeasParamsDescOpt::is_value() const { return field_presence.is_value() && (OPTIONAL_OMIT == field_desc.get_selection() || field_desc.is_value()); } int UMTS__AddMeasParamsDescOpt::size_of() const { int ret_val = 1; if (field_desc.ispresent()) ret_val++; return ret_val; } void UMTS__AddMeasParamsDescOpt::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ presence := "); field_presence.log(); TTCN_Logger::log_event_str(", desc := "); field_desc.log(); TTCN_Logger::log_event_str(" }"); } void UMTS__AddMeasParamsDescOpt::set_implicit_omit() { if (presence().is_bound()) presence().set_implicit_omit(); if (!desc().is_bound()) desc() = OMIT_VALUE; else desc().set_implicit_omit(); } void UMTS__AddMeasParamsDescOpt::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) presence().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) desc().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(), "presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.UMTS_AddMeasParamsDescOpt: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.UMTS_AddMeasParamsDescOpt"); } } void UMTS__AddMeasParamsDescOpt::encode_text(Text_Buf& text_buf) const { field_presence.encode_text(text_buf); field_desc.encode_text(text_buf); } void UMTS__AddMeasParamsDescOpt::decode_text(Text_Buf& text_buf) { field_presence.decode_text(text_buf); field_desc.decode_text(text_buf); } void UMTS__AddMeasParamsDescOpt::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name); if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); PER_encode(p_td, p_buf, opt); break; } default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void UMTS__AddMeasParamsDescOpt::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name); if(!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); try { PER_decode(p_td, p_buf, opt); p_buf.PER_octet_align(FALSE); } catch (PER_Buffer_Exception) { } break; } default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int UMTS__AddMeasParamsDescOpt::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, UMTS__AddMeasParamsDescOpt_presence_descr_.raw->forceomit); decoded_field_length = field_presence.RAW_decode(UMTS__AddMeasParamsDescOpt_presence_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); if (limit > 0 && field_presence == bs_0){ if (force_omit != NULL && (*force_omit)(1)) { field_desc = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_1_force_omit(1, force_omit, UMTS__AddMeasParamsDescOpt_desc_descr_.raw->forceomit); decoded_field_length = field_desc().RAW_decode(UMTS__AddMeasParamsDescOpt_desc_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 1) { field_desc = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } else field_desc=OMIT_VALUE; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int UMTS__AddMeasParamsDescOpt::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, UMTS__AddMeasParamsDescOpt_presence_descr_.raw); if (field_desc.ispresent()) { myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, UMTS__AddMeasParamsDescOpt_desc_descr_.raw); } else myleaf.body.node.nodes[1] = NULL; encoded_length += field_presence.RAW_encode(UMTS__AddMeasParamsDescOpt_presence_descr_, *myleaf.body.node.nodes[0]); if (field_desc.ispresent()) { encoded_length += field_desc().RAW_encode(UMTS__AddMeasParamsDescOpt_desc_descr_, *myleaf.body.node.nodes[1]); } if (field_desc.ispresent() && (field_presence != bs_0)) { 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){ bs_0.RAW_encode(UMTS__AddMeasParamsDescOpt_presence_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 UMTS__AddMeasParamsDescOpt_template::single_value_struct { BITSTRING_template field_presence; UMTS__AddMeasParamsDesc_template field_desc; }; void UMTS__AddMeasParamsDescOpt_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_presence = ANY_VALUE; single_value->field_desc = ANY_OR_OMIT; } } } void UMTS__AddMeasParamsDescOpt_template::copy_value(const UMTS__AddMeasParamsDescOpt& other_value) { single_value = new single_value_struct; if (other_value.presence().is_bound()) { single_value->field_presence = other_value.presence(); } else { single_value->field_presence.clean_up(); } if (other_value.desc().is_bound()) { if (other_value.desc().ispresent()) single_value->field_desc = other_value.desc()(); else single_value->field_desc = OMIT_VALUE; } else { single_value->field_desc.clean_up(); } set_selection(SPECIFIC_VALUE); } void UMTS__AddMeasParamsDescOpt_template::copy_template(const UMTS__AddMeasParamsDescOpt_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.presence().get_selection()) { single_value->field_presence = other_value.presence(); } else { single_value->field_presence.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.desc().get_selection()) { single_value->field_desc = other_value.desc(); } else { single_value->field_desc.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 UMTS__AddMeasParamsDescOpt_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 UMTS__AddMeasParamsDescOpt_template(*other_value.implication_.precondition); implication_.implied_template = new UMTS__AddMeasParamsDescOpt_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of type @GSM_RestOctets.UMTS_AddMeasParamsDescOpt."); break; } set_selection(other_value); } UMTS__AddMeasParamsDescOpt_template::UMTS__AddMeasParamsDescOpt_template() { } UMTS__AddMeasParamsDescOpt_template::UMTS__AddMeasParamsDescOpt_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } UMTS__AddMeasParamsDescOpt_template::UMTS__AddMeasParamsDescOpt_template(const UMTS__AddMeasParamsDescOpt& other_value) { copy_value(other_value); } UMTS__AddMeasParamsDescOpt_template::UMTS__AddMeasParamsDescOpt_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const UMTS__AddMeasParamsDescOpt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.UMTS_AddMeasParamsDescOpt from an unbound optional field."); } } UMTS__AddMeasParamsDescOpt_template::UMTS__AddMeasParamsDescOpt_template(UMTS__AddMeasParamsDescOpt_template* p_precondition, UMTS__AddMeasParamsDescOpt_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } UMTS__AddMeasParamsDescOpt_template::UMTS__AddMeasParamsDescOpt_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; } UMTS__AddMeasParamsDescOpt_template::UMTS__AddMeasParamsDescOpt_template(const UMTS__AddMeasParamsDescOpt_template& other_value) : Base_Template() { copy_template(other_value); } UMTS__AddMeasParamsDescOpt_template::~UMTS__AddMeasParamsDescOpt_template() { clean_up(); } UMTS__AddMeasParamsDescOpt_template& UMTS__AddMeasParamsDescOpt_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } UMTS__AddMeasParamsDescOpt_template& UMTS__AddMeasParamsDescOpt_template::operator=(const UMTS__AddMeasParamsDescOpt& other_value) { clean_up(); copy_value(other_value); return *this; } UMTS__AddMeasParamsDescOpt_template& UMTS__AddMeasParamsDescOpt_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const UMTS__AddMeasParamsDescOpt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @GSM_RestOctets.UMTS_AddMeasParamsDescOpt."); } return *this; } UMTS__AddMeasParamsDescOpt_template& UMTS__AddMeasParamsDescOpt_template::operator=(const UMTS__AddMeasParamsDescOpt_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean UMTS__AddMeasParamsDescOpt_template::match(const UMTS__AddMeasParamsDescOpt& 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.presence().is_bound()) return FALSE; if(!single_value->field_presence.match(other_value.presence(), legacy))return FALSE; if(!other_value.desc().is_bound()) return FALSE; if((other_value.desc().ispresent() ? !single_value->field_desc.match((const UMTS__AddMeasParamsDesc&)other_value.desc(), legacy) : !single_value->field_desc.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 @GSM_RestOctets.UMTS_AddMeasParamsDescOpt."); } return FALSE; } boolean UMTS__AddMeasParamsDescOpt_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_presence.is_bound() || (single_value->field_desc.is_omit() || single_value->field_desc.is_bound()); } boolean UMTS__AddMeasParamsDescOpt_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_presence.is_value() && (single_value->field_desc.is_omit() || single_value->field_desc.is_value()); } void UMTS__AddMeasParamsDescOpt_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; } UMTS__AddMeasParamsDescOpt UMTS__AddMeasParamsDescOpt_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @GSM_RestOctets.UMTS_AddMeasParamsDescOpt."); UMTS__AddMeasParamsDescOpt ret_val; if (single_value->field_presence.is_bound()) { ret_val.presence() = single_value->field_presence.valueof(); } if (single_value->field_desc.is_omit()) ret_val.desc() = OMIT_VALUE; else if (single_value->field_desc.is_bound()) { ret_val.desc() = single_value->field_desc.valueof(); } return ret_val; } void UMTS__AddMeasParamsDescOpt_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list for a template of type @GSM_RestOctets.UMTS_AddMeasParamsDescOpt."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new UMTS__AddMeasParamsDescOpt_template[list_length]; } UMTS__AddMeasParamsDescOpt_template& UMTS__AddMeasParamsDescOpt_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element of a non-list template of type @GSM_RestOctets.UMTS_AddMeasParamsDescOpt."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.UMTS_AddMeasParamsDescOpt."); return value_list.list_value[list_index]; } BITSTRING_template& UMTS__AddMeasParamsDescOpt_template::presence() { set_specific(); return single_value->field_presence; } const BITSTRING_template& UMTS__AddMeasParamsDescOpt_template::presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field presence of a non-specific template of type @GSM_RestOctets.UMTS_AddMeasParamsDescOpt."); return single_value->field_presence; } UMTS__AddMeasParamsDesc_template& UMTS__AddMeasParamsDescOpt_template::desc() { set_specific(); return single_value->field_desc; } const UMTS__AddMeasParamsDesc_template& UMTS__AddMeasParamsDescOpt_template::desc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field desc of a non-specific template of type @GSM_RestOctets.UMTS_AddMeasParamsDescOpt."); return single_value->field_desc; } int UMTS__AddMeasParamsDescOpt_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UMTS_AddMeasParamsDescOpt which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 1; if (single_value->field_desc.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 @GSM_RestOctets.UMTS_AddMeasParamsDescOpt containing an empty list."); int item_size = value_list.list_value[0].size_of(); for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++) { if (value_list.list_value[l_idx].size_of()!=item_size) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UMTS_AddMeasParamsDescOpt containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UMTS_AddMeasParamsDescOpt containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UMTS_AddMeasParamsDescOpt containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UMTS_AddMeasParamsDescOpt containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UMTS_AddMeasParamsDescOpt containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UMTS_AddMeasParamsDescOpt containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UMTS_AddMeasParamsDescOpt containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.UMTS_AddMeasParamsDescOpt."); } return 0; } void UMTS__AddMeasParamsDescOpt_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ presence := "); single_value->field_presence.log(); TTCN_Logger::log_event_str(", desc := "); single_value->field_desc.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 UMTS__AddMeasParamsDescOpt_template::log_match(const UMTS__AddMeasParamsDescOpt& 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_presence.match(match_value.presence(), legacy)){ TTCN_Logger::log_logmatch_info(".presence"); single_value->field_presence.log_match(match_value.presence(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.desc().ispresent()){ if(!single_value->field_desc.match(match_value.desc(), legacy)){ TTCN_Logger::log_logmatch_info(".desc"); single_value->field_desc.log_match(match_value.desc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_desc.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".desc := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_desc.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("{ presence := "); single_value->field_presence.log_match(match_value.presence(), legacy); TTCN_Logger::log_event_str(", desc := "); if (match_value.desc().ispresent()) { single_value->field_desc.log_match(match_value.desc(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_desc.log(); if (single_value->field_desc.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 UMTS__AddMeasParamsDescOpt_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (presence().is_bound()) presence().set_implicit_omit(); if (!desc().is_bound()) desc() = OMIT_VALUE; else desc().set_implicit_omit(); } void UMTS__AddMeasParamsDescOpt_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_presence.encode_text(text_buf); single_value->field_desc.encode_text(text_buf); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @GSM_RestOctets.UMTS_AddMeasParamsDescOpt."); } } void UMTS__AddMeasParamsDescOpt_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_presence.decode_text(text_buf); single_value->field_desc.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 UMTS__AddMeasParamsDescOpt_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @GSM_RestOctets.UMTS_AddMeasParamsDescOpt."); } } void UMTS__AddMeasParamsDescOpt_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: { UMTS__AddMeasParamsDescOpt_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) presence().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) desc().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(), "presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.UMTS_AddMeasParamsDescOpt: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { UMTS__AddMeasParamsDescOpt_template* precondition = new UMTS__AddMeasParamsDescOpt_template; precondition->set_param(*param.get_elem(0)); UMTS__AddMeasParamsDescOpt_template* implied_template = new UMTS__AddMeasParamsDescOpt_template; implied_template->set_param(*param.get_elem(1)); *this = UMTS__AddMeasParamsDescOpt_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.UMTS_AddMeasParamsDescOpt"); } is_ifpresent = param.get_ifpresent(); } void UMTS__AddMeasParamsDescOpt_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_presence.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.UMTS_AddMeasParamsDescOpt"); single_value->field_desc.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.UMTS_AddMeasParamsDescOpt"); return; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@GSM_RestOctets.UMTS_AddMeasParamsDescOpt"); } boolean UMTS__AddMeasParamsDescOpt_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean UMTS__AddMeasParamsDescOpt_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) fdd__qmin__offset().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) fdd__rscpmin().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(), "fdd_qmin_offset")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { fdd__qmin__offset().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "fdd_rscpmin")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { fdd__rscpmin().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.UMTS_AddMeasParamsDesc: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.UMTS_AddMeasParamsDesc"); } } void UMTS__AddMeasParamsDesc::encode_text(Text_Buf& text_buf) const { field_fdd__qmin__offset.encode_text(text_buf); field_fdd__rscpmin.encode_text(text_buf); } void UMTS__AddMeasParamsDesc::decode_text(Text_Buf& text_buf) { field_fdd__qmin__offset.decode_text(text_buf); field_fdd__rscpmin.decode_text(text_buf); } void UMTS__AddMeasParamsDesc::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name); if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); PER_encode(p_td, p_buf, opt); break; } default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void UMTS__AddMeasParamsDesc::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name); if(!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); try { PER_decode(p_td, p_buf, opt); p_buf.PER_octet_align(FALSE); } catch (PER_Buffer_Exception) { } break; } default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int UMTS__AddMeasParamsDesc::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, UMTS__AddMeasParamsDesc_fdd__qmin__offset_descr_.raw->forceomit); decoded_field_length = field_fdd__qmin__offset.RAW_decode(UMTS__AddMeasParamsDesc_fdd__qmin__offset_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, UMTS__AddMeasParamsDesc_fdd__rscpmin_descr_.raw->forceomit); decoded_field_length = field_fdd__rscpmin.RAW_decode(UMTS__AddMeasParamsDesc_fdd__rscpmin_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 UMTS__AddMeasParamsDesc::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, UMTS__AddMeasParamsDesc_fdd__qmin__offset_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, UMTS__AddMeasParamsDesc_fdd__rscpmin_descr_.raw); encoded_length += field_fdd__qmin__offset.RAW_encode(UMTS__AddMeasParamsDesc_fdd__qmin__offset_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_fdd__rscpmin.RAW_encode(UMTS__AddMeasParamsDesc_fdd__rscpmin_descr_, *myleaf.body.node.nodes[1]); return myleaf.length = encoded_length; } struct UMTS__AddMeasParamsDesc_template::single_value_struct { BITSTRING_template field_fdd__qmin__offset; BITSTRING_template field_fdd__rscpmin; }; void UMTS__AddMeasParamsDesc_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_fdd__qmin__offset = ANY_VALUE; single_value->field_fdd__rscpmin = ANY_VALUE; } } } void UMTS__AddMeasParamsDesc_template::copy_value(const UMTS__AddMeasParamsDesc& other_value) { single_value = new single_value_struct; if (other_value.fdd__qmin__offset().is_bound()) { single_value->field_fdd__qmin__offset = other_value.fdd__qmin__offset(); } else { single_value->field_fdd__qmin__offset.clean_up(); } if (other_value.fdd__rscpmin().is_bound()) { single_value->field_fdd__rscpmin = other_value.fdd__rscpmin(); } else { single_value->field_fdd__rscpmin.clean_up(); } set_selection(SPECIFIC_VALUE); } void UMTS__AddMeasParamsDesc_template::copy_template(const UMTS__AddMeasParamsDesc_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.fdd__qmin__offset().get_selection()) { single_value->field_fdd__qmin__offset = other_value.fdd__qmin__offset(); } else { single_value->field_fdd__qmin__offset.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.fdd__rscpmin().get_selection()) { single_value->field_fdd__rscpmin = other_value.fdd__rscpmin(); } else { single_value->field_fdd__rscpmin.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 UMTS__AddMeasParamsDesc_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 UMTS__AddMeasParamsDesc_template(*other_value.implication_.precondition); implication_.implied_template = new UMTS__AddMeasParamsDesc_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc."); break; } set_selection(other_value); } UMTS__AddMeasParamsDesc_template::UMTS__AddMeasParamsDesc_template() { } UMTS__AddMeasParamsDesc_template::UMTS__AddMeasParamsDesc_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } UMTS__AddMeasParamsDesc_template::UMTS__AddMeasParamsDesc_template(const UMTS__AddMeasParamsDesc& other_value) { copy_value(other_value); } UMTS__AddMeasParamsDesc_template::UMTS__AddMeasParamsDesc_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const UMTS__AddMeasParamsDesc&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc from an unbound optional field."); } } UMTS__AddMeasParamsDesc_template::UMTS__AddMeasParamsDesc_template(UMTS__AddMeasParamsDesc_template* p_precondition, UMTS__AddMeasParamsDesc_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } UMTS__AddMeasParamsDesc_template::UMTS__AddMeasParamsDesc_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; } UMTS__AddMeasParamsDesc_template::UMTS__AddMeasParamsDesc_template(const UMTS__AddMeasParamsDesc_template& other_value) : Base_Template() { copy_template(other_value); } UMTS__AddMeasParamsDesc_template::~UMTS__AddMeasParamsDesc_template() { clean_up(); } UMTS__AddMeasParamsDesc_template& UMTS__AddMeasParamsDesc_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } UMTS__AddMeasParamsDesc_template& UMTS__AddMeasParamsDesc_template::operator=(const UMTS__AddMeasParamsDesc& other_value) { clean_up(); copy_value(other_value); return *this; } UMTS__AddMeasParamsDesc_template& UMTS__AddMeasParamsDesc_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const UMTS__AddMeasParamsDesc&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc."); } return *this; } UMTS__AddMeasParamsDesc_template& UMTS__AddMeasParamsDesc_template::operator=(const UMTS__AddMeasParamsDesc_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean UMTS__AddMeasParamsDesc_template::match(const UMTS__AddMeasParamsDesc& 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.fdd__qmin__offset().is_bound()) return FALSE; if(!single_value->field_fdd__qmin__offset.match(other_value.fdd__qmin__offset(), legacy))return FALSE; if(!other_value.fdd__rscpmin().is_bound()) return FALSE; if(!single_value->field_fdd__rscpmin.match(other_value.fdd__rscpmin(), legacy))return FALSE; return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc."); } return FALSE; } boolean UMTS__AddMeasParamsDesc_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_fdd__qmin__offset.is_bound() || single_value->field_fdd__rscpmin.is_bound(); } boolean UMTS__AddMeasParamsDesc_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_fdd__qmin__offset.is_value() && single_value->field_fdd__rscpmin.is_value(); } void UMTS__AddMeasParamsDesc_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; } UMTS__AddMeasParamsDesc UMTS__AddMeasParamsDesc_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc."); UMTS__AddMeasParamsDesc ret_val; if (single_value->field_fdd__qmin__offset.is_bound()) { ret_val.fdd__qmin__offset() = single_value->field_fdd__qmin__offset.valueof(); } if (single_value->field_fdd__rscpmin.is_bound()) { ret_val.fdd__rscpmin() = single_value->field_fdd__rscpmin.valueof(); } return ret_val; } void UMTS__AddMeasParamsDesc_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list for a template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new UMTS__AddMeasParamsDesc_template[list_length]; } UMTS__AddMeasParamsDesc_template& UMTS__AddMeasParamsDesc_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element of a non-list template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc."); return value_list.list_value[list_index]; } BITSTRING_template& UMTS__AddMeasParamsDesc_template::fdd__qmin__offset() { set_specific(); return single_value->field_fdd__qmin__offset; } const BITSTRING_template& UMTS__AddMeasParamsDesc_template::fdd__qmin__offset() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field fdd_qmin_offset of a non-specific template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc."); return single_value->field_fdd__qmin__offset; } BITSTRING_template& UMTS__AddMeasParamsDesc_template::fdd__rscpmin() { set_specific(); return single_value->field_fdd__rscpmin; } const BITSTRING_template& UMTS__AddMeasParamsDesc_template::fdd__rscpmin() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field fdd_rscpmin of a non-specific template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc."); return single_value->field_fdd__rscpmin; } int UMTS__AddMeasParamsDesc_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 2; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc containing an empty list."); int item_size = value_list.list_value[0].size_of(); for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++) { if (value_list.list_value[l_idx].size_of()!=item_size) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc."); } return 0; } void UMTS__AddMeasParamsDesc_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ fdd_qmin_offset := "); single_value->field_fdd__qmin__offset.log(); TTCN_Logger::log_event_str(", fdd_rscpmin := "); single_value->field_fdd__rscpmin.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 UMTS__AddMeasParamsDesc_template::log_match(const UMTS__AddMeasParamsDesc& 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_fdd__qmin__offset.match(match_value.fdd__qmin__offset(), legacy)){ TTCN_Logger::log_logmatch_info(".fdd_qmin_offset"); single_value->field_fdd__qmin__offset.log_match(match_value.fdd__qmin__offset(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_fdd__rscpmin.match(match_value.fdd__rscpmin(), legacy)){ TTCN_Logger::log_logmatch_info(".fdd_rscpmin"); single_value->field_fdd__rscpmin.log_match(match_value.fdd__rscpmin(), 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("{ fdd_qmin_offset := "); single_value->field_fdd__qmin__offset.log_match(match_value.fdd__qmin__offset(), legacy); TTCN_Logger::log_event_str(", fdd_rscpmin := "); single_value->field_fdd__rscpmin.log_match(match_value.fdd__rscpmin(), 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 UMTS__AddMeasParamsDesc_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (fdd__qmin__offset().is_bound()) fdd__qmin__offset().set_implicit_omit(); if (fdd__rscpmin().is_bound()) fdd__rscpmin().set_implicit_omit(); } void UMTS__AddMeasParamsDesc_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_fdd__qmin__offset.encode_text(text_buf); single_value->field_fdd__rscpmin.encode_text(text_buf); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc."); } } void UMTS__AddMeasParamsDesc_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_fdd__qmin__offset.decode_text(text_buf); single_value->field_fdd__rscpmin.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 UMTS__AddMeasParamsDesc_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc."); } } void UMTS__AddMeasParamsDesc_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: { UMTS__AddMeasParamsDesc_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) fdd__qmin__offset().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) fdd__rscpmin().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(), "fdd_qmin_offset")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { fdd__qmin__offset().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "fdd_rscpmin")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { fdd__rscpmin().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.UMTS_AddMeasParamsDesc: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { UMTS__AddMeasParamsDesc_template* precondition = new UMTS__AddMeasParamsDesc_template; precondition->set_param(*param.get_elem(0)); UMTS__AddMeasParamsDesc_template* implied_template = new UMTS__AddMeasParamsDesc_template; implied_template->set_param(*param.get_elem(1)); *this = UMTS__AddMeasParamsDesc_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.UMTS_AddMeasParamsDesc"); } is_ifpresent = param.get_ifpresent(); } void UMTS__AddMeasParamsDesc_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_fdd__qmin__offset.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.UMTS_AddMeasParamsDesc"); single_value->field_fdd__rscpmin.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.UMTS_AddMeasParamsDesc"); return; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@GSM_RestOctets.UMTS_AddMeasParamsDesc"); } boolean UMTS__AddMeasParamsDesc_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean UMTS__AddMeasParamsDesc_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_desc) : field_presence(par_presence), field_desc(par_desc) { } UMTS__AddMeasParamsDesc2Opt::UMTS__AddMeasParamsDesc2Opt(const UMTS__AddMeasParamsDesc2Opt& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.UMTS_AddMeasParamsDesc2Opt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.desc().is_bound()) field_desc = other_value.desc(); else field_desc.clean_up(); } void UMTS__AddMeasParamsDesc2Opt::clean_up() { field_presence.clean_up(); field_desc.clean_up(); } const TTCN_Typedescriptor_t* UMTS__AddMeasParamsDesc2Opt::get_descriptor() const { return &UMTS__AddMeasParamsDesc2Opt_descr_; } UMTS__AddMeasParamsDesc2Opt& UMTS__AddMeasParamsDesc2Opt::operator=(const UMTS__AddMeasParamsDesc2Opt& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.UMTS_AddMeasParamsDesc2Opt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.desc().is_bound()) field_desc = other_value.desc(); else field_desc.clean_up(); } return *this; } boolean UMTS__AddMeasParamsDesc2Opt::operator==(const UMTS__AddMeasParamsDesc2Opt& other_value) const { return field_presence==other_value.field_presence && field_desc==other_value.field_desc; } boolean UMTS__AddMeasParamsDesc2Opt::is_bound() const { return (field_presence.is_bound()) || (OPTIONAL_OMIT == field_desc.get_selection() || field_desc.is_bound()); } boolean UMTS__AddMeasParamsDesc2Opt::is_value() const { return field_presence.is_value() && (OPTIONAL_OMIT == field_desc.get_selection() || field_desc.is_value()); } int UMTS__AddMeasParamsDesc2Opt::size_of() const { int ret_val = 1; if (field_desc.ispresent()) ret_val++; return ret_val; } void UMTS__AddMeasParamsDesc2Opt::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ presence := "); field_presence.log(); TTCN_Logger::log_event_str(", desc := "); field_desc.log(); TTCN_Logger::log_event_str(" }"); } void UMTS__AddMeasParamsDesc2Opt::set_implicit_omit() { if (presence().is_bound()) presence().set_implicit_omit(); if (!desc().is_bound()) desc() = OMIT_VALUE; else desc().set_implicit_omit(); } void UMTS__AddMeasParamsDesc2Opt::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) presence().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) desc().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(), "presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.UMTS_AddMeasParamsDesc2Opt: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.UMTS_AddMeasParamsDesc2Opt"); } } void UMTS__AddMeasParamsDesc2Opt::encode_text(Text_Buf& text_buf) const { field_presence.encode_text(text_buf); field_desc.encode_text(text_buf); } void UMTS__AddMeasParamsDesc2Opt::decode_text(Text_Buf& text_buf) { field_presence.decode_text(text_buf); field_desc.decode_text(text_buf); } void UMTS__AddMeasParamsDesc2Opt::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name); if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); PER_encode(p_td, p_buf, opt); break; } default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void UMTS__AddMeasParamsDesc2Opt::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name); if(!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); try { PER_decode(p_td, p_buf, opt); p_buf.PER_octet_align(FALSE); } catch (PER_Buffer_Exception) { } break; } default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int UMTS__AddMeasParamsDesc2Opt::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, UMTS__AddMeasParamsDesc2Opt_presence_descr_.raw->forceomit); decoded_field_length = field_presence.RAW_decode(UMTS__AddMeasParamsDesc2Opt_presence_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); if (limit > 0 && field_presence == bs_0){ if (force_omit != NULL && (*force_omit)(1)) { field_desc = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_1_force_omit(1, force_omit, UMTS__AddMeasParamsDesc2Opt_desc_descr_.raw->forceomit); decoded_field_length = field_desc().RAW_decode(UMTS__AddMeasParamsDesc2Opt_desc_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 1) { field_desc = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } else field_desc=OMIT_VALUE; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int UMTS__AddMeasParamsDesc2Opt::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, UMTS__AddMeasParamsDesc2Opt_presence_descr_.raw); if (field_desc.ispresent()) { myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, UMTS__AddMeasParamsDesc2Opt_desc_descr_.raw); } else myleaf.body.node.nodes[1] = NULL; encoded_length += field_presence.RAW_encode(UMTS__AddMeasParamsDesc2Opt_presence_descr_, *myleaf.body.node.nodes[0]); if (field_desc.ispresent()) { encoded_length += field_desc().RAW_encode(UMTS__AddMeasParamsDesc2Opt_desc_descr_, *myleaf.body.node.nodes[1]); } if (field_desc.ispresent() && (field_presence != bs_0)) { 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){ bs_0.RAW_encode(UMTS__AddMeasParamsDesc2Opt_presence_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 UMTS__AddMeasParamsDesc2Opt_template::single_value_struct { BITSTRING_template field_presence; UMTS__AddMeasParamsDesc_template field_desc; }; void UMTS__AddMeasParamsDesc2Opt_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_presence = ANY_VALUE; single_value->field_desc = ANY_OR_OMIT; } } } void UMTS__AddMeasParamsDesc2Opt_template::copy_value(const UMTS__AddMeasParamsDesc2Opt& other_value) { single_value = new single_value_struct; if (other_value.presence().is_bound()) { single_value->field_presence = other_value.presence(); } else { single_value->field_presence.clean_up(); } if (other_value.desc().is_bound()) { if (other_value.desc().ispresent()) single_value->field_desc = other_value.desc()(); else single_value->field_desc = OMIT_VALUE; } else { single_value->field_desc.clean_up(); } set_selection(SPECIFIC_VALUE); } void UMTS__AddMeasParamsDesc2Opt_template::copy_template(const UMTS__AddMeasParamsDesc2Opt_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.presence().get_selection()) { single_value->field_presence = other_value.presence(); } else { single_value->field_presence.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.desc().get_selection()) { single_value->field_desc = other_value.desc(); } else { single_value->field_desc.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 UMTS__AddMeasParamsDesc2Opt_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 UMTS__AddMeasParamsDesc2Opt_template(*other_value.implication_.precondition); implication_.implied_template = new UMTS__AddMeasParamsDesc2Opt_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc2Opt."); break; } set_selection(other_value); } UMTS__AddMeasParamsDesc2Opt_template::UMTS__AddMeasParamsDesc2Opt_template() { } UMTS__AddMeasParamsDesc2Opt_template::UMTS__AddMeasParamsDesc2Opt_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } UMTS__AddMeasParamsDesc2Opt_template::UMTS__AddMeasParamsDesc2Opt_template(const UMTS__AddMeasParamsDesc2Opt& other_value) { copy_value(other_value); } UMTS__AddMeasParamsDesc2Opt_template::UMTS__AddMeasParamsDesc2Opt_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const UMTS__AddMeasParamsDesc2Opt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc2Opt from an unbound optional field."); } } UMTS__AddMeasParamsDesc2Opt_template::UMTS__AddMeasParamsDesc2Opt_template(UMTS__AddMeasParamsDesc2Opt_template* p_precondition, UMTS__AddMeasParamsDesc2Opt_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } UMTS__AddMeasParamsDesc2Opt_template::UMTS__AddMeasParamsDesc2Opt_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; } UMTS__AddMeasParamsDesc2Opt_template::UMTS__AddMeasParamsDesc2Opt_template(const UMTS__AddMeasParamsDesc2Opt_template& other_value) : Base_Template() { copy_template(other_value); } UMTS__AddMeasParamsDesc2Opt_template::~UMTS__AddMeasParamsDesc2Opt_template() { clean_up(); } UMTS__AddMeasParamsDesc2Opt_template& UMTS__AddMeasParamsDesc2Opt_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } UMTS__AddMeasParamsDesc2Opt_template& UMTS__AddMeasParamsDesc2Opt_template::operator=(const UMTS__AddMeasParamsDesc2Opt& other_value) { clean_up(); copy_value(other_value); return *this; } UMTS__AddMeasParamsDesc2Opt_template& UMTS__AddMeasParamsDesc2Opt_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const UMTS__AddMeasParamsDesc2Opt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc2Opt."); } return *this; } UMTS__AddMeasParamsDesc2Opt_template& UMTS__AddMeasParamsDesc2Opt_template::operator=(const UMTS__AddMeasParamsDesc2Opt_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean UMTS__AddMeasParamsDesc2Opt_template::match(const UMTS__AddMeasParamsDesc2Opt& 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.presence().is_bound()) return FALSE; if(!single_value->field_presence.match(other_value.presence(), legacy))return FALSE; if(!other_value.desc().is_bound()) return FALSE; if((other_value.desc().ispresent() ? !single_value->field_desc.match((const UMTS__AddMeasParamsDesc&)other_value.desc(), legacy) : !single_value->field_desc.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 @GSM_RestOctets.UMTS_AddMeasParamsDesc2Opt."); } return FALSE; } boolean UMTS__AddMeasParamsDesc2Opt_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_presence.is_bound() || (single_value->field_desc.is_omit() || single_value->field_desc.is_bound()); } boolean UMTS__AddMeasParamsDesc2Opt_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_presence.is_value() && (single_value->field_desc.is_omit() || single_value->field_desc.is_value()); } void UMTS__AddMeasParamsDesc2Opt_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; } UMTS__AddMeasParamsDesc2Opt UMTS__AddMeasParamsDesc2Opt_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc2Opt."); UMTS__AddMeasParamsDesc2Opt ret_val; if (single_value->field_presence.is_bound()) { ret_val.presence() = single_value->field_presence.valueof(); } if (single_value->field_desc.is_omit()) ret_val.desc() = OMIT_VALUE; else if (single_value->field_desc.is_bound()) { ret_val.desc() = single_value->field_desc.valueof(); } return ret_val; } void UMTS__AddMeasParamsDesc2Opt_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list for a template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc2Opt."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new UMTS__AddMeasParamsDesc2Opt_template[list_length]; } UMTS__AddMeasParamsDesc2Opt_template& UMTS__AddMeasParamsDesc2Opt_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element of a non-list template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc2Opt."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc2Opt."); return value_list.list_value[list_index]; } BITSTRING_template& UMTS__AddMeasParamsDesc2Opt_template::presence() { set_specific(); return single_value->field_presence; } const BITSTRING_template& UMTS__AddMeasParamsDesc2Opt_template::presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field presence of a non-specific template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc2Opt."); return single_value->field_presence; } UMTS__AddMeasParamsDesc_template& UMTS__AddMeasParamsDesc2Opt_template::desc() { set_specific(); return single_value->field_desc; } const UMTS__AddMeasParamsDesc_template& UMTS__AddMeasParamsDesc2Opt_template::desc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field desc of a non-specific template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc2Opt."); return single_value->field_desc; } int UMTS__AddMeasParamsDesc2Opt_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc2Opt which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 1; if (single_value->field_desc.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 @GSM_RestOctets.UMTS_AddMeasParamsDesc2Opt containing an empty list."); int item_size = value_list.list_value[0].size_of(); for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++) { if (value_list.list_value[l_idx].size_of()!=item_size) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc2Opt containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc2Opt containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc2Opt containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc2Opt containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc2Opt containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc2Opt containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc2Opt containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc2Opt."); } return 0; } void UMTS__AddMeasParamsDesc2Opt_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ presence := "); single_value->field_presence.log(); TTCN_Logger::log_event_str(", desc := "); single_value->field_desc.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 UMTS__AddMeasParamsDesc2Opt_template::log_match(const UMTS__AddMeasParamsDesc2Opt& 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_presence.match(match_value.presence(), legacy)){ TTCN_Logger::log_logmatch_info(".presence"); single_value->field_presence.log_match(match_value.presence(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.desc().ispresent()){ if(!single_value->field_desc.match(match_value.desc(), legacy)){ TTCN_Logger::log_logmatch_info(".desc"); single_value->field_desc.log_match(match_value.desc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_desc.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".desc := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_desc.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("{ presence := "); single_value->field_presence.log_match(match_value.presence(), legacy); TTCN_Logger::log_event_str(", desc := "); if (match_value.desc().ispresent()) { single_value->field_desc.log_match(match_value.desc(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_desc.log(); if (single_value->field_desc.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 UMTS__AddMeasParamsDesc2Opt_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (presence().is_bound()) presence().set_implicit_omit(); if (!desc().is_bound()) desc() = OMIT_VALUE; else desc().set_implicit_omit(); } void UMTS__AddMeasParamsDesc2Opt_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_presence.encode_text(text_buf); single_value->field_desc.encode_text(text_buf); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc2Opt."); } } void UMTS__AddMeasParamsDesc2Opt_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_presence.decode_text(text_buf); single_value->field_desc.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 UMTS__AddMeasParamsDesc2Opt_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc2Opt."); } } void UMTS__AddMeasParamsDesc2Opt_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: { UMTS__AddMeasParamsDesc2Opt_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) presence().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) desc().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(), "presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.UMTS_AddMeasParamsDesc2Opt: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { UMTS__AddMeasParamsDesc2Opt_template* precondition = new UMTS__AddMeasParamsDesc2Opt_template; precondition->set_param(*param.get_elem(0)); UMTS__AddMeasParamsDesc2Opt_template* implied_template = new UMTS__AddMeasParamsDesc2Opt_template; implied_template->set_param(*param.get_elem(1)); *this = UMTS__AddMeasParamsDesc2Opt_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.UMTS_AddMeasParamsDesc2Opt"); } is_ifpresent = param.get_ifpresent(); } void UMTS__AddMeasParamsDesc2Opt_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_presence.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.UMTS_AddMeasParamsDesc2Opt"); single_value->field_desc.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.UMTS_AddMeasParamsDesc2Opt"); return; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@GSM_RestOctets.UMTS_AddMeasParamsDesc2Opt"); } boolean UMTS__AddMeasParamsDesc2Opt_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean UMTS__AddMeasParamsDesc2Opt_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_rel6) : field_umts__add__meas__params__desc(par_umts__add__meas__params__desc), field_umts__add__meas__params__desc2(par_umts__add__meas__params__desc2), field_rel6__presence(par_rel6__presence), field_rel6(par_rel6) { } SI2quaterR5Additions::SI2quaterR5Additions(const SI2quaterR5Additions& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.SI2quaterR5Additions."); if (other_value.umts__add__meas__params__desc().is_bound()) field_umts__add__meas__params__desc = other_value.umts__add__meas__params__desc(); else field_umts__add__meas__params__desc.clean_up(); if (other_value.umts__add__meas__params__desc2().is_bound()) field_umts__add__meas__params__desc2 = other_value.umts__add__meas__params__desc2(); else field_umts__add__meas__params__desc2.clean_up(); if (other_value.rel6__presence().is_bound()) field_rel6__presence = other_value.rel6__presence(); else field_rel6__presence.clean_up(); if (other_value.rel6().is_bound()) field_rel6 = other_value.rel6(); else field_rel6.clean_up(); } void SI2quaterR5Additions::clean_up() { field_umts__add__meas__params__desc.clean_up(); field_umts__add__meas__params__desc2.clean_up(); field_rel6__presence.clean_up(); field_rel6.clean_up(); } const TTCN_Typedescriptor_t* SI2quaterR5Additions::get_descriptor() const { return &SI2quaterR5Additions_descr_; } SI2quaterR5Additions& SI2quaterR5Additions::operator=(const SI2quaterR5Additions& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.SI2quaterR5Additions."); if (other_value.umts__add__meas__params__desc().is_bound()) field_umts__add__meas__params__desc = other_value.umts__add__meas__params__desc(); else field_umts__add__meas__params__desc.clean_up(); if (other_value.umts__add__meas__params__desc2().is_bound()) field_umts__add__meas__params__desc2 = other_value.umts__add__meas__params__desc2(); else field_umts__add__meas__params__desc2.clean_up(); if (other_value.rel6__presence().is_bound()) field_rel6__presence = other_value.rel6__presence(); else field_rel6__presence.clean_up(); if (other_value.rel6().is_bound()) field_rel6 = other_value.rel6(); else field_rel6.clean_up(); } return *this; } boolean SI2quaterR5Additions::operator==(const SI2quaterR5Additions& other_value) const { return field_umts__add__meas__params__desc==other_value.field_umts__add__meas__params__desc && field_umts__add__meas__params__desc2==other_value.field_umts__add__meas__params__desc2 && field_rel6__presence==other_value.field_rel6__presence && field_rel6==other_value.field_rel6; } boolean SI2quaterR5Additions::is_bound() const { return (field_umts__add__meas__params__desc.is_bound()) || (field_umts__add__meas__params__desc2.is_bound()) || (field_rel6__presence.is_bound()) || (OPTIONAL_OMIT == field_rel6.get_selection() || field_rel6.is_bound()); } boolean SI2quaterR5Additions::is_value() const { return field_umts__add__meas__params__desc.is_value() && field_umts__add__meas__params__desc2.is_value() && field_rel6__presence.is_value() && (OPTIONAL_OMIT == field_rel6.get_selection() || field_rel6.is_value()); } int SI2quaterR5Additions::size_of() const { int ret_val = 3; if (field_rel6.ispresent()) ret_val++; return ret_val; } void SI2quaterR5Additions::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ umts_add_meas_params_desc := "); field_umts__add__meas__params__desc.log(); TTCN_Logger::log_event_str(", umts_add_meas_params_desc2 := "); field_umts__add__meas__params__desc2.log(); TTCN_Logger::log_event_str(", rel6_presence := "); field_rel6__presence.log(); TTCN_Logger::log_event_str(", rel6 := "); field_rel6.log(); TTCN_Logger::log_event_str(" }"); } void SI2quaterR5Additions::set_implicit_omit() { if (umts__add__meas__params__desc().is_bound()) umts__add__meas__params__desc().set_implicit_omit(); if (umts__add__meas__params__desc2().is_bound()) umts__add__meas__params__desc2().set_implicit_omit(); if (rel6__presence().is_bound()) rel6__presence().set_implicit_omit(); if (!rel6().is_bound()) rel6() = OMIT_VALUE; else rel6().set_implicit_omit(); } void SI2quaterR5Additions::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) umts__add__meas__params__desc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) umts__add__meas__params__desc2().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) rel6__presence().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) rel6().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(), "umts_add_meas_params_desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { umts__add__meas__params__desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "umts_add_meas_params_desc2")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { umts__add__meas__params__desc2().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "rel6_presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rel6__presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "rel6")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rel6().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.SI2quaterR5Additions: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.SI2quaterR5Additions"); } } void SI2quaterR5Additions::encode_text(Text_Buf& text_buf) const { field_umts__add__meas__params__desc.encode_text(text_buf); field_umts__add__meas__params__desc2.encode_text(text_buf); field_rel6__presence.encode_text(text_buf); field_rel6.encode_text(text_buf); } void SI2quaterR5Additions::decode_text(Text_Buf& text_buf) { field_umts__add__meas__params__desc.decode_text(text_buf); field_umts__add__meas__params__desc2.decode_text(text_buf); field_rel6__presence.decode_text(text_buf); field_rel6.decode_text(text_buf); } void SI2quaterR5Additions::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name); if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); PER_encode(p_td, p_buf, opt); break; } default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void SI2quaterR5Additions::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name); if(!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); try { PER_decode(p_td, p_buf, opt); p_buf.PER_octet_align(FALSE); } catch (PER_Buffer_Exception) { } break; } default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int SI2quaterR5Additions::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, SI2quaterR5Additions_umts__add__meas__params__desc_descr_.raw->forceomit); decoded_field_length = field_umts__add__meas__params__desc.RAW_decode(SI2quaterR5Additions_umts__add__meas__params__desc_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, SI2quaterR5Additions_umts__add__meas__params__desc2_descr_.raw->forceomit); decoded_field_length = field_umts__add__meas__params__desc2.RAW_decode(SI2quaterR5Additions_umts__add__meas__params__desc2_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, SI2quaterR5Additions_rel6__presence_descr_.raw->forceomit); decoded_field_length = field_rel6__presence.RAW_decode(SI2quaterR5Additions_rel6__presence_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_2_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); if (limit > 0 && field_rel6__presence == bs_0){ if (force_omit != NULL && (*force_omit)(3)) { field_rel6 = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_3_force_omit(3, force_omit, SI2quaterR5Additions_rel6_descr_.raw->forceomit); decoded_field_length = field_rel6().RAW_decode(SI2quaterR5Additions_rel6_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_3_force_omit); if (decoded_field_length < 1) { field_rel6 = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } else field_rel6=OMIT_VALUE; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int SI2quaterR5Additions::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, SI2quaterR5Additions_umts__add__meas__params__desc_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, SI2quaterR5Additions_umts__add__meas__params__desc2_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, SI2quaterR5Additions_rel6__presence_descr_.raw); if (field_rel6.ispresent()) { myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, SI2quaterR5Additions_rel6_descr_.raw); } else myleaf.body.node.nodes[3] = NULL; encoded_length += field_umts__add__meas__params__desc.RAW_encode(SI2quaterR5Additions_umts__add__meas__params__desc_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_umts__add__meas__params__desc2.RAW_encode(SI2quaterR5Additions_umts__add__meas__params__desc2_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_rel6__presence.RAW_encode(SI2quaterR5Additions_rel6__presence_descr_, *myleaf.body.node.nodes[2]); if (field_rel6.ispresent()) { encoded_length += field_rel6().RAW_encode(SI2quaterR5Additions_rel6_descr_, *myleaf.body.node.nodes[3]); } if (field_rel6.ispresent() && (field_rel6__presence != bs_0)) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={2}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ bs_0.RAW_encode(SI2quaterR5Additions_rel6__presence_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 SI2quaterR5Additions_template::single_value_struct { UMTS__AddMeasParamsDescOpt_template field_umts__add__meas__params__desc; UMTS__AddMeasParamsDesc2Opt_template field_umts__add__meas__params__desc2; BITSTRING_template field_rel6__presence; SI2quaterR6Additions_template field_rel6; }; void SI2quaterR5Additions_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_umts__add__meas__params__desc = ANY_VALUE; single_value->field_umts__add__meas__params__desc2 = ANY_VALUE; single_value->field_rel6__presence = ANY_VALUE; single_value->field_rel6 = ANY_OR_OMIT; } } } void SI2quaterR5Additions_template::copy_value(const SI2quaterR5Additions& other_value) { single_value = new single_value_struct; if (other_value.umts__add__meas__params__desc().is_bound()) { single_value->field_umts__add__meas__params__desc = other_value.umts__add__meas__params__desc(); } else { single_value->field_umts__add__meas__params__desc.clean_up(); } if (other_value.umts__add__meas__params__desc2().is_bound()) { single_value->field_umts__add__meas__params__desc2 = other_value.umts__add__meas__params__desc2(); } else { single_value->field_umts__add__meas__params__desc2.clean_up(); } if (other_value.rel6__presence().is_bound()) { single_value->field_rel6__presence = other_value.rel6__presence(); } else { single_value->field_rel6__presence.clean_up(); } if (other_value.rel6().is_bound()) { if (other_value.rel6().ispresent()) single_value->field_rel6 = other_value.rel6()(); else single_value->field_rel6 = OMIT_VALUE; } else { single_value->field_rel6.clean_up(); } set_selection(SPECIFIC_VALUE); } void SI2quaterR5Additions_template::copy_template(const SI2quaterR5Additions_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.umts__add__meas__params__desc().get_selection()) { single_value->field_umts__add__meas__params__desc = other_value.umts__add__meas__params__desc(); } else { single_value->field_umts__add__meas__params__desc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.umts__add__meas__params__desc2().get_selection()) { single_value->field_umts__add__meas__params__desc2 = other_value.umts__add__meas__params__desc2(); } else { single_value->field_umts__add__meas__params__desc2.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.rel6__presence().get_selection()) { single_value->field_rel6__presence = other_value.rel6__presence(); } else { single_value->field_rel6__presence.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.rel6().get_selection()) { single_value->field_rel6 = other_value.rel6(); } else { single_value->field_rel6.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 SI2quaterR5Additions_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 SI2quaterR5Additions_template(*other_value.implication_.precondition); implication_.implied_template = new SI2quaterR5Additions_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of type @GSM_RestOctets.SI2quaterR5Additions."); break; } set_selection(other_value); } SI2quaterR5Additions_template::SI2quaterR5Additions_template() { } SI2quaterR5Additions_template::SI2quaterR5Additions_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } SI2quaterR5Additions_template::SI2quaterR5Additions_template(const SI2quaterR5Additions& other_value) { copy_value(other_value); } SI2quaterR5Additions_template::SI2quaterR5Additions_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI2quaterR5Additions&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.SI2quaterR5Additions from an unbound optional field."); } } SI2quaterR5Additions_template::SI2quaterR5Additions_template(SI2quaterR5Additions_template* p_precondition, SI2quaterR5Additions_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } SI2quaterR5Additions_template::SI2quaterR5Additions_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; } SI2quaterR5Additions_template::SI2quaterR5Additions_template(const SI2quaterR5Additions_template& other_value) : Base_Template() { copy_template(other_value); } SI2quaterR5Additions_template::~SI2quaterR5Additions_template() { clean_up(); } SI2quaterR5Additions_template& SI2quaterR5Additions_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } SI2quaterR5Additions_template& SI2quaterR5Additions_template::operator=(const SI2quaterR5Additions& other_value) { clean_up(); copy_value(other_value); return *this; } SI2quaterR5Additions_template& SI2quaterR5Additions_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI2quaterR5Additions&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @GSM_RestOctets.SI2quaterR5Additions."); } return *this; } SI2quaterR5Additions_template& SI2quaterR5Additions_template::operator=(const SI2quaterR5Additions_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean SI2quaterR5Additions_template::match(const SI2quaterR5Additions& 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.umts__add__meas__params__desc().is_bound()) return FALSE; if(!single_value->field_umts__add__meas__params__desc.match(other_value.umts__add__meas__params__desc(), legacy))return FALSE; if(!other_value.umts__add__meas__params__desc2().is_bound()) return FALSE; if(!single_value->field_umts__add__meas__params__desc2.match(other_value.umts__add__meas__params__desc2(), legacy))return FALSE; if(!other_value.rel6__presence().is_bound()) return FALSE; if(!single_value->field_rel6__presence.match(other_value.rel6__presence(), legacy))return FALSE; if(!other_value.rel6().is_bound()) return FALSE; if((other_value.rel6().ispresent() ? !single_value->field_rel6.match((const SI2quaterR6Additions&)other_value.rel6(), legacy) : !single_value->field_rel6.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 @GSM_RestOctets.SI2quaterR5Additions."); } return FALSE; } boolean SI2quaterR5Additions_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_umts__add__meas__params__desc.is_bound() || single_value->field_umts__add__meas__params__desc2.is_bound() || single_value->field_rel6__presence.is_bound() || (single_value->field_rel6.is_omit() || single_value->field_rel6.is_bound()); } boolean SI2quaterR5Additions_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_umts__add__meas__params__desc.is_value() && single_value->field_umts__add__meas__params__desc2.is_value() && single_value->field_rel6__presence.is_value() && (single_value->field_rel6.is_omit() || single_value->field_rel6.is_value()); } void SI2quaterR5Additions_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; } SI2quaterR5Additions SI2quaterR5Additions_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @GSM_RestOctets.SI2quaterR5Additions."); SI2quaterR5Additions ret_val; if (single_value->field_umts__add__meas__params__desc.is_bound()) { ret_val.umts__add__meas__params__desc() = single_value->field_umts__add__meas__params__desc.valueof(); } if (single_value->field_umts__add__meas__params__desc2.is_bound()) { ret_val.umts__add__meas__params__desc2() = single_value->field_umts__add__meas__params__desc2.valueof(); } if (single_value->field_rel6__presence.is_bound()) { ret_val.rel6__presence() = single_value->field_rel6__presence.valueof(); } if (single_value->field_rel6.is_omit()) ret_val.rel6() = OMIT_VALUE; else if (single_value->field_rel6.is_bound()) { ret_val.rel6() = single_value->field_rel6.valueof(); } return ret_val; } void SI2quaterR5Additions_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list for a template of type @GSM_RestOctets.SI2quaterR5Additions."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new SI2quaterR5Additions_template[list_length]; } SI2quaterR5Additions_template& SI2quaterR5Additions_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element of a non-list template of type @GSM_RestOctets.SI2quaterR5Additions."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.SI2quaterR5Additions."); return value_list.list_value[list_index]; } UMTS__AddMeasParamsDescOpt_template& SI2quaterR5Additions_template::umts__add__meas__params__desc() { set_specific(); return single_value->field_umts__add__meas__params__desc; } const UMTS__AddMeasParamsDescOpt_template& SI2quaterR5Additions_template::umts__add__meas__params__desc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field umts_add_meas_params_desc of a non-specific template of type @GSM_RestOctets.SI2quaterR5Additions."); return single_value->field_umts__add__meas__params__desc; } UMTS__AddMeasParamsDesc2Opt_template& SI2quaterR5Additions_template::umts__add__meas__params__desc2() { set_specific(); return single_value->field_umts__add__meas__params__desc2; } const UMTS__AddMeasParamsDesc2Opt_template& SI2quaterR5Additions_template::umts__add__meas__params__desc2() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field umts_add_meas_params_desc2 of a non-specific template of type @GSM_RestOctets.SI2quaterR5Additions."); return single_value->field_umts__add__meas__params__desc2; } BITSTRING_template& SI2quaterR5Additions_template::rel6__presence() { set_specific(); return single_value->field_rel6__presence; } const BITSTRING_template& SI2quaterR5Additions_template::rel6__presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field rel6_presence of a non-specific template of type @GSM_RestOctets.SI2quaterR5Additions."); return single_value->field_rel6__presence; } SI2quaterR6Additions_template& SI2quaterR5Additions_template::rel6() { set_specific(); return single_value->field_rel6; } const SI2quaterR6Additions_template& SI2quaterR5Additions_template::rel6() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field rel6 of a non-specific template of type @GSM_RestOctets.SI2quaterR5Additions."); return single_value->field_rel6; } int SI2quaterR5Additions_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterR5Additions which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 3; if (single_value->field_rel6.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 @GSM_RestOctets.SI2quaterR5Additions containing an empty list."); int item_size = value_list.list_value[0].size_of(); for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++) { if (value_list.list_value[l_idx].size_of()!=item_size) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterR5Additions containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterR5Additions containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterR5Additions containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterR5Additions containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterR5Additions containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterR5Additions containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterR5Additions containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.SI2quaterR5Additions."); } return 0; } void SI2quaterR5Additions_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ umts_add_meas_params_desc := "); single_value->field_umts__add__meas__params__desc.log(); TTCN_Logger::log_event_str(", umts_add_meas_params_desc2 := "); single_value->field_umts__add__meas__params__desc2.log(); TTCN_Logger::log_event_str(", rel6_presence := "); single_value->field_rel6__presence.log(); TTCN_Logger::log_event_str(", rel6 := "); single_value->field_rel6.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 SI2quaterR5Additions_template::log_match(const SI2quaterR5Additions& 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_umts__add__meas__params__desc.match(match_value.umts__add__meas__params__desc(), legacy)){ TTCN_Logger::log_logmatch_info(".umts_add_meas_params_desc"); single_value->field_umts__add__meas__params__desc.log_match(match_value.umts__add__meas__params__desc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_umts__add__meas__params__desc2.match(match_value.umts__add__meas__params__desc2(), legacy)){ TTCN_Logger::log_logmatch_info(".umts_add_meas_params_desc2"); single_value->field_umts__add__meas__params__desc2.log_match(match_value.umts__add__meas__params__desc2(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_rel6__presence.match(match_value.rel6__presence(), legacy)){ TTCN_Logger::log_logmatch_info(".rel6_presence"); single_value->field_rel6__presence.log_match(match_value.rel6__presence(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.rel6().ispresent()){ if(!single_value->field_rel6.match(match_value.rel6(), legacy)){ TTCN_Logger::log_logmatch_info(".rel6"); single_value->field_rel6.log_match(match_value.rel6(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_rel6.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".rel6 := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_rel6.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("{ umts_add_meas_params_desc := "); single_value->field_umts__add__meas__params__desc.log_match(match_value.umts__add__meas__params__desc(), legacy); TTCN_Logger::log_event_str(", umts_add_meas_params_desc2 := "); single_value->field_umts__add__meas__params__desc2.log_match(match_value.umts__add__meas__params__desc2(), legacy); TTCN_Logger::log_event_str(", rel6_presence := "); single_value->field_rel6__presence.log_match(match_value.rel6__presence(), legacy); TTCN_Logger::log_event_str(", rel6 := "); if (match_value.rel6().ispresent()) { single_value->field_rel6.log_match(match_value.rel6(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_rel6.log(); if (single_value->field_rel6.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 SI2quaterR5Additions_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (umts__add__meas__params__desc().is_bound()) umts__add__meas__params__desc().set_implicit_omit(); if (umts__add__meas__params__desc2().is_bound()) umts__add__meas__params__desc2().set_implicit_omit(); if (rel6__presence().is_bound()) rel6__presence().set_implicit_omit(); if (!rel6().is_bound()) rel6() = OMIT_VALUE; else rel6().set_implicit_omit(); } void SI2quaterR5Additions_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_umts__add__meas__params__desc.encode_text(text_buf); single_value->field_umts__add__meas__params__desc2.encode_text(text_buf); single_value->field_rel6__presence.encode_text(text_buf); single_value->field_rel6.encode_text(text_buf); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @GSM_RestOctets.SI2quaterR5Additions."); } } void SI2quaterR5Additions_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_umts__add__meas__params__desc.decode_text(text_buf); single_value->field_umts__add__meas__params__desc2.decode_text(text_buf); single_value->field_rel6__presence.decode_text(text_buf); single_value->field_rel6.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 SI2quaterR5Additions_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @GSM_RestOctets.SI2quaterR5Additions."); } } void SI2quaterR5Additions_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: { SI2quaterR5Additions_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) umts__add__meas__params__desc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) umts__add__meas__params__desc2().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) rel6__presence().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) rel6().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(), "umts_add_meas_params_desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { umts__add__meas__params__desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "umts_add_meas_params_desc2")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { umts__add__meas__params__desc2().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "rel6_presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rel6__presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "rel6")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rel6().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.SI2quaterR5Additions: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { SI2quaterR5Additions_template* precondition = new SI2quaterR5Additions_template; precondition->set_param(*param.get_elem(0)); SI2quaterR5Additions_template* implied_template = new SI2quaterR5Additions_template; implied_template->set_param(*param.get_elem(1)); *this = SI2quaterR5Additions_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.SI2quaterR5Additions"); } is_ifpresent = param.get_ifpresent(); } void SI2quaterR5Additions_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_umts__add__meas__params__desc.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI2quaterR5Additions"); single_value->field_umts__add__meas__params__desc2.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI2quaterR5Additions"); single_value->field_rel6__presence.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI2quaterR5Additions"); single_value->field_rel6.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI2quaterR5Additions"); return; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@GSM_RestOctets.SI2quaterR5Additions"); } boolean SI2quaterR5Additions_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean SI2quaterR5Additions_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_rel7) : field_umts__ccn__active(par_umts__ccn__active), field_rel7__presence(par_rel7__presence), field_rel7(par_rel7) { } SI2quaterR6Additions::SI2quaterR6Additions(const SI2quaterR6Additions& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.SI2quaterR6Additions."); if (other_value.umts__ccn__active().is_bound()) field_umts__ccn__active = other_value.umts__ccn__active(); else field_umts__ccn__active.clean_up(); if (other_value.rel7__presence().is_bound()) field_rel7__presence = other_value.rel7__presence(); else field_rel7__presence.clean_up(); if (other_value.rel7().is_bound()) field_rel7 = other_value.rel7(); else field_rel7.clean_up(); } void SI2quaterR6Additions::clean_up() { field_umts__ccn__active.clean_up(); field_rel7__presence.clean_up(); field_rel7.clean_up(); } const TTCN_Typedescriptor_t* SI2quaterR6Additions::get_descriptor() const { return &SI2quaterR6Additions_descr_; } SI2quaterR6Additions& SI2quaterR6Additions::operator=(const SI2quaterR6Additions& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.SI2quaterR6Additions."); if (other_value.umts__ccn__active().is_bound()) field_umts__ccn__active = other_value.umts__ccn__active(); else field_umts__ccn__active.clean_up(); if (other_value.rel7__presence().is_bound()) field_rel7__presence = other_value.rel7__presence(); else field_rel7__presence.clean_up(); if (other_value.rel7().is_bound()) field_rel7 = other_value.rel7(); else field_rel7.clean_up(); } return *this; } boolean SI2quaterR6Additions::operator==(const SI2quaterR6Additions& other_value) const { return field_umts__ccn__active==other_value.field_umts__ccn__active && field_rel7__presence==other_value.field_rel7__presence && field_rel7==other_value.field_rel7; } boolean SI2quaterR6Additions::is_bound() const { return (field_umts__ccn__active.is_bound()) || (field_rel7__presence.is_bound()) || (OPTIONAL_OMIT == field_rel7.get_selection() || field_rel7.is_bound()); } boolean SI2quaterR6Additions::is_value() const { return field_umts__ccn__active.is_value() && field_rel7__presence.is_value() && (OPTIONAL_OMIT == field_rel7.get_selection() || field_rel7.is_value()); } int SI2quaterR6Additions::size_of() const { int ret_val = 2; if (field_rel7.ispresent()) ret_val++; return ret_val; } void SI2quaterR6Additions::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ umts_ccn_active := "); field_umts__ccn__active.log(); TTCN_Logger::log_event_str(", rel7_presence := "); field_rel7__presence.log(); TTCN_Logger::log_event_str(", rel7 := "); field_rel7.log(); TTCN_Logger::log_event_str(" }"); } void SI2quaterR6Additions::set_implicit_omit() { if (umts__ccn__active().is_bound()) umts__ccn__active().set_implicit_omit(); if (rel7__presence().is_bound()) rel7__presence().set_implicit_omit(); if (!rel7().is_bound()) rel7() = OMIT_VALUE; else rel7().set_implicit_omit(); } void SI2quaterR6Additions::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) umts__ccn__active().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) rel7__presence().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) rel7().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(), "umts_ccn_active")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { umts__ccn__active().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "rel7_presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rel7__presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "rel7")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rel7().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.SI2quaterR6Additions: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.SI2quaterR6Additions"); } } void SI2quaterR6Additions::encode_text(Text_Buf& text_buf) const { field_umts__ccn__active.encode_text(text_buf); field_rel7__presence.encode_text(text_buf); field_rel7.encode_text(text_buf); } void SI2quaterR6Additions::decode_text(Text_Buf& text_buf) { field_umts__ccn__active.decode_text(text_buf); field_rel7__presence.decode_text(text_buf); field_rel7.decode_text(text_buf); } void SI2quaterR6Additions::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name); if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); PER_encode(p_td, p_buf, opt); break; } default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void SI2quaterR6Additions::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name); if(!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); try { PER_decode(p_td, p_buf, opt); p_buf.PER_octet_align(FALSE); } catch (PER_Buffer_Exception) { } break; } default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int SI2quaterR6Additions::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, SI2quaterR6Additions_umts__ccn__active_descr_.raw->forceomit); decoded_field_length = field_umts__ccn__active.RAW_decode(SI2quaterR6Additions_umts__ccn__active_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, SI2quaterR6Additions_rel7__presence_descr_.raw->forceomit); decoded_field_length = field_rel7__presence.RAW_decode(SI2quaterR6Additions_rel7__presence_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); if (limit > 0 && field_rel7__presence == bs_0){ if (force_omit != NULL && (*force_omit)(2)) { field_rel7 = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_2_force_omit(2, force_omit, SI2quaterR6Additions_rel7_descr_.raw->forceomit); decoded_field_length = field_rel7().RAW_decode(SI2quaterR6Additions_rel7_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_2_force_omit); if (decoded_field_length < 1) { field_rel7 = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } else field_rel7=OMIT_VALUE; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int SI2quaterR6Additions::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, SI2quaterR6Additions_umts__ccn__active_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, SI2quaterR6Additions_rel7__presence_descr_.raw); if (field_rel7.ispresent()) { myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, SI2quaterR6Additions_rel7_descr_.raw); } else myleaf.body.node.nodes[2] = NULL; encoded_length += field_umts__ccn__active.RAW_encode(SI2quaterR6Additions_umts__ccn__active_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_rel7__presence.RAW_encode(SI2quaterR6Additions_rel7__presence_descr_, *myleaf.body.node.nodes[1]); if (field_rel7.ispresent()) { encoded_length += field_rel7().RAW_encode(SI2quaterR6Additions_rel7_descr_, *myleaf.body.node.nodes[2]); } if (field_rel7.ispresent() && (field_rel7__presence != bs_0)) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={1}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ bs_0.RAW_encode(SI2quaterR6Additions_rel7__presence_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 SI2quaterR6Additions_template::single_value_struct { BITSTRING_template field_umts__ccn__active; BITSTRING_template field_rel7__presence; SI2quaterR7Additions_template field_rel7; }; void SI2quaterR6Additions_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_umts__ccn__active = ANY_VALUE; single_value->field_rel7__presence = ANY_VALUE; single_value->field_rel7 = ANY_OR_OMIT; } } } void SI2quaterR6Additions_template::copy_value(const SI2quaterR6Additions& other_value) { single_value = new single_value_struct; if (other_value.umts__ccn__active().is_bound()) { single_value->field_umts__ccn__active = other_value.umts__ccn__active(); } else { single_value->field_umts__ccn__active.clean_up(); } if (other_value.rel7__presence().is_bound()) { single_value->field_rel7__presence = other_value.rel7__presence(); } else { single_value->field_rel7__presence.clean_up(); } if (other_value.rel7().is_bound()) { if (other_value.rel7().ispresent()) single_value->field_rel7 = other_value.rel7()(); else single_value->field_rel7 = OMIT_VALUE; } else { single_value->field_rel7.clean_up(); } set_selection(SPECIFIC_VALUE); } void SI2quaterR6Additions_template::copy_template(const SI2quaterR6Additions_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.umts__ccn__active().get_selection()) { single_value->field_umts__ccn__active = other_value.umts__ccn__active(); } else { single_value->field_umts__ccn__active.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.rel7__presence().get_selection()) { single_value->field_rel7__presence = other_value.rel7__presence(); } else { single_value->field_rel7__presence.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.rel7().get_selection()) { single_value->field_rel7 = other_value.rel7(); } else { single_value->field_rel7.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 SI2quaterR6Additions_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 SI2quaterR6Additions_template(*other_value.implication_.precondition); implication_.implied_template = new SI2quaterR6Additions_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of type @GSM_RestOctets.SI2quaterR6Additions."); break; } set_selection(other_value); } SI2quaterR6Additions_template::SI2quaterR6Additions_template() { } SI2quaterR6Additions_template::SI2quaterR6Additions_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } SI2quaterR6Additions_template::SI2quaterR6Additions_template(const SI2quaterR6Additions& other_value) { copy_value(other_value); } SI2quaterR6Additions_template::SI2quaterR6Additions_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI2quaterR6Additions&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.SI2quaterR6Additions from an unbound optional field."); } } SI2quaterR6Additions_template::SI2quaterR6Additions_template(SI2quaterR6Additions_template* p_precondition, SI2quaterR6Additions_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } SI2quaterR6Additions_template::SI2quaterR6Additions_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; } SI2quaterR6Additions_template::SI2quaterR6Additions_template(const SI2quaterR6Additions_template& other_value) : Base_Template() { copy_template(other_value); } SI2quaterR6Additions_template::~SI2quaterR6Additions_template() { clean_up(); } SI2quaterR6Additions_template& SI2quaterR6Additions_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } SI2quaterR6Additions_template& SI2quaterR6Additions_template::operator=(const SI2quaterR6Additions& other_value) { clean_up(); copy_value(other_value); return *this; } SI2quaterR6Additions_template& SI2quaterR6Additions_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI2quaterR6Additions&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @GSM_RestOctets.SI2quaterR6Additions."); } return *this; } SI2quaterR6Additions_template& SI2quaterR6Additions_template::operator=(const SI2quaterR6Additions_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean SI2quaterR6Additions_template::match(const SI2quaterR6Additions& 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.umts__ccn__active().is_bound()) return FALSE; if(!single_value->field_umts__ccn__active.match(other_value.umts__ccn__active(), legacy))return FALSE; if(!other_value.rel7__presence().is_bound()) return FALSE; if(!single_value->field_rel7__presence.match(other_value.rel7__presence(), legacy))return FALSE; if(!other_value.rel7().is_bound()) return FALSE; if((other_value.rel7().ispresent() ? !single_value->field_rel7.match((const SI2quaterR7Additions&)other_value.rel7(), legacy) : !single_value->field_rel7.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 @GSM_RestOctets.SI2quaterR6Additions."); } return FALSE; } boolean SI2quaterR6Additions_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_umts__ccn__active.is_bound() || single_value->field_rel7__presence.is_bound() || (single_value->field_rel7.is_omit() || single_value->field_rel7.is_bound()); } boolean SI2quaterR6Additions_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_umts__ccn__active.is_value() && single_value->field_rel7__presence.is_value() && (single_value->field_rel7.is_omit() || single_value->field_rel7.is_value()); } void SI2quaterR6Additions_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; } SI2quaterR6Additions SI2quaterR6Additions_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @GSM_RestOctets.SI2quaterR6Additions."); SI2quaterR6Additions ret_val; if (single_value->field_umts__ccn__active.is_bound()) { ret_val.umts__ccn__active() = single_value->field_umts__ccn__active.valueof(); } if (single_value->field_rel7__presence.is_bound()) { ret_val.rel7__presence() = single_value->field_rel7__presence.valueof(); } if (single_value->field_rel7.is_omit()) ret_val.rel7() = OMIT_VALUE; else if (single_value->field_rel7.is_bound()) { ret_val.rel7() = single_value->field_rel7.valueof(); } return ret_val; } void SI2quaterR6Additions_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list for a template of type @GSM_RestOctets.SI2quaterR6Additions."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new SI2quaterR6Additions_template[list_length]; } SI2quaterR6Additions_template& SI2quaterR6Additions_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element of a non-list template of type @GSM_RestOctets.SI2quaterR6Additions."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.SI2quaterR6Additions."); return value_list.list_value[list_index]; } BITSTRING_template& SI2quaterR6Additions_template::umts__ccn__active() { set_specific(); return single_value->field_umts__ccn__active; } const BITSTRING_template& SI2quaterR6Additions_template::umts__ccn__active() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field umts_ccn_active of a non-specific template of type @GSM_RestOctets.SI2quaterR6Additions."); return single_value->field_umts__ccn__active; } BITSTRING_template& SI2quaterR6Additions_template::rel7__presence() { set_specific(); return single_value->field_rel7__presence; } const BITSTRING_template& SI2quaterR6Additions_template::rel7__presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field rel7_presence of a non-specific template of type @GSM_RestOctets.SI2quaterR6Additions."); return single_value->field_rel7__presence; } SI2quaterR7Additions_template& SI2quaterR6Additions_template::rel7() { set_specific(); return single_value->field_rel7; } const SI2quaterR7Additions_template& SI2quaterR6Additions_template::rel7() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field rel7 of a non-specific template of type @GSM_RestOctets.SI2quaterR6Additions."); return single_value->field_rel7; } int SI2quaterR6Additions_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterR6Additions which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 2; if (single_value->field_rel7.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 @GSM_RestOctets.SI2quaterR6Additions containing an empty list."); int item_size = value_list.list_value[0].size_of(); for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++) { if (value_list.list_value[l_idx].size_of()!=item_size) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterR6Additions containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterR6Additions containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterR6Additions containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterR6Additions containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterR6Additions containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterR6Additions containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterR6Additions containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.SI2quaterR6Additions."); } return 0; } void SI2quaterR6Additions_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ umts_ccn_active := "); single_value->field_umts__ccn__active.log(); TTCN_Logger::log_event_str(", rel7_presence := "); single_value->field_rel7__presence.log(); TTCN_Logger::log_event_str(", rel7 := "); single_value->field_rel7.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 SI2quaterR6Additions_template::log_match(const SI2quaterR6Additions& 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_umts__ccn__active.match(match_value.umts__ccn__active(), legacy)){ TTCN_Logger::log_logmatch_info(".umts_ccn_active"); single_value->field_umts__ccn__active.log_match(match_value.umts__ccn__active(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_rel7__presence.match(match_value.rel7__presence(), legacy)){ TTCN_Logger::log_logmatch_info(".rel7_presence"); single_value->field_rel7__presence.log_match(match_value.rel7__presence(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.rel7().ispresent()){ if(!single_value->field_rel7.match(match_value.rel7(), legacy)){ TTCN_Logger::log_logmatch_info(".rel7"); single_value->field_rel7.log_match(match_value.rel7(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_rel7.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".rel7 := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_rel7.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("{ umts_ccn_active := "); single_value->field_umts__ccn__active.log_match(match_value.umts__ccn__active(), legacy); TTCN_Logger::log_event_str(", rel7_presence := "); single_value->field_rel7__presence.log_match(match_value.rel7__presence(), legacy); TTCN_Logger::log_event_str(", rel7 := "); if (match_value.rel7().ispresent()) { single_value->field_rel7.log_match(match_value.rel7(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_rel7.log(); if (single_value->field_rel7.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 SI2quaterR6Additions_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (umts__ccn__active().is_bound()) umts__ccn__active().set_implicit_omit(); if (rel7__presence().is_bound()) rel7__presence().set_implicit_omit(); if (!rel7().is_bound()) rel7() = OMIT_VALUE; else rel7().set_implicit_omit(); } void SI2quaterR6Additions_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_umts__ccn__active.encode_text(text_buf); single_value->field_rel7__presence.encode_text(text_buf); single_value->field_rel7.encode_text(text_buf); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @GSM_RestOctets.SI2quaterR6Additions."); } } void SI2quaterR6Additions_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_umts__ccn__active.decode_text(text_buf); single_value->field_rel7__presence.decode_text(text_buf); single_value->field_rel7.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 SI2quaterR6Additions_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @GSM_RestOctets.SI2quaterR6Additions."); } } void SI2quaterR6Additions_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: { SI2quaterR6Additions_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) umts__ccn__active().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) rel7__presence().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) rel7().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(), "umts_ccn_active")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { umts__ccn__active().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "rel7_presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rel7__presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "rel7")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rel7().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.SI2quaterR6Additions: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { SI2quaterR6Additions_template* precondition = new SI2quaterR6Additions_template; precondition->set_param(*param.get_elem(0)); SI2quaterR6Additions_template* implied_template = new SI2quaterR6Additions_template; implied_template->set_param(*param.get_elem(1)); *this = SI2quaterR6Additions_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.SI2quaterR6Additions"); } is_ifpresent = param.get_ifpresent(); } void SI2quaterR6Additions_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_umts__ccn__active.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI2quaterR6Additions"); single_value->field_rel7__presence.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI2quaterR6Additions"); single_value->field_rel7.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI2quaterR6Additions"); return; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@GSM_RestOctets.SI2quaterR6Additions"); } boolean SI2quaterR6Additions_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean SI2quaterR6Additions_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_val) : field_presence(par_presence), field_val(par_val) { } Rel7RepOffseThresholdOpt::Rel7RepOffseThresholdOpt(const Rel7RepOffseThresholdOpt& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.Rel7RepOffseThresholdOpt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.val().is_bound()) field_val = other_value.val(); else field_val.clean_up(); } void Rel7RepOffseThresholdOpt::clean_up() { field_presence.clean_up(); field_val.clean_up(); } const TTCN_Typedescriptor_t* Rel7RepOffseThresholdOpt::get_descriptor() const { return &Rel7RepOffseThresholdOpt_descr_; } Rel7RepOffseThresholdOpt& Rel7RepOffseThresholdOpt::operator=(const Rel7RepOffseThresholdOpt& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.Rel7RepOffseThresholdOpt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.val().is_bound()) field_val = other_value.val(); else field_val.clean_up(); } return *this; } boolean Rel7RepOffseThresholdOpt::operator==(const Rel7RepOffseThresholdOpt& other_value) const { return field_presence==other_value.field_presence && field_val==other_value.field_val; } boolean Rel7RepOffseThresholdOpt::is_bound() const { return (field_presence.is_bound()) || (OPTIONAL_OMIT == field_val.get_selection() || field_val.is_bound()); } boolean Rel7RepOffseThresholdOpt::is_value() const { return field_presence.is_value() && (OPTIONAL_OMIT == field_val.get_selection() || field_val.is_value()); } int Rel7RepOffseThresholdOpt::size_of() const { int ret_val = 1; if (field_val.ispresent()) ret_val++; return ret_val; } void Rel7RepOffseThresholdOpt::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ presence := "); field_presence.log(); TTCN_Logger::log_event_str(", val := "); field_val.log(); TTCN_Logger::log_event_str(" }"); } void Rel7RepOffseThresholdOpt::set_implicit_omit() { if (presence().is_bound()) presence().set_implicit_omit(); if (!val().is_bound()) val() = OMIT_VALUE; else val().set_implicit_omit(); } void Rel7RepOffseThresholdOpt::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) presence().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) val().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(), "presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "val")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { val().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.Rel7RepOffseThresholdOpt: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.Rel7RepOffseThresholdOpt"); } } void Rel7RepOffseThresholdOpt::encode_text(Text_Buf& text_buf) const { field_presence.encode_text(text_buf); field_val.encode_text(text_buf); } void Rel7RepOffseThresholdOpt::decode_text(Text_Buf& text_buf) { field_presence.decode_text(text_buf); field_val.decode_text(text_buf); } void Rel7RepOffseThresholdOpt::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name); if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); PER_encode(p_td, p_buf, opt); break; } default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void Rel7RepOffseThresholdOpt::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name); if(!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); try { PER_decode(p_td, p_buf, opt); p_buf.PER_octet_align(FALSE); } catch (PER_Buffer_Exception) { } break; } default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int Rel7RepOffseThresholdOpt::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, Rel7RepOffseThresholdOpt_presence_descr_.raw->forceomit); decoded_field_length = field_presence.RAW_decode(Rel7RepOffseThresholdOpt_presence_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); if (limit > 0 && field_presence == bs_0){ if (force_omit != NULL && (*force_omit)(1)) { field_val = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_1_force_omit(1, force_omit, Rel7RepOffseThresholdOpt_val_descr_.raw->forceomit); decoded_field_length = field_val().RAW_decode(Rel7RepOffseThresholdOpt_val_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 1) { field_val = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } else field_val=OMIT_VALUE; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int Rel7RepOffseThresholdOpt::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, Rel7RepOffseThresholdOpt_presence_descr_.raw); if (field_val.ispresent()) { myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, Rel7RepOffseThresholdOpt_val_descr_.raw); } else myleaf.body.node.nodes[1] = NULL; encoded_length += field_presence.RAW_encode(Rel7RepOffseThresholdOpt_presence_descr_, *myleaf.body.node.nodes[0]); if (field_val.ispresent()) { encoded_length += field_val().RAW_encode(Rel7RepOffseThresholdOpt_val_descr_, *myleaf.body.node.nodes[1]); } if (field_val.ispresent() && (field_presence != bs_0)) { 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){ bs_0.RAW_encode(Rel7RepOffseThresholdOpt_presence_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 Rel7RepOffseThresholdOpt_template::single_value_struct { BITSTRING_template field_presence; Rel7RepOffseThreshold_template field_val; }; void Rel7RepOffseThresholdOpt_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_presence = ANY_VALUE; single_value->field_val = ANY_OR_OMIT; } } } void Rel7RepOffseThresholdOpt_template::copy_value(const Rel7RepOffseThresholdOpt& other_value) { single_value = new single_value_struct; if (other_value.presence().is_bound()) { single_value->field_presence = other_value.presence(); } else { single_value->field_presence.clean_up(); } if (other_value.val().is_bound()) { if (other_value.val().ispresent()) single_value->field_val = other_value.val()(); else single_value->field_val = OMIT_VALUE; } else { single_value->field_val.clean_up(); } set_selection(SPECIFIC_VALUE); } void Rel7RepOffseThresholdOpt_template::copy_template(const Rel7RepOffseThresholdOpt_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.presence().get_selection()) { single_value->field_presence = other_value.presence(); } else { single_value->field_presence.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.val().get_selection()) { single_value->field_val = other_value.val(); } else { single_value->field_val.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 Rel7RepOffseThresholdOpt_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 Rel7RepOffseThresholdOpt_template(*other_value.implication_.precondition); implication_.implied_template = new Rel7RepOffseThresholdOpt_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of type @GSM_RestOctets.Rel7RepOffseThresholdOpt."); break; } set_selection(other_value); } Rel7RepOffseThresholdOpt_template::Rel7RepOffseThresholdOpt_template() { } Rel7RepOffseThresholdOpt_template::Rel7RepOffseThresholdOpt_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } Rel7RepOffseThresholdOpt_template::Rel7RepOffseThresholdOpt_template(const Rel7RepOffseThresholdOpt& other_value) { copy_value(other_value); } Rel7RepOffseThresholdOpt_template::Rel7RepOffseThresholdOpt_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const Rel7RepOffseThresholdOpt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.Rel7RepOffseThresholdOpt from an unbound optional field."); } } Rel7RepOffseThresholdOpt_template::Rel7RepOffseThresholdOpt_template(Rel7RepOffseThresholdOpt_template* p_precondition, Rel7RepOffseThresholdOpt_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } Rel7RepOffseThresholdOpt_template::Rel7RepOffseThresholdOpt_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; } Rel7RepOffseThresholdOpt_template::Rel7RepOffseThresholdOpt_template(const Rel7RepOffseThresholdOpt_template& other_value) : Base_Template() { copy_template(other_value); } Rel7RepOffseThresholdOpt_template::~Rel7RepOffseThresholdOpt_template() { clean_up(); } Rel7RepOffseThresholdOpt_template& Rel7RepOffseThresholdOpt_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } Rel7RepOffseThresholdOpt_template& Rel7RepOffseThresholdOpt_template::operator=(const Rel7RepOffseThresholdOpt& other_value) { clean_up(); copy_value(other_value); return *this; } Rel7RepOffseThresholdOpt_template& Rel7RepOffseThresholdOpt_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const Rel7RepOffseThresholdOpt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @GSM_RestOctets.Rel7RepOffseThresholdOpt."); } return *this; } Rel7RepOffseThresholdOpt_template& Rel7RepOffseThresholdOpt_template::operator=(const Rel7RepOffseThresholdOpt_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean Rel7RepOffseThresholdOpt_template::match(const Rel7RepOffseThresholdOpt& 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.presence().is_bound()) return FALSE; if(!single_value->field_presence.match(other_value.presence(), legacy))return FALSE; if(!other_value.val().is_bound()) return FALSE; if((other_value.val().ispresent() ? !single_value->field_val.match((const Rel7RepOffseThreshold&)other_value.val(), legacy) : !single_value->field_val.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 @GSM_RestOctets.Rel7RepOffseThresholdOpt."); } return FALSE; } boolean Rel7RepOffseThresholdOpt_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_presence.is_bound() || (single_value->field_val.is_omit() || single_value->field_val.is_bound()); } boolean Rel7RepOffseThresholdOpt_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_presence.is_value() && (single_value->field_val.is_omit() || single_value->field_val.is_value()); } void Rel7RepOffseThresholdOpt_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; } Rel7RepOffseThresholdOpt Rel7RepOffseThresholdOpt_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @GSM_RestOctets.Rel7RepOffseThresholdOpt."); Rel7RepOffseThresholdOpt ret_val; if (single_value->field_presence.is_bound()) { ret_val.presence() = single_value->field_presence.valueof(); } if (single_value->field_val.is_omit()) ret_val.val() = OMIT_VALUE; else if (single_value->field_val.is_bound()) { ret_val.val() = single_value->field_val.valueof(); } return ret_val; } void Rel7RepOffseThresholdOpt_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list for a template of type @GSM_RestOctets.Rel7RepOffseThresholdOpt."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new Rel7RepOffseThresholdOpt_template[list_length]; } Rel7RepOffseThresholdOpt_template& Rel7RepOffseThresholdOpt_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element of a non-list template of type @GSM_RestOctets.Rel7RepOffseThresholdOpt."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.Rel7RepOffseThresholdOpt."); return value_list.list_value[list_index]; } BITSTRING_template& Rel7RepOffseThresholdOpt_template::presence() { set_specific(); return single_value->field_presence; } const BITSTRING_template& Rel7RepOffseThresholdOpt_template::presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field presence of a non-specific template of type @GSM_RestOctets.Rel7RepOffseThresholdOpt."); return single_value->field_presence; } Rel7RepOffseThreshold_template& Rel7RepOffseThresholdOpt_template::val() { set_specific(); return single_value->field_val; } const Rel7RepOffseThreshold_template& Rel7RepOffseThresholdOpt_template::val() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field val of a non-specific template of type @GSM_RestOctets.Rel7RepOffseThresholdOpt."); return single_value->field_val; } int Rel7RepOffseThresholdOpt_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.Rel7RepOffseThresholdOpt which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 1; if (single_value->field_val.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 @GSM_RestOctets.Rel7RepOffseThresholdOpt containing an empty list."); int item_size = value_list.list_value[0].size_of(); for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++) { if (value_list.list_value[l_idx].size_of()!=item_size) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.Rel7RepOffseThresholdOpt containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.Rel7RepOffseThresholdOpt containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.Rel7RepOffseThresholdOpt containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.Rel7RepOffseThresholdOpt containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.Rel7RepOffseThresholdOpt containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.Rel7RepOffseThresholdOpt containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.Rel7RepOffseThresholdOpt containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.Rel7RepOffseThresholdOpt."); } return 0; } void Rel7RepOffseThresholdOpt_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ presence := "); single_value->field_presence.log(); TTCN_Logger::log_event_str(", val := "); single_value->field_val.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 Rel7RepOffseThresholdOpt_template::log_match(const Rel7RepOffseThresholdOpt& 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_presence.match(match_value.presence(), legacy)){ TTCN_Logger::log_logmatch_info(".presence"); single_value->field_presence.log_match(match_value.presence(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.val().ispresent()){ if(!single_value->field_val.match(match_value.val(), legacy)){ TTCN_Logger::log_logmatch_info(".val"); single_value->field_val.log_match(match_value.val(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_val.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".val := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_val.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("{ presence := "); single_value->field_presence.log_match(match_value.presence(), legacy); TTCN_Logger::log_event_str(", val := "); if (match_value.val().ispresent()) { single_value->field_val.log_match(match_value.val(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_val.log(); if (single_value->field_val.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 Rel7RepOffseThresholdOpt_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (presence().is_bound()) presence().set_implicit_omit(); if (!val().is_bound()) val() = OMIT_VALUE; else val().set_implicit_omit(); } void Rel7RepOffseThresholdOpt_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_presence.encode_text(text_buf); single_value->field_val.encode_text(text_buf); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @GSM_RestOctets.Rel7RepOffseThresholdOpt."); } } void Rel7RepOffseThresholdOpt_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_presence.decode_text(text_buf); single_value->field_val.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 Rel7RepOffseThresholdOpt_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @GSM_RestOctets.Rel7RepOffseThresholdOpt."); } } void Rel7RepOffseThresholdOpt_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: { Rel7RepOffseThresholdOpt_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) presence().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) val().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(), "presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "val")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { val().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.Rel7RepOffseThresholdOpt: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { Rel7RepOffseThresholdOpt_template* precondition = new Rel7RepOffseThresholdOpt_template; precondition->set_param(*param.get_elem(0)); Rel7RepOffseThresholdOpt_template* implied_template = new Rel7RepOffseThresholdOpt_template; implied_template->set_param(*param.get_elem(1)); *this = Rel7RepOffseThresholdOpt_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.Rel7RepOffseThresholdOpt"); } is_ifpresent = param.get_ifpresent(); } void Rel7RepOffseThresholdOpt_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_presence.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.Rel7RepOffseThresholdOpt"); single_value->field_val.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.Rel7RepOffseThresholdOpt"); return; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@GSM_RestOctets.Rel7RepOffseThresholdOpt"); } boolean Rel7RepOffseThresholdOpt_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean Rel7RepOffseThresholdOpt_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) offset().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) threshold().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(), "offset")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { offset().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "threshold")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { threshold().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.Rel7RepOffseThreshold: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.Rel7RepOffseThreshold"); } } void Rel7RepOffseThreshold::encode_text(Text_Buf& text_buf) const { field_offset.encode_text(text_buf); field_threshold.encode_text(text_buf); } void Rel7RepOffseThreshold::decode_text(Text_Buf& text_buf) { field_offset.decode_text(text_buf); field_threshold.decode_text(text_buf); } void Rel7RepOffseThreshold::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name); if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); PER_encode(p_td, p_buf, opt); break; } default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void Rel7RepOffseThreshold::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name); if(!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); try { PER_decode(p_td, p_buf, opt); p_buf.PER_octet_align(FALSE); } catch (PER_Buffer_Exception) { } break; } default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int Rel7RepOffseThreshold::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, Rel7RepOffseThreshold_offset_descr_.raw->forceomit); decoded_field_length = field_offset.RAW_decode(Rel7RepOffseThreshold_offset_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, Rel7RepOffseThreshold_threshold_descr_.raw->forceomit); decoded_field_length = field_threshold.RAW_decode(Rel7RepOffseThreshold_threshold_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 Rel7RepOffseThreshold::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, Rel7RepOffseThreshold_offset_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, Rel7RepOffseThreshold_threshold_descr_.raw); encoded_length += field_offset.RAW_encode(Rel7RepOffseThreshold_offset_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_threshold.RAW_encode(Rel7RepOffseThreshold_threshold_descr_, *myleaf.body.node.nodes[1]); return myleaf.length = encoded_length; } struct Rel7RepOffseThreshold_template::single_value_struct { BITSTRING_template field_offset; BITSTRING_template field_threshold; }; void Rel7RepOffseThreshold_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_offset = ANY_VALUE; single_value->field_threshold = ANY_VALUE; } } } void Rel7RepOffseThreshold_template::copy_value(const Rel7RepOffseThreshold& other_value) { single_value = new single_value_struct; if (other_value.offset().is_bound()) { single_value->field_offset = other_value.offset(); } else { single_value->field_offset.clean_up(); } if (other_value.threshold().is_bound()) { single_value->field_threshold = other_value.threshold(); } else { single_value->field_threshold.clean_up(); } set_selection(SPECIFIC_VALUE); } void Rel7RepOffseThreshold_template::copy_template(const Rel7RepOffseThreshold_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.offset().get_selection()) { single_value->field_offset = other_value.offset(); } else { single_value->field_offset.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.threshold().get_selection()) { single_value->field_threshold = other_value.threshold(); } else { single_value->field_threshold.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 Rel7RepOffseThreshold_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 Rel7RepOffseThreshold_template(*other_value.implication_.precondition); implication_.implied_template = new Rel7RepOffseThreshold_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of type @GSM_RestOctets.Rel7RepOffseThreshold."); break; } set_selection(other_value); } Rel7RepOffseThreshold_template::Rel7RepOffseThreshold_template() { } Rel7RepOffseThreshold_template::Rel7RepOffseThreshold_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } Rel7RepOffseThreshold_template::Rel7RepOffseThreshold_template(const Rel7RepOffseThreshold& other_value) { copy_value(other_value); } Rel7RepOffseThreshold_template::Rel7RepOffseThreshold_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const Rel7RepOffseThreshold&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.Rel7RepOffseThreshold from an unbound optional field."); } } Rel7RepOffseThreshold_template::Rel7RepOffseThreshold_template(Rel7RepOffseThreshold_template* p_precondition, Rel7RepOffseThreshold_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } Rel7RepOffseThreshold_template::Rel7RepOffseThreshold_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; } Rel7RepOffseThreshold_template::Rel7RepOffseThreshold_template(const Rel7RepOffseThreshold_template& other_value) : Base_Template() { copy_template(other_value); } Rel7RepOffseThreshold_template::~Rel7RepOffseThreshold_template() { clean_up(); } Rel7RepOffseThreshold_template& Rel7RepOffseThreshold_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } Rel7RepOffseThreshold_template& Rel7RepOffseThreshold_template::operator=(const Rel7RepOffseThreshold& other_value) { clean_up(); copy_value(other_value); return *this; } Rel7RepOffseThreshold_template& Rel7RepOffseThreshold_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const Rel7RepOffseThreshold&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @GSM_RestOctets.Rel7RepOffseThreshold."); } return *this; } Rel7RepOffseThreshold_template& Rel7RepOffseThreshold_template::operator=(const Rel7RepOffseThreshold_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean Rel7RepOffseThreshold_template::match(const Rel7RepOffseThreshold& 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.offset().is_bound()) return FALSE; if(!single_value->field_offset.match(other_value.offset(), legacy))return FALSE; if(!other_value.threshold().is_bound()) return FALSE; if(!single_value->field_threshold.match(other_value.threshold(), legacy))return FALSE; return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of type @GSM_RestOctets.Rel7RepOffseThreshold."); } return FALSE; } boolean Rel7RepOffseThreshold_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_offset.is_bound() || single_value->field_threshold.is_bound(); } boolean Rel7RepOffseThreshold_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_offset.is_value() && single_value->field_threshold.is_value(); } void Rel7RepOffseThreshold_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; } Rel7RepOffseThreshold Rel7RepOffseThreshold_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @GSM_RestOctets.Rel7RepOffseThreshold."); Rel7RepOffseThreshold ret_val; if (single_value->field_offset.is_bound()) { ret_val.offset() = single_value->field_offset.valueof(); } if (single_value->field_threshold.is_bound()) { ret_val.threshold() = single_value->field_threshold.valueof(); } return ret_val; } void Rel7RepOffseThreshold_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list for a template of type @GSM_RestOctets.Rel7RepOffseThreshold."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new Rel7RepOffseThreshold_template[list_length]; } Rel7RepOffseThreshold_template& Rel7RepOffseThreshold_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element of a non-list template of type @GSM_RestOctets.Rel7RepOffseThreshold."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.Rel7RepOffseThreshold."); return value_list.list_value[list_index]; } BITSTRING_template& Rel7RepOffseThreshold_template::offset() { set_specific(); return single_value->field_offset; } const BITSTRING_template& Rel7RepOffseThreshold_template::offset() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field offset of a non-specific template of type @GSM_RestOctets.Rel7RepOffseThreshold."); return single_value->field_offset; } BITSTRING_template& Rel7RepOffseThreshold_template::threshold() { set_specific(); return single_value->field_threshold; } const BITSTRING_template& Rel7RepOffseThreshold_template::threshold() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field threshold of a non-specific template of type @GSM_RestOctets.Rel7RepOffseThreshold."); return single_value->field_threshold; } int Rel7RepOffseThreshold_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.Rel7RepOffseThreshold which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 2; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @GSM_RestOctets.Rel7RepOffseThreshold containing an empty list."); int item_size = value_list.list_value[0].size_of(); for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++) { if (value_list.list_value[l_idx].size_of()!=item_size) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.Rel7RepOffseThreshold containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.Rel7RepOffseThreshold containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.Rel7RepOffseThreshold containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.Rel7RepOffseThreshold containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.Rel7RepOffseThreshold containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.Rel7RepOffseThreshold containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.Rel7RepOffseThreshold containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.Rel7RepOffseThreshold."); } return 0; } void Rel7RepOffseThreshold_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ offset := "); single_value->field_offset.log(); TTCN_Logger::log_event_str(", threshold := "); single_value->field_threshold.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 Rel7RepOffseThreshold_template::log_match(const Rel7RepOffseThreshold& 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_offset.match(match_value.offset(), legacy)){ TTCN_Logger::log_logmatch_info(".offset"); single_value->field_offset.log_match(match_value.offset(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_threshold.match(match_value.threshold(), legacy)){ TTCN_Logger::log_logmatch_info(".threshold"); single_value->field_threshold.log_match(match_value.threshold(), 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("{ offset := "); single_value->field_offset.log_match(match_value.offset(), legacy); TTCN_Logger::log_event_str(", threshold := "); single_value->field_threshold.log_match(match_value.threshold(), 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 Rel7RepOffseThreshold_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (offset().is_bound()) offset().set_implicit_omit(); if (threshold().is_bound()) threshold().set_implicit_omit(); } void Rel7RepOffseThreshold_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_offset.encode_text(text_buf); single_value->field_threshold.encode_text(text_buf); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @GSM_RestOctets.Rel7RepOffseThreshold."); } } void Rel7RepOffseThreshold_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_offset.decode_text(text_buf); single_value->field_threshold.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 Rel7RepOffseThreshold_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @GSM_RestOctets.Rel7RepOffseThreshold."); } } void Rel7RepOffseThreshold_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: { Rel7RepOffseThreshold_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) offset().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) threshold().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(), "offset")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { offset().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "threshold")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { threshold().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.Rel7RepOffseThreshold: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { Rel7RepOffseThreshold_template* precondition = new Rel7RepOffseThreshold_template; precondition->set_param(*param.get_elem(0)); Rel7RepOffseThreshold_template* implied_template = new Rel7RepOffseThreshold_template; implied_template->set_param(*param.get_elem(1)); *this = Rel7RepOffseThreshold_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.Rel7RepOffseThreshold"); } is_ifpresent = param.get_ifpresent(); } void Rel7RepOffseThreshold_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_offset.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.Rel7RepOffseThreshold"); single_value->field_threshold.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.Rel7RepOffseThreshold"); return; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@GSM_RestOctets.Rel7RepOffseThreshold"); } boolean Rel7RepOffseThreshold_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean Rel7RepOffseThreshold_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_rel8) : field_rep700(par_rep700), field_rep810(par_rep810), field_rel8__presence(par_rel8__presence), field_rel8(par_rel8) { } SI2quaterR7Additions::SI2quaterR7Additions(const SI2quaterR7Additions& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.SI2quaterR7Additions."); if (other_value.rep700().is_bound()) field_rep700 = other_value.rep700(); else field_rep700.clean_up(); if (other_value.rep810().is_bound()) field_rep810 = other_value.rep810(); else field_rep810.clean_up(); if (other_value.rel8__presence().is_bound()) field_rel8__presence = other_value.rel8__presence(); else field_rel8__presence.clean_up(); if (other_value.rel8().is_bound()) field_rel8 = other_value.rel8(); else field_rel8.clean_up(); } void SI2quaterR7Additions::clean_up() { field_rep700.clean_up(); field_rep810.clean_up(); field_rel8__presence.clean_up(); field_rel8.clean_up(); } const TTCN_Typedescriptor_t* SI2quaterR7Additions::get_descriptor() const { return &SI2quaterR7Additions_descr_; } SI2quaterR7Additions& SI2quaterR7Additions::operator=(const SI2quaterR7Additions& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.SI2quaterR7Additions."); if (other_value.rep700().is_bound()) field_rep700 = other_value.rep700(); else field_rep700.clean_up(); if (other_value.rep810().is_bound()) field_rep810 = other_value.rep810(); else field_rep810.clean_up(); if (other_value.rel8__presence().is_bound()) field_rel8__presence = other_value.rel8__presence(); else field_rel8__presence.clean_up(); if (other_value.rel8().is_bound()) field_rel8 = other_value.rel8(); else field_rel8.clean_up(); } return *this; } boolean SI2quaterR7Additions::operator==(const SI2quaterR7Additions& other_value) const { return field_rep700==other_value.field_rep700 && field_rep810==other_value.field_rep810 && field_rel8__presence==other_value.field_rel8__presence && field_rel8==other_value.field_rel8; } boolean SI2quaterR7Additions::is_bound() const { return (field_rep700.is_bound()) || (field_rep810.is_bound()) || (field_rel8__presence.is_bound()) || (OPTIONAL_OMIT == field_rel8.get_selection() || field_rel8.is_bound()); } boolean SI2quaterR7Additions::is_value() const { return field_rep700.is_value() && field_rep810.is_value() && field_rel8__presence.is_value() && (OPTIONAL_OMIT == field_rel8.get_selection() || field_rel8.is_value()); } int SI2quaterR7Additions::size_of() const { int ret_val = 3; if (field_rel8.ispresent()) ret_val++; return ret_val; } void SI2quaterR7Additions::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ rep700 := "); field_rep700.log(); TTCN_Logger::log_event_str(", rep810 := "); field_rep810.log(); TTCN_Logger::log_event_str(", rel8_presence := "); field_rel8__presence.log(); TTCN_Logger::log_event_str(", rel8 := "); field_rel8.log(); TTCN_Logger::log_event_str(" }"); } void SI2quaterR7Additions::set_implicit_omit() { if (rep700().is_bound()) rep700().set_implicit_omit(); if (rep810().is_bound()) rep810().set_implicit_omit(); if (rel8__presence().is_bound()) rel8__presence().set_implicit_omit(); if (!rel8().is_bound()) rel8() = OMIT_VALUE; else rel8().set_implicit_omit(); } void SI2quaterR7Additions::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) rep700().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) rep810().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) rel8__presence().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) rel8().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(), "rep700")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rep700().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "rep810")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rep810().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "rel8_presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rel8__presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "rel8")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rel8().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.SI2quaterR7Additions: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.SI2quaterR7Additions"); } } void SI2quaterR7Additions::encode_text(Text_Buf& text_buf) const { field_rep700.encode_text(text_buf); field_rep810.encode_text(text_buf); field_rel8__presence.encode_text(text_buf); field_rel8.encode_text(text_buf); } void SI2quaterR7Additions::decode_text(Text_Buf& text_buf) { field_rep700.decode_text(text_buf); field_rep810.decode_text(text_buf); field_rel8__presence.decode_text(text_buf); field_rel8.decode_text(text_buf); } void SI2quaterR7Additions::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name); if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); PER_encode(p_td, p_buf, opt); break; } default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void SI2quaterR7Additions::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name); if(!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); try { PER_decode(p_td, p_buf, opt); p_buf.PER_octet_align(FALSE); } catch (PER_Buffer_Exception) { } break; } default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int SI2quaterR7Additions::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, SI2quaterR7Additions_rep700_descr_.raw->forceomit); decoded_field_length = field_rep700.RAW_decode(SI2quaterR7Additions_rep700_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, SI2quaterR7Additions_rep810_descr_.raw->forceomit); decoded_field_length = field_rep810.RAW_decode(SI2quaterR7Additions_rep810_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, SI2quaterR7Additions_rel8__presence_descr_.raw->forceomit); decoded_field_length = field_rel8__presence.RAW_decode(SI2quaterR7Additions_rel8__presence_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_2_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); if (limit > 0 && field_rel8__presence == bs_0){ if (force_omit != NULL && (*force_omit)(3)) { field_rel8 = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_3_force_omit(3, force_omit, SI2quaterR7Additions_rel8_descr_.raw->forceomit); decoded_field_length = field_rel8().RAW_decode(SI2quaterR7Additions_rel8_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_3_force_omit); if (decoded_field_length < 1) { field_rel8 = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } else field_rel8=OMIT_VALUE; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int SI2quaterR7Additions::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, SI2quaterR7Additions_rep700_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, SI2quaterR7Additions_rep810_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, SI2quaterR7Additions_rel8__presence_descr_.raw); if (field_rel8.ispresent()) { myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, SI2quaterR7Additions_rel8_descr_.raw); } else myleaf.body.node.nodes[3] = NULL; encoded_length += field_rep700.RAW_encode(SI2quaterR7Additions_rep700_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_rep810.RAW_encode(SI2quaterR7Additions_rep810_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_rel8__presence.RAW_encode(SI2quaterR7Additions_rel8__presence_descr_, *myleaf.body.node.nodes[2]); if (field_rel8.ispresent()) { encoded_length += field_rel8().RAW_encode(SI2quaterR7Additions_rel8_descr_, *myleaf.body.node.nodes[3]); } if (field_rel8.ispresent() && (field_rel8__presence != bs_0)) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={2}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ bs_0.RAW_encode(SI2quaterR7Additions_rel8__presence_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 SI2quaterR7Additions_template::single_value_struct { Rel7RepOffseThresholdOpt_template field_rep700; Rel7RepOffseThresholdOpt_template field_rep810; BITSTRING_template field_rel8__presence; SI2quaterR8Additions_template field_rel8; }; void SI2quaterR7Additions_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_rep700 = ANY_VALUE; single_value->field_rep810 = ANY_VALUE; single_value->field_rel8__presence = ANY_VALUE; single_value->field_rel8 = ANY_OR_OMIT; } } } void SI2quaterR7Additions_template::copy_value(const SI2quaterR7Additions& other_value) { single_value = new single_value_struct; if (other_value.rep700().is_bound()) { single_value->field_rep700 = other_value.rep700(); } else { single_value->field_rep700.clean_up(); } if (other_value.rep810().is_bound()) { single_value->field_rep810 = other_value.rep810(); } else { single_value->field_rep810.clean_up(); } if (other_value.rel8__presence().is_bound()) { single_value->field_rel8__presence = other_value.rel8__presence(); } else { single_value->field_rel8__presence.clean_up(); } if (other_value.rel8().is_bound()) { if (other_value.rel8().ispresent()) single_value->field_rel8 = other_value.rel8()(); else single_value->field_rel8 = OMIT_VALUE; } else { single_value->field_rel8.clean_up(); } set_selection(SPECIFIC_VALUE); } void SI2quaterR7Additions_template::copy_template(const SI2quaterR7Additions_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.rep700().get_selection()) { single_value->field_rep700 = other_value.rep700(); } else { single_value->field_rep700.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.rep810().get_selection()) { single_value->field_rep810 = other_value.rep810(); } else { single_value->field_rep810.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.rel8__presence().get_selection()) { single_value->field_rel8__presence = other_value.rel8__presence(); } else { single_value->field_rel8__presence.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.rel8().get_selection()) { single_value->field_rel8 = other_value.rel8(); } else { single_value->field_rel8.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 SI2quaterR7Additions_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 SI2quaterR7Additions_template(*other_value.implication_.precondition); implication_.implied_template = new SI2quaterR7Additions_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of type @GSM_RestOctets.SI2quaterR7Additions."); break; } set_selection(other_value); } SI2quaterR7Additions_template::SI2quaterR7Additions_template() { } SI2quaterR7Additions_template::SI2quaterR7Additions_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } SI2quaterR7Additions_template::SI2quaterR7Additions_template(const SI2quaterR7Additions& other_value) { copy_value(other_value); } SI2quaterR7Additions_template::SI2quaterR7Additions_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI2quaterR7Additions&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.SI2quaterR7Additions from an unbound optional field."); } } SI2quaterR7Additions_template::SI2quaterR7Additions_template(SI2quaterR7Additions_template* p_precondition, SI2quaterR7Additions_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } SI2quaterR7Additions_template::SI2quaterR7Additions_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; } SI2quaterR7Additions_template::SI2quaterR7Additions_template(const SI2quaterR7Additions_template& other_value) : Base_Template() { copy_template(other_value); } SI2quaterR7Additions_template::~SI2quaterR7Additions_template() { clean_up(); } SI2quaterR7Additions_template& SI2quaterR7Additions_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } SI2quaterR7Additions_template& SI2quaterR7Additions_template::operator=(const SI2quaterR7Additions& other_value) { clean_up(); copy_value(other_value); return *this; } SI2quaterR7Additions_template& SI2quaterR7Additions_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI2quaterR7Additions&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @GSM_RestOctets.SI2quaterR7Additions."); } return *this; } SI2quaterR7Additions_template& SI2quaterR7Additions_template::operator=(const SI2quaterR7Additions_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean SI2quaterR7Additions_template::match(const SI2quaterR7Additions& 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.rep700().is_bound()) return FALSE; if(!single_value->field_rep700.match(other_value.rep700(), legacy))return FALSE; if(!other_value.rep810().is_bound()) return FALSE; if(!single_value->field_rep810.match(other_value.rep810(), legacy))return FALSE; if(!other_value.rel8__presence().is_bound()) return FALSE; if(!single_value->field_rel8__presence.match(other_value.rel8__presence(), legacy))return FALSE; if(!other_value.rel8().is_bound()) return FALSE; if((other_value.rel8().ispresent() ? !single_value->field_rel8.match((const SI2quaterR8Additions&)other_value.rel8(), legacy) : !single_value->field_rel8.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 @GSM_RestOctets.SI2quaterR7Additions."); } return FALSE; } boolean SI2quaterR7Additions_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_rep700.is_bound() || single_value->field_rep810.is_bound() || single_value->field_rel8__presence.is_bound() || (single_value->field_rel8.is_omit() || single_value->field_rel8.is_bound()); } boolean SI2quaterR7Additions_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_rep700.is_value() && single_value->field_rep810.is_value() && single_value->field_rel8__presence.is_value() && (single_value->field_rel8.is_omit() || single_value->field_rel8.is_value()); } void SI2quaterR7Additions_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; } SI2quaterR7Additions SI2quaterR7Additions_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @GSM_RestOctets.SI2quaterR7Additions."); SI2quaterR7Additions ret_val; if (single_value->field_rep700.is_bound()) { ret_val.rep700() = single_value->field_rep700.valueof(); } if (single_value->field_rep810.is_bound()) { ret_val.rep810() = single_value->field_rep810.valueof(); } if (single_value->field_rel8__presence.is_bound()) { ret_val.rel8__presence() = single_value->field_rel8__presence.valueof(); } if (single_value->field_rel8.is_omit()) ret_val.rel8() = OMIT_VALUE; else if (single_value->field_rel8.is_bound()) { ret_val.rel8() = single_value->field_rel8.valueof(); } return ret_val; } void SI2quaterR7Additions_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list for a template of type @GSM_RestOctets.SI2quaterR7Additions."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new SI2quaterR7Additions_template[list_length]; } SI2quaterR7Additions_template& SI2quaterR7Additions_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element of a non-list template of type @GSM_RestOctets.SI2quaterR7Additions."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.SI2quaterR7Additions."); return value_list.list_value[list_index]; } Rel7RepOffseThresholdOpt_template& SI2quaterR7Additions_template::rep700() { set_specific(); return single_value->field_rep700; } const Rel7RepOffseThresholdOpt_template& SI2quaterR7Additions_template::rep700() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field rep700 of a non-specific template of type @GSM_RestOctets.SI2quaterR7Additions."); return single_value->field_rep700; } Rel7RepOffseThresholdOpt_template& SI2quaterR7Additions_template::rep810() { set_specific(); return single_value->field_rep810; } const Rel7RepOffseThresholdOpt_template& SI2quaterR7Additions_template::rep810() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field rep810 of a non-specific template of type @GSM_RestOctets.SI2quaterR7Additions."); return single_value->field_rep810; } BITSTRING_template& SI2quaterR7Additions_template::rel8__presence() { set_specific(); return single_value->field_rel8__presence; } const BITSTRING_template& SI2quaterR7Additions_template::rel8__presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field rel8_presence of a non-specific template of type @GSM_RestOctets.SI2quaterR7Additions."); return single_value->field_rel8__presence; } SI2quaterR8Additions_template& SI2quaterR7Additions_template::rel8() { set_specific(); return single_value->field_rel8; } const SI2quaterR8Additions_template& SI2quaterR7Additions_template::rel8() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field rel8 of a non-specific template of type @GSM_RestOctets.SI2quaterR7Additions."); return single_value->field_rel8; } int SI2quaterR7Additions_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterR7Additions which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 3; if (single_value->field_rel8.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 @GSM_RestOctets.SI2quaterR7Additions containing an empty list."); int item_size = value_list.list_value[0].size_of(); for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++) { if (value_list.list_value[l_idx].size_of()!=item_size) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterR7Additions containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterR7Additions containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterR7Additions containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterR7Additions containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterR7Additions containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterR7Additions containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterR7Additions containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.SI2quaterR7Additions."); } return 0; } void SI2quaterR7Additions_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ rep700 := "); single_value->field_rep700.log(); TTCN_Logger::log_event_str(", rep810 := "); single_value->field_rep810.log(); TTCN_Logger::log_event_str(", rel8_presence := "); single_value->field_rel8__presence.log(); TTCN_Logger::log_event_str(", rel8 := "); single_value->field_rel8.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 SI2quaterR7Additions_template::log_match(const SI2quaterR7Additions& 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_rep700.match(match_value.rep700(), legacy)){ TTCN_Logger::log_logmatch_info(".rep700"); single_value->field_rep700.log_match(match_value.rep700(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_rep810.match(match_value.rep810(), legacy)){ TTCN_Logger::log_logmatch_info(".rep810"); single_value->field_rep810.log_match(match_value.rep810(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_rel8__presence.match(match_value.rel8__presence(), legacy)){ TTCN_Logger::log_logmatch_info(".rel8_presence"); single_value->field_rel8__presence.log_match(match_value.rel8__presence(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.rel8().ispresent()){ if(!single_value->field_rel8.match(match_value.rel8(), legacy)){ TTCN_Logger::log_logmatch_info(".rel8"); single_value->field_rel8.log_match(match_value.rel8(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_rel8.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".rel8 := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_rel8.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("{ rep700 := "); single_value->field_rep700.log_match(match_value.rep700(), legacy); TTCN_Logger::log_event_str(", rep810 := "); single_value->field_rep810.log_match(match_value.rep810(), legacy); TTCN_Logger::log_event_str(", rel8_presence := "); single_value->field_rel8__presence.log_match(match_value.rel8__presence(), legacy); TTCN_Logger::log_event_str(", rel8 := "); if (match_value.rel8().ispresent()) { single_value->field_rel8.log_match(match_value.rel8(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_rel8.log(); if (single_value->field_rel8.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 SI2quaterR7Additions_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (rep700().is_bound()) rep700().set_implicit_omit(); if (rep810().is_bound()) rep810().set_implicit_omit(); if (rel8__presence().is_bound()) rel8__presence().set_implicit_omit(); if (!rel8().is_bound()) rel8() = OMIT_VALUE; else rel8().set_implicit_omit(); } void SI2quaterR7Additions_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_rep700.encode_text(text_buf); single_value->field_rep810.encode_text(text_buf); single_value->field_rel8__presence.encode_text(text_buf); single_value->field_rel8.encode_text(text_buf); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @GSM_RestOctets.SI2quaterR7Additions."); } } void SI2quaterR7Additions_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_rep700.decode_text(text_buf); single_value->field_rep810.decode_text(text_buf); single_value->field_rel8__presence.decode_text(text_buf); single_value->field_rel8.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 SI2quaterR7Additions_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @GSM_RestOctets.SI2quaterR7Additions."); } } void SI2quaterR7Additions_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: { SI2quaterR7Additions_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) rep700().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) rep810().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) rel8__presence().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) rel8().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(), "rep700")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rep700().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "rep810")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rep810().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "rel8_presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rel8__presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "rel8")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rel8().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.SI2quaterR7Additions: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { SI2quaterR7Additions_template* precondition = new SI2quaterR7Additions_template; precondition->set_param(*param.get_elem(0)); SI2quaterR7Additions_template* implied_template = new SI2quaterR7Additions_template; implied_template->set_param(*param.get_elem(1)); *this = SI2quaterR7Additions_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.SI2quaterR7Additions"); } is_ifpresent = param.get_ifpresent(); } void SI2quaterR7Additions_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_rep700.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI2quaterR7Additions"); single_value->field_rep810.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI2quaterR7Additions"); single_value->field_rel8__presence.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI2quaterR7Additions"); single_value->field_rel8.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI2quaterR7Additions"); return; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@GSM_RestOctets.SI2quaterR7Additions"); } boolean SI2quaterR7Additions_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean SI2quaterR7Additions_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_desc) : field_presence(par_presence), field_desc(par_desc) { } Rel8PrioEUTRANParamsDescOpt::Rel8PrioEUTRANParamsDescOpt(const Rel8PrioEUTRANParamsDescOpt& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.Rel8PrioEUTRANParamsDescOpt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.desc().is_bound()) field_desc = other_value.desc(); else field_desc.clean_up(); } void Rel8PrioEUTRANParamsDescOpt::clean_up() { field_presence.clean_up(); field_desc.clean_up(); } const TTCN_Typedescriptor_t* Rel8PrioEUTRANParamsDescOpt::get_descriptor() const { return &Rel8PrioEUTRANParamsDescOpt_descr_; } Rel8PrioEUTRANParamsDescOpt& Rel8PrioEUTRANParamsDescOpt::operator=(const Rel8PrioEUTRANParamsDescOpt& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.Rel8PrioEUTRANParamsDescOpt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.desc().is_bound()) field_desc = other_value.desc(); else field_desc.clean_up(); } return *this; } boolean Rel8PrioEUTRANParamsDescOpt::operator==(const Rel8PrioEUTRANParamsDescOpt& other_value) const { return field_presence==other_value.field_presence && field_desc==other_value.field_desc; } boolean Rel8PrioEUTRANParamsDescOpt::is_bound() const { return (field_presence.is_bound()) || (OPTIONAL_OMIT == field_desc.get_selection() || field_desc.is_bound()); } boolean Rel8PrioEUTRANParamsDescOpt::is_value() const { return field_presence.is_value() && (OPTIONAL_OMIT == field_desc.get_selection() || field_desc.is_value()); } int Rel8PrioEUTRANParamsDescOpt::size_of() const { int ret_val = 1; if (field_desc.ispresent()) ret_val++; return ret_val; } void Rel8PrioEUTRANParamsDescOpt::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ presence := "); field_presence.log(); TTCN_Logger::log_event_str(", desc := "); field_desc.log(); TTCN_Logger::log_event_str(" }"); } void Rel8PrioEUTRANParamsDescOpt::set_implicit_omit() { if (presence().is_bound()) presence().set_implicit_omit(); if (!desc().is_bound()) desc() = OMIT_VALUE; else desc().set_implicit_omit(); } void Rel8PrioEUTRANParamsDescOpt::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) presence().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) desc().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(), "presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.Rel8PrioEUTRANParamsDescOpt: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.Rel8PrioEUTRANParamsDescOpt"); } } void Rel8PrioEUTRANParamsDescOpt::encode_text(Text_Buf& text_buf) const { field_presence.encode_text(text_buf); field_desc.encode_text(text_buf); } void Rel8PrioEUTRANParamsDescOpt::decode_text(Text_Buf& text_buf) { field_presence.decode_text(text_buf); field_desc.decode_text(text_buf); } void Rel8PrioEUTRANParamsDescOpt::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name); if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); PER_encode(p_td, p_buf, opt); break; } default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void Rel8PrioEUTRANParamsDescOpt::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name); if(!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); try { PER_decode(p_td, p_buf, opt); p_buf.PER_octet_align(FALSE); } catch (PER_Buffer_Exception) { } break; } default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int Rel8PrioEUTRANParamsDescOpt::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, Rel8PrioEUTRANParamsDescOpt_presence_descr_.raw->forceomit); decoded_field_length = field_presence.RAW_decode(Rel8PrioEUTRANParamsDescOpt_presence_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); if (limit > 0 && field_presence == bs_0){ if (force_omit != NULL && (*force_omit)(1)) { field_desc = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_1_force_omit(1, force_omit, Rel8PrioEUTRANParamsDescOpt_desc_descr_.raw->forceomit); decoded_field_length = field_desc().RAW_decode(Rel8PrioEUTRANParamsDescOpt_desc_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 1) { field_desc = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } else field_desc=OMIT_VALUE; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int Rel8PrioEUTRANParamsDescOpt::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, Rel8PrioEUTRANParamsDescOpt_presence_descr_.raw); if (field_desc.ispresent()) { myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, Rel8PrioEUTRANParamsDescOpt_desc_descr_.raw); } else myleaf.body.node.nodes[1] = NULL; encoded_length += field_presence.RAW_encode(Rel8PrioEUTRANParamsDescOpt_presence_descr_, *myleaf.body.node.nodes[0]); if (field_desc.ispresent()) { encoded_length += field_desc().RAW_encode(Rel8PrioEUTRANParamsDescOpt_desc_descr_, *myleaf.body.node.nodes[1]); } if (field_desc.ispresent() && (field_presence != bs_0)) { 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){ bs_0.RAW_encode(Rel8PrioEUTRANParamsDescOpt_presence_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 Rel8PrioEUTRANParamsDescOpt_template::single_value_struct { BITSTRING_template field_presence; Rel8PrioEUTRANParamsDesc_template field_desc; }; void Rel8PrioEUTRANParamsDescOpt_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_presence = ANY_VALUE; single_value->field_desc = ANY_OR_OMIT; } } } void Rel8PrioEUTRANParamsDescOpt_template::copy_value(const Rel8PrioEUTRANParamsDescOpt& other_value) { single_value = new single_value_struct; if (other_value.presence().is_bound()) { single_value->field_presence = other_value.presence(); } else { single_value->field_presence.clean_up(); } if (other_value.desc().is_bound()) { if (other_value.desc().ispresent()) single_value->field_desc = other_value.desc()(); else single_value->field_desc = OMIT_VALUE; } else { single_value->field_desc.clean_up(); } set_selection(SPECIFIC_VALUE); } void Rel8PrioEUTRANParamsDescOpt_template::copy_template(const Rel8PrioEUTRANParamsDescOpt_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.presence().get_selection()) { single_value->field_presence = other_value.presence(); } else { single_value->field_presence.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.desc().get_selection()) { single_value->field_desc = other_value.desc(); } else { single_value->field_desc.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 Rel8PrioEUTRANParamsDescOpt_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 Rel8PrioEUTRANParamsDescOpt_template(*other_value.implication_.precondition); implication_.implied_template = new Rel8PrioEUTRANParamsDescOpt_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of type @GSM_RestOctets.Rel8PrioEUTRANParamsDescOpt."); break; } set_selection(other_value); } Rel8PrioEUTRANParamsDescOpt_template::Rel8PrioEUTRANParamsDescOpt_template() { } Rel8PrioEUTRANParamsDescOpt_template::Rel8PrioEUTRANParamsDescOpt_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } Rel8PrioEUTRANParamsDescOpt_template::Rel8PrioEUTRANParamsDescOpt_template(const Rel8PrioEUTRANParamsDescOpt& other_value) { copy_value(other_value); } Rel8PrioEUTRANParamsDescOpt_template::Rel8PrioEUTRANParamsDescOpt_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const Rel8PrioEUTRANParamsDescOpt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.Rel8PrioEUTRANParamsDescOpt from an unbound optional field."); } } Rel8PrioEUTRANParamsDescOpt_template::Rel8PrioEUTRANParamsDescOpt_template(Rel8PrioEUTRANParamsDescOpt_template* p_precondition, Rel8PrioEUTRANParamsDescOpt_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } Rel8PrioEUTRANParamsDescOpt_template::Rel8PrioEUTRANParamsDescOpt_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; } Rel8PrioEUTRANParamsDescOpt_template::Rel8PrioEUTRANParamsDescOpt_template(const Rel8PrioEUTRANParamsDescOpt_template& other_value) : Base_Template() { copy_template(other_value); } Rel8PrioEUTRANParamsDescOpt_template::~Rel8PrioEUTRANParamsDescOpt_template() { clean_up(); } Rel8PrioEUTRANParamsDescOpt_template& Rel8PrioEUTRANParamsDescOpt_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } Rel8PrioEUTRANParamsDescOpt_template& Rel8PrioEUTRANParamsDescOpt_template::operator=(const Rel8PrioEUTRANParamsDescOpt& other_value) { clean_up(); copy_value(other_value); return *this; } Rel8PrioEUTRANParamsDescOpt_template& Rel8PrioEUTRANParamsDescOpt_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const Rel8PrioEUTRANParamsDescOpt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @GSM_RestOctets.Rel8PrioEUTRANParamsDescOpt."); } return *this; } Rel8PrioEUTRANParamsDescOpt_template& Rel8PrioEUTRANParamsDescOpt_template::operator=(const Rel8PrioEUTRANParamsDescOpt_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean Rel8PrioEUTRANParamsDescOpt_template::match(const Rel8PrioEUTRANParamsDescOpt& 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.presence().is_bound()) return FALSE; if(!single_value->field_presence.match(other_value.presence(), legacy))return FALSE; if(!other_value.desc().is_bound()) return FALSE; if((other_value.desc().ispresent() ? !single_value->field_desc.match((const Rel8PrioEUTRANParamsDesc&)other_value.desc(), legacy) : !single_value->field_desc.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 @GSM_RestOctets.Rel8PrioEUTRANParamsDescOpt."); } return FALSE; } boolean Rel8PrioEUTRANParamsDescOpt_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_presence.is_bound() || (single_value->field_desc.is_omit() || single_value->field_desc.is_bound()); } boolean Rel8PrioEUTRANParamsDescOpt_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_presence.is_value() && (single_value->field_desc.is_omit() || single_value->field_desc.is_value()); } void Rel8PrioEUTRANParamsDescOpt_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; } Rel8PrioEUTRANParamsDescOpt Rel8PrioEUTRANParamsDescOpt_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @GSM_RestOctets.Rel8PrioEUTRANParamsDescOpt."); Rel8PrioEUTRANParamsDescOpt ret_val; if (single_value->field_presence.is_bound()) { ret_val.presence() = single_value->field_presence.valueof(); } if (single_value->field_desc.is_omit()) ret_val.desc() = OMIT_VALUE; else if (single_value->field_desc.is_bound()) { ret_val.desc() = single_value->field_desc.valueof(); } return ret_val; } void Rel8PrioEUTRANParamsDescOpt_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list for a template of type @GSM_RestOctets.Rel8PrioEUTRANParamsDescOpt."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new Rel8PrioEUTRANParamsDescOpt_template[list_length]; } Rel8PrioEUTRANParamsDescOpt_template& Rel8PrioEUTRANParamsDescOpt_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element of a non-list template of type @GSM_RestOctets.Rel8PrioEUTRANParamsDescOpt."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.Rel8PrioEUTRANParamsDescOpt."); return value_list.list_value[list_index]; } BITSTRING_template& Rel8PrioEUTRANParamsDescOpt_template::presence() { set_specific(); return single_value->field_presence; } const BITSTRING_template& Rel8PrioEUTRANParamsDescOpt_template::presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field presence of a non-specific template of type @GSM_RestOctets.Rel8PrioEUTRANParamsDescOpt."); return single_value->field_presence; } Rel8PrioEUTRANParamsDesc_template& Rel8PrioEUTRANParamsDescOpt_template::desc() { set_specific(); return single_value->field_desc; } const Rel8PrioEUTRANParamsDesc_template& Rel8PrioEUTRANParamsDescOpt_template::desc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field desc of a non-specific template of type @GSM_RestOctets.Rel8PrioEUTRANParamsDescOpt."); return single_value->field_desc; } int Rel8PrioEUTRANParamsDescOpt_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.Rel8PrioEUTRANParamsDescOpt which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 1; if (single_value->field_desc.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 @GSM_RestOctets.Rel8PrioEUTRANParamsDescOpt containing an empty list."); int item_size = value_list.list_value[0].size_of(); for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++) { if (value_list.list_value[l_idx].size_of()!=item_size) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.Rel8PrioEUTRANParamsDescOpt containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.Rel8PrioEUTRANParamsDescOpt containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.Rel8PrioEUTRANParamsDescOpt containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.Rel8PrioEUTRANParamsDescOpt containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.Rel8PrioEUTRANParamsDescOpt containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.Rel8PrioEUTRANParamsDescOpt containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.Rel8PrioEUTRANParamsDescOpt containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.Rel8PrioEUTRANParamsDescOpt."); } return 0; } void Rel8PrioEUTRANParamsDescOpt_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ presence := "); single_value->field_presence.log(); TTCN_Logger::log_event_str(", desc := "); single_value->field_desc.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 Rel8PrioEUTRANParamsDescOpt_template::log_match(const Rel8PrioEUTRANParamsDescOpt& 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_presence.match(match_value.presence(), legacy)){ TTCN_Logger::log_logmatch_info(".presence"); single_value->field_presence.log_match(match_value.presence(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.desc().ispresent()){ if(!single_value->field_desc.match(match_value.desc(), legacy)){ TTCN_Logger::log_logmatch_info(".desc"); single_value->field_desc.log_match(match_value.desc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_desc.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".desc := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_desc.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("{ presence := "); single_value->field_presence.log_match(match_value.presence(), legacy); TTCN_Logger::log_event_str(", desc := "); if (match_value.desc().ispresent()) { single_value->field_desc.log_match(match_value.desc(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_desc.log(); if (single_value->field_desc.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 Rel8PrioEUTRANParamsDescOpt_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (presence().is_bound()) presence().set_implicit_omit(); if (!desc().is_bound()) desc() = OMIT_VALUE; else desc().set_implicit_omit(); } void Rel8PrioEUTRANParamsDescOpt_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_presence.encode_text(text_buf); single_value->field_desc.encode_text(text_buf); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @GSM_RestOctets.Rel8PrioEUTRANParamsDescOpt."); } } void Rel8PrioEUTRANParamsDescOpt_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_presence.decode_text(text_buf); single_value->field_desc.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 Rel8PrioEUTRANParamsDescOpt_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @GSM_RestOctets.Rel8PrioEUTRANParamsDescOpt."); } } void Rel8PrioEUTRANParamsDescOpt_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: { Rel8PrioEUTRANParamsDescOpt_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) presence().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) desc().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(), "presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.Rel8PrioEUTRANParamsDescOpt: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { Rel8PrioEUTRANParamsDescOpt_template* precondition = new Rel8PrioEUTRANParamsDescOpt_template; precondition->set_param(*param.get_elem(0)); Rel8PrioEUTRANParamsDescOpt_template* implied_template = new Rel8PrioEUTRANParamsDescOpt_template; implied_template->set_param(*param.get_elem(1)); *this = Rel8PrioEUTRANParamsDescOpt_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.Rel8PrioEUTRANParamsDescOpt"); } is_ifpresent = param.get_ifpresent(); } void Rel8PrioEUTRANParamsDescOpt_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_presence.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.Rel8PrioEUTRANParamsDescOpt"); single_value->field_desc.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.Rel8PrioEUTRANParamsDescOpt"); return; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@GSM_RestOctets.Rel8PrioEUTRANParamsDescOpt"); } boolean Rel8PrioEUTRANParamsDescOpt_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean Rel8PrioEUTRANParamsDescOpt_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_desc) : field_presence(par_presence), field_desc(par_desc) { } ServingCellPrioParamsDescOpt::ServingCellPrioParamsDescOpt(const ServingCellPrioParamsDescOpt& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.ServingCellPrioParamsDescOpt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.desc().is_bound()) field_desc = other_value.desc(); else field_desc.clean_up(); } void ServingCellPrioParamsDescOpt::clean_up() { field_presence.clean_up(); field_desc.clean_up(); } const TTCN_Typedescriptor_t* ServingCellPrioParamsDescOpt::get_descriptor() const { return &ServingCellPrioParamsDescOpt_descr_; } ServingCellPrioParamsDescOpt& ServingCellPrioParamsDescOpt::operator=(const ServingCellPrioParamsDescOpt& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.ServingCellPrioParamsDescOpt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.desc().is_bound()) field_desc = other_value.desc(); else field_desc.clean_up(); } return *this; } boolean ServingCellPrioParamsDescOpt::operator==(const ServingCellPrioParamsDescOpt& other_value) const { return field_presence==other_value.field_presence && field_desc==other_value.field_desc; } boolean ServingCellPrioParamsDescOpt::is_bound() const { return (field_presence.is_bound()) || (OPTIONAL_OMIT == field_desc.get_selection() || field_desc.is_bound()); } boolean ServingCellPrioParamsDescOpt::is_value() const { return field_presence.is_value() && (OPTIONAL_OMIT == field_desc.get_selection() || field_desc.is_value()); } int ServingCellPrioParamsDescOpt::size_of() const { int ret_val = 1; if (field_desc.ispresent()) ret_val++; return ret_val; } void ServingCellPrioParamsDescOpt::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ presence := "); field_presence.log(); TTCN_Logger::log_event_str(", desc := "); field_desc.log(); TTCN_Logger::log_event_str(" }"); } void ServingCellPrioParamsDescOpt::set_implicit_omit() { if (presence().is_bound()) presence().set_implicit_omit(); if (!desc().is_bound()) desc() = OMIT_VALUE; else desc().set_implicit_omit(); } void ServingCellPrioParamsDescOpt::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) presence().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) desc().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(), "presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.ServingCellPrioParamsDescOpt: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.ServingCellPrioParamsDescOpt"); } } void ServingCellPrioParamsDescOpt::encode_text(Text_Buf& text_buf) const { field_presence.encode_text(text_buf); field_desc.encode_text(text_buf); } void ServingCellPrioParamsDescOpt::decode_text(Text_Buf& text_buf) { field_presence.decode_text(text_buf); field_desc.decode_text(text_buf); } void ServingCellPrioParamsDescOpt::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name); if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); PER_encode(p_td, p_buf, opt); break; } default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void ServingCellPrioParamsDescOpt::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name); if(!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); try { PER_decode(p_td, p_buf, opt); p_buf.PER_octet_align(FALSE); } catch (PER_Buffer_Exception) { } break; } default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int ServingCellPrioParamsDescOpt::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, ServingCellPrioParamsDescOpt_presence_descr_.raw->forceomit); decoded_field_length = field_presence.RAW_decode(ServingCellPrioParamsDescOpt_presence_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); if (limit > 0 && field_presence == bs_0){ if (force_omit != NULL && (*force_omit)(1)) { field_desc = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_1_force_omit(1, force_omit, ServingCellPrioParamsDescOpt_desc_descr_.raw->forceomit); decoded_field_length = field_desc().RAW_decode(ServingCellPrioParamsDescOpt_desc_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 1) { field_desc = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } else field_desc=OMIT_VALUE; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int ServingCellPrioParamsDescOpt::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, ServingCellPrioParamsDescOpt_presence_descr_.raw); if (field_desc.ispresent()) { myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, ServingCellPrioParamsDescOpt_desc_descr_.raw); } else myleaf.body.node.nodes[1] = NULL; encoded_length += field_presence.RAW_encode(ServingCellPrioParamsDescOpt_presence_descr_, *myleaf.body.node.nodes[0]); if (field_desc.ispresent()) { encoded_length += field_desc().RAW_encode(ServingCellPrioParamsDescOpt_desc_descr_, *myleaf.body.node.nodes[1]); } if (field_desc.ispresent() && (field_presence != bs_0)) { 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){ bs_0.RAW_encode(ServingCellPrioParamsDescOpt_presence_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 ServingCellPrioParamsDescOpt_template::single_value_struct { BITSTRING_template field_presence; ServingCellPrioParamsDesc_template field_desc; }; void ServingCellPrioParamsDescOpt_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_presence = ANY_VALUE; single_value->field_desc = ANY_OR_OMIT; } } } void ServingCellPrioParamsDescOpt_template::copy_value(const ServingCellPrioParamsDescOpt& other_value) { single_value = new single_value_struct; if (other_value.presence().is_bound()) { single_value->field_presence = other_value.presence(); } else { single_value->field_presence.clean_up(); } if (other_value.desc().is_bound()) { if (other_value.desc().ispresent()) single_value->field_desc = other_value.desc()(); else single_value->field_desc = OMIT_VALUE; } else { single_value->field_desc.clean_up(); } set_selection(SPECIFIC_VALUE); } void ServingCellPrioParamsDescOpt_template::copy_template(const ServingCellPrioParamsDescOpt_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.presence().get_selection()) { single_value->field_presence = other_value.presence(); } else { single_value->field_presence.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.desc().get_selection()) { single_value->field_desc = other_value.desc(); } else { single_value->field_desc.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 ServingCellPrioParamsDescOpt_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 ServingCellPrioParamsDescOpt_template(*other_value.implication_.precondition); implication_.implied_template = new ServingCellPrioParamsDescOpt_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of type @GSM_RestOctets.ServingCellPrioParamsDescOpt."); break; } set_selection(other_value); } ServingCellPrioParamsDescOpt_template::ServingCellPrioParamsDescOpt_template() { } ServingCellPrioParamsDescOpt_template::ServingCellPrioParamsDescOpt_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } ServingCellPrioParamsDescOpt_template::ServingCellPrioParamsDescOpt_template(const ServingCellPrioParamsDescOpt& other_value) { copy_value(other_value); } ServingCellPrioParamsDescOpt_template::ServingCellPrioParamsDescOpt_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const ServingCellPrioParamsDescOpt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.ServingCellPrioParamsDescOpt from an unbound optional field."); } } ServingCellPrioParamsDescOpt_template::ServingCellPrioParamsDescOpt_template(ServingCellPrioParamsDescOpt_template* p_precondition, ServingCellPrioParamsDescOpt_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } ServingCellPrioParamsDescOpt_template::ServingCellPrioParamsDescOpt_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; } ServingCellPrioParamsDescOpt_template::ServingCellPrioParamsDescOpt_template(const ServingCellPrioParamsDescOpt_template& other_value) : Base_Template() { copy_template(other_value); } ServingCellPrioParamsDescOpt_template::~ServingCellPrioParamsDescOpt_template() { clean_up(); } ServingCellPrioParamsDescOpt_template& ServingCellPrioParamsDescOpt_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } ServingCellPrioParamsDescOpt_template& ServingCellPrioParamsDescOpt_template::operator=(const ServingCellPrioParamsDescOpt& other_value) { clean_up(); copy_value(other_value); return *this; } ServingCellPrioParamsDescOpt_template& ServingCellPrioParamsDescOpt_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const ServingCellPrioParamsDescOpt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @GSM_RestOctets.ServingCellPrioParamsDescOpt."); } return *this; } ServingCellPrioParamsDescOpt_template& ServingCellPrioParamsDescOpt_template::operator=(const ServingCellPrioParamsDescOpt_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean ServingCellPrioParamsDescOpt_template::match(const ServingCellPrioParamsDescOpt& 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.presence().is_bound()) return FALSE; if(!single_value->field_presence.match(other_value.presence(), legacy))return FALSE; if(!other_value.desc().is_bound()) return FALSE; if((other_value.desc().ispresent() ? !single_value->field_desc.match((const ServingCellPrioParamsDesc&)other_value.desc(), legacy) : !single_value->field_desc.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 @GSM_RestOctets.ServingCellPrioParamsDescOpt."); } return FALSE; } boolean ServingCellPrioParamsDescOpt_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_presence.is_bound() || (single_value->field_desc.is_omit() || single_value->field_desc.is_bound()); } boolean ServingCellPrioParamsDescOpt_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_presence.is_value() && (single_value->field_desc.is_omit() || single_value->field_desc.is_value()); } void ServingCellPrioParamsDescOpt_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; } ServingCellPrioParamsDescOpt ServingCellPrioParamsDescOpt_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @GSM_RestOctets.ServingCellPrioParamsDescOpt."); ServingCellPrioParamsDescOpt ret_val; if (single_value->field_presence.is_bound()) { ret_val.presence() = single_value->field_presence.valueof(); } if (single_value->field_desc.is_omit()) ret_val.desc() = OMIT_VALUE; else if (single_value->field_desc.is_bound()) { ret_val.desc() = single_value->field_desc.valueof(); } return ret_val; } void ServingCellPrioParamsDescOpt_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list for a template of type @GSM_RestOctets.ServingCellPrioParamsDescOpt."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new ServingCellPrioParamsDescOpt_template[list_length]; } ServingCellPrioParamsDescOpt_template& ServingCellPrioParamsDescOpt_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element of a non-list template of type @GSM_RestOctets.ServingCellPrioParamsDescOpt."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.ServingCellPrioParamsDescOpt."); return value_list.list_value[list_index]; } BITSTRING_template& ServingCellPrioParamsDescOpt_template::presence() { set_specific(); return single_value->field_presence; } const BITSTRING_template& ServingCellPrioParamsDescOpt_template::presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field presence of a non-specific template of type @GSM_RestOctets.ServingCellPrioParamsDescOpt."); return single_value->field_presence; } ServingCellPrioParamsDesc_template& ServingCellPrioParamsDescOpt_template::desc() { set_specific(); return single_value->field_desc; } const ServingCellPrioParamsDesc_template& ServingCellPrioParamsDescOpt_template::desc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field desc of a non-specific template of type @GSM_RestOctets.ServingCellPrioParamsDescOpt."); return single_value->field_desc; } int ServingCellPrioParamsDescOpt_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.ServingCellPrioParamsDescOpt which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 1; if (single_value->field_desc.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 @GSM_RestOctets.ServingCellPrioParamsDescOpt containing an empty list."); int item_size = value_list.list_value[0].size_of(); for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++) { if (value_list.list_value[l_idx].size_of()!=item_size) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.ServingCellPrioParamsDescOpt containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.ServingCellPrioParamsDescOpt containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.ServingCellPrioParamsDescOpt containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.ServingCellPrioParamsDescOpt containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.ServingCellPrioParamsDescOpt containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.ServingCellPrioParamsDescOpt containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.ServingCellPrioParamsDescOpt containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.ServingCellPrioParamsDescOpt."); } return 0; } void ServingCellPrioParamsDescOpt_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ presence := "); single_value->field_presence.log(); TTCN_Logger::log_event_str(", desc := "); single_value->field_desc.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 ServingCellPrioParamsDescOpt_template::log_match(const ServingCellPrioParamsDescOpt& 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_presence.match(match_value.presence(), legacy)){ TTCN_Logger::log_logmatch_info(".presence"); single_value->field_presence.log_match(match_value.presence(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.desc().ispresent()){ if(!single_value->field_desc.match(match_value.desc(), legacy)){ TTCN_Logger::log_logmatch_info(".desc"); single_value->field_desc.log_match(match_value.desc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_desc.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".desc := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_desc.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("{ presence := "); single_value->field_presence.log_match(match_value.presence(), legacy); TTCN_Logger::log_event_str(", desc := "); if (match_value.desc().ispresent()) { single_value->field_desc.log_match(match_value.desc(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_desc.log(); if (single_value->field_desc.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 ServingCellPrioParamsDescOpt_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (presence().is_bound()) presence().set_implicit_omit(); if (!desc().is_bound()) desc() = OMIT_VALUE; else desc().set_implicit_omit(); } void ServingCellPrioParamsDescOpt_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_presence.encode_text(text_buf); single_value->field_desc.encode_text(text_buf); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @GSM_RestOctets.ServingCellPrioParamsDescOpt."); } } void ServingCellPrioParamsDescOpt_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_presence.decode_text(text_buf); single_value->field_desc.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 ServingCellPrioParamsDescOpt_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @GSM_RestOctets.ServingCellPrioParamsDescOpt."); } } void ServingCellPrioParamsDescOpt_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: { ServingCellPrioParamsDescOpt_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) presence().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) desc().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(), "presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.ServingCellPrioParamsDescOpt: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { ServingCellPrioParamsDescOpt_template* precondition = new ServingCellPrioParamsDescOpt_template; precondition->set_param(*param.get_elem(0)); ServingCellPrioParamsDescOpt_template* implied_template = new ServingCellPrioParamsDescOpt_template; implied_template->set_param(*param.get_elem(1)); *this = ServingCellPrioParamsDescOpt_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.ServingCellPrioParamsDescOpt"); } is_ifpresent = param.get_ifpresent(); } void ServingCellPrioParamsDescOpt_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_presence.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.ServingCellPrioParamsDescOpt"); single_value->field_desc.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.ServingCellPrioParamsDescOpt"); return; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@GSM_RestOctets.ServingCellPrioParamsDescOpt"); } boolean ServingCellPrioParamsDescOpt_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean ServingCellPrioParamsDescOpt_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) geran__priority().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) thresh__priority__search().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) thresh__gsm__low().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) h__prio().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) t__reselection().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(), "geran_priority")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { geran__priority().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "thresh_priority_search")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { thresh__priority__search().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "thresh_gsm_low")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { thresh__gsm__low().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "h_prio")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { h__prio().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "t_reselection")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { t__reselection().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.ServingCellPrioParamsDesc: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.ServingCellPrioParamsDesc"); } } void ServingCellPrioParamsDesc::encode_text(Text_Buf& text_buf) const { field_geran__priority.encode_text(text_buf); field_thresh__priority__search.encode_text(text_buf); field_thresh__gsm__low.encode_text(text_buf); field_h__prio.encode_text(text_buf); field_t__reselection.encode_text(text_buf); } void ServingCellPrioParamsDesc::decode_text(Text_Buf& text_buf) { field_geran__priority.decode_text(text_buf); field_thresh__priority__search.decode_text(text_buf); field_thresh__gsm__low.decode_text(text_buf); field_h__prio.decode_text(text_buf); field_t__reselection.decode_text(text_buf); } void ServingCellPrioParamsDesc::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name); if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); PER_encode(p_td, p_buf, opt); break; } default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void ServingCellPrioParamsDesc::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name); if(!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); try { PER_decode(p_td, p_buf, opt); p_buf.PER_octet_align(FALSE); } catch (PER_Buffer_Exception) { } break; } default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int ServingCellPrioParamsDesc::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, ServingCellPrioParamsDesc_geran__priority_descr_.raw->forceomit); decoded_field_length = field_geran__priority.RAW_decode(ServingCellPrioParamsDesc_geran__priority_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, ServingCellPrioParamsDesc_thresh__priority__search_descr_.raw->forceomit); decoded_field_length = field_thresh__priority__search.RAW_decode(ServingCellPrioParamsDesc_thresh__priority__search_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, ServingCellPrioParamsDesc_thresh__gsm__low_descr_.raw->forceomit); decoded_field_length = field_thresh__gsm__low.RAW_decode(ServingCellPrioParamsDesc_thresh__gsm__low_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, ServingCellPrioParamsDesc_h__prio_descr_.raw->forceomit); decoded_field_length = field_h__prio.RAW_decode(ServingCellPrioParamsDesc_h__prio_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, ServingCellPrioParamsDesc_t__reselection_descr_.raw->forceomit); decoded_field_length = field_t__reselection.RAW_decode(ServingCellPrioParamsDesc_t__reselection_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()); p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int ServingCellPrioParamsDesc::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, ServingCellPrioParamsDesc_geran__priority_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, ServingCellPrioParamsDesc_thresh__priority__search_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, ServingCellPrioParamsDesc_thresh__gsm__low_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, ServingCellPrioParamsDesc_h__prio_descr_.raw); myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, ServingCellPrioParamsDesc_t__reselection_descr_.raw); encoded_length += field_geran__priority.RAW_encode(ServingCellPrioParamsDesc_geran__priority_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_thresh__priority__search.RAW_encode(ServingCellPrioParamsDesc_thresh__priority__search_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_thresh__gsm__low.RAW_encode(ServingCellPrioParamsDesc_thresh__gsm__low_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_h__prio.RAW_encode(ServingCellPrioParamsDesc_h__prio_descr_, *myleaf.body.node.nodes[3]); encoded_length += field_t__reselection.RAW_encode(ServingCellPrioParamsDesc_t__reselection_descr_, *myleaf.body.node.nodes[4]); return myleaf.length = encoded_length; } struct ServingCellPrioParamsDesc_template::single_value_struct { INTEGER_template field_geran__priority; INTEGER_template field_thresh__priority__search; INTEGER_template field_thresh__gsm__low; INTEGER_template field_h__prio; INTEGER_template field_t__reselection; }; void ServingCellPrioParamsDesc_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_geran__priority = ANY_VALUE; single_value->field_thresh__priority__search = ANY_VALUE; single_value->field_thresh__gsm__low = ANY_VALUE; single_value->field_h__prio = ANY_VALUE; single_value->field_t__reselection = ANY_VALUE; } } } void ServingCellPrioParamsDesc_template::copy_value(const ServingCellPrioParamsDesc& other_value) { single_value = new single_value_struct; if (other_value.geran__priority().is_bound()) { single_value->field_geran__priority = other_value.geran__priority(); } else { single_value->field_geran__priority.clean_up(); } if (other_value.thresh__priority__search().is_bound()) { single_value->field_thresh__priority__search = other_value.thresh__priority__search(); } else { single_value->field_thresh__priority__search.clean_up(); } if (other_value.thresh__gsm__low().is_bound()) { single_value->field_thresh__gsm__low = other_value.thresh__gsm__low(); } else { single_value->field_thresh__gsm__low.clean_up(); } if (other_value.h__prio().is_bound()) { single_value->field_h__prio = other_value.h__prio(); } else { single_value->field_h__prio.clean_up(); } if (other_value.t__reselection().is_bound()) { single_value->field_t__reselection = other_value.t__reselection(); } else { single_value->field_t__reselection.clean_up(); } set_selection(SPECIFIC_VALUE); } void ServingCellPrioParamsDesc_template::copy_template(const ServingCellPrioParamsDesc_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.geran__priority().get_selection()) { single_value->field_geran__priority = other_value.geran__priority(); } else { single_value->field_geran__priority.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.thresh__priority__search().get_selection()) { single_value->field_thresh__priority__search = other_value.thresh__priority__search(); } else { single_value->field_thresh__priority__search.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.thresh__gsm__low().get_selection()) { single_value->field_thresh__gsm__low = other_value.thresh__gsm__low(); } else { single_value->field_thresh__gsm__low.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.h__prio().get_selection()) { single_value->field_h__prio = other_value.h__prio(); } else { single_value->field_h__prio.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.t__reselection().get_selection()) { single_value->field_t__reselection = other_value.t__reselection(); } else { single_value->field_t__reselection.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 ServingCellPrioParamsDesc_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 ServingCellPrioParamsDesc_template(*other_value.implication_.precondition); implication_.implied_template = new ServingCellPrioParamsDesc_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of type @GSM_RestOctets.ServingCellPrioParamsDesc."); break; } set_selection(other_value); } ServingCellPrioParamsDesc_template::ServingCellPrioParamsDesc_template() { } ServingCellPrioParamsDesc_template::ServingCellPrioParamsDesc_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } ServingCellPrioParamsDesc_template::ServingCellPrioParamsDesc_template(const ServingCellPrioParamsDesc& other_value) { copy_value(other_value); } ServingCellPrioParamsDesc_template::ServingCellPrioParamsDesc_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const ServingCellPrioParamsDesc&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.ServingCellPrioParamsDesc from an unbound optional field."); } } ServingCellPrioParamsDesc_template::ServingCellPrioParamsDesc_template(ServingCellPrioParamsDesc_template* p_precondition, ServingCellPrioParamsDesc_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } ServingCellPrioParamsDesc_template::ServingCellPrioParamsDesc_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; } ServingCellPrioParamsDesc_template::ServingCellPrioParamsDesc_template(const ServingCellPrioParamsDesc_template& other_value) : Base_Template() { copy_template(other_value); } ServingCellPrioParamsDesc_template::~ServingCellPrioParamsDesc_template() { clean_up(); } ServingCellPrioParamsDesc_template& ServingCellPrioParamsDesc_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } ServingCellPrioParamsDesc_template& ServingCellPrioParamsDesc_template::operator=(const ServingCellPrioParamsDesc& other_value) { clean_up(); copy_value(other_value); return *this; } ServingCellPrioParamsDesc_template& ServingCellPrioParamsDesc_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const ServingCellPrioParamsDesc&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @GSM_RestOctets.ServingCellPrioParamsDesc."); } return *this; } ServingCellPrioParamsDesc_template& ServingCellPrioParamsDesc_template::operator=(const ServingCellPrioParamsDesc_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean ServingCellPrioParamsDesc_template::match(const ServingCellPrioParamsDesc& 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.geran__priority().is_bound()) return FALSE; if(!single_value->field_geran__priority.match(other_value.geran__priority(), legacy))return FALSE; if(!other_value.thresh__priority__search().is_bound()) return FALSE; if(!single_value->field_thresh__priority__search.match(other_value.thresh__priority__search(), legacy))return FALSE; if(!other_value.thresh__gsm__low().is_bound()) return FALSE; if(!single_value->field_thresh__gsm__low.match(other_value.thresh__gsm__low(), legacy))return FALSE; if(!other_value.h__prio().is_bound()) return FALSE; if(!single_value->field_h__prio.match(other_value.h__prio(), legacy))return FALSE; if(!other_value.t__reselection().is_bound()) return FALSE; if(!single_value->field_t__reselection.match(other_value.t__reselection(), legacy))return FALSE; return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of type @GSM_RestOctets.ServingCellPrioParamsDesc."); } return FALSE; } boolean ServingCellPrioParamsDesc_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_geran__priority.is_bound() || single_value->field_thresh__priority__search.is_bound() || single_value->field_thresh__gsm__low.is_bound() || single_value->field_h__prio.is_bound() || single_value->field_t__reselection.is_bound(); } boolean ServingCellPrioParamsDesc_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_geran__priority.is_value() && single_value->field_thresh__priority__search.is_value() && single_value->field_thresh__gsm__low.is_value() && single_value->field_h__prio.is_value() && single_value->field_t__reselection.is_value(); } void ServingCellPrioParamsDesc_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; } ServingCellPrioParamsDesc ServingCellPrioParamsDesc_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @GSM_RestOctets.ServingCellPrioParamsDesc."); ServingCellPrioParamsDesc ret_val; if (single_value->field_geran__priority.is_bound()) { ret_val.geran__priority() = single_value->field_geran__priority.valueof(); } if (single_value->field_thresh__priority__search.is_bound()) { ret_val.thresh__priority__search() = single_value->field_thresh__priority__search.valueof(); } if (single_value->field_thresh__gsm__low.is_bound()) { ret_val.thresh__gsm__low() = single_value->field_thresh__gsm__low.valueof(); } if (single_value->field_h__prio.is_bound()) { ret_val.h__prio() = single_value->field_h__prio.valueof(); } if (single_value->field_t__reselection.is_bound()) { ret_val.t__reselection() = single_value->field_t__reselection.valueof(); } return ret_val; } void ServingCellPrioParamsDesc_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list for a template of type @GSM_RestOctets.ServingCellPrioParamsDesc."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new ServingCellPrioParamsDesc_template[list_length]; } ServingCellPrioParamsDesc_template& ServingCellPrioParamsDesc_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element of a non-list template of type @GSM_RestOctets.ServingCellPrioParamsDesc."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.ServingCellPrioParamsDesc."); return value_list.list_value[list_index]; } INTEGER_template& ServingCellPrioParamsDesc_template::geran__priority() { set_specific(); return single_value->field_geran__priority; } const INTEGER_template& ServingCellPrioParamsDesc_template::geran__priority() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field geran_priority of a non-specific template of type @GSM_RestOctets.ServingCellPrioParamsDesc."); return single_value->field_geran__priority; } INTEGER_template& ServingCellPrioParamsDesc_template::thresh__priority__search() { set_specific(); return single_value->field_thresh__priority__search; } const INTEGER_template& ServingCellPrioParamsDesc_template::thresh__priority__search() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field thresh_priority_search of a non-specific template of type @GSM_RestOctets.ServingCellPrioParamsDesc."); return single_value->field_thresh__priority__search; } INTEGER_template& ServingCellPrioParamsDesc_template::thresh__gsm__low() { set_specific(); return single_value->field_thresh__gsm__low; } const INTEGER_template& ServingCellPrioParamsDesc_template::thresh__gsm__low() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field thresh_gsm_low of a non-specific template of type @GSM_RestOctets.ServingCellPrioParamsDesc."); return single_value->field_thresh__gsm__low; } INTEGER_template& ServingCellPrioParamsDesc_template::h__prio() { set_specific(); return single_value->field_h__prio; } const INTEGER_template& ServingCellPrioParamsDesc_template::h__prio() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field h_prio of a non-specific template of type @GSM_RestOctets.ServingCellPrioParamsDesc."); return single_value->field_h__prio; } INTEGER_template& ServingCellPrioParamsDesc_template::t__reselection() { set_specific(); return single_value->field_t__reselection; } const INTEGER_template& ServingCellPrioParamsDesc_template::t__reselection() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field t_reselection of a non-specific template of type @GSM_RestOctets.ServingCellPrioParamsDesc."); return single_value->field_t__reselection; } int ServingCellPrioParamsDesc_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.ServingCellPrioParamsDesc which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 5; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @GSM_RestOctets.ServingCellPrioParamsDesc containing an empty list."); int item_size = value_list.list_value[0].size_of(); for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++) { if (value_list.list_value[l_idx].size_of()!=item_size) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.ServingCellPrioParamsDesc containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.ServingCellPrioParamsDesc containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.ServingCellPrioParamsDesc containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.ServingCellPrioParamsDesc containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.ServingCellPrioParamsDesc containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.ServingCellPrioParamsDesc containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.ServingCellPrioParamsDesc containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.ServingCellPrioParamsDesc."); } return 0; } void ServingCellPrioParamsDesc_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ geran_priority := "); single_value->field_geran__priority.log(); TTCN_Logger::log_event_str(", thresh_priority_search := "); single_value->field_thresh__priority__search.log(); TTCN_Logger::log_event_str(", thresh_gsm_low := "); single_value->field_thresh__gsm__low.log(); TTCN_Logger::log_event_str(", h_prio := "); single_value->field_h__prio.log(); TTCN_Logger::log_event_str(", t_reselection := "); single_value->field_t__reselection.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 ServingCellPrioParamsDesc_template::log_match(const ServingCellPrioParamsDesc& 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_geran__priority.match(match_value.geran__priority(), legacy)){ TTCN_Logger::log_logmatch_info(".geran_priority"); single_value->field_geran__priority.log_match(match_value.geran__priority(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_thresh__priority__search.match(match_value.thresh__priority__search(), legacy)){ TTCN_Logger::log_logmatch_info(".thresh_priority_search"); single_value->field_thresh__priority__search.log_match(match_value.thresh__priority__search(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_thresh__gsm__low.match(match_value.thresh__gsm__low(), legacy)){ TTCN_Logger::log_logmatch_info(".thresh_gsm_low"); single_value->field_thresh__gsm__low.log_match(match_value.thresh__gsm__low(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_h__prio.match(match_value.h__prio(), legacy)){ TTCN_Logger::log_logmatch_info(".h_prio"); single_value->field_h__prio.log_match(match_value.h__prio(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_t__reselection.match(match_value.t__reselection(), legacy)){ TTCN_Logger::log_logmatch_info(".t_reselection"); single_value->field_t__reselection.log_match(match_value.t__reselection(), 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("{ geran_priority := "); single_value->field_geran__priority.log_match(match_value.geran__priority(), legacy); TTCN_Logger::log_event_str(", thresh_priority_search := "); single_value->field_thresh__priority__search.log_match(match_value.thresh__priority__search(), legacy); TTCN_Logger::log_event_str(", thresh_gsm_low := "); single_value->field_thresh__gsm__low.log_match(match_value.thresh__gsm__low(), legacy); TTCN_Logger::log_event_str(", h_prio := "); single_value->field_h__prio.log_match(match_value.h__prio(), legacy); TTCN_Logger::log_event_str(", t_reselection := "); single_value->field_t__reselection.log_match(match_value.t__reselection(), 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 ServingCellPrioParamsDesc_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (geran__priority().is_bound()) geran__priority().set_implicit_omit(); if (thresh__priority__search().is_bound()) thresh__priority__search().set_implicit_omit(); if (thresh__gsm__low().is_bound()) thresh__gsm__low().set_implicit_omit(); if (h__prio().is_bound()) h__prio().set_implicit_omit(); if (t__reselection().is_bound()) t__reselection().set_implicit_omit(); } void ServingCellPrioParamsDesc_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_geran__priority.encode_text(text_buf); single_value->field_thresh__priority__search.encode_text(text_buf); single_value->field_thresh__gsm__low.encode_text(text_buf); single_value->field_h__prio.encode_text(text_buf); single_value->field_t__reselection.encode_text(text_buf); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @GSM_RestOctets.ServingCellPrioParamsDesc."); } } void ServingCellPrioParamsDesc_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_geran__priority.decode_text(text_buf); single_value->field_thresh__priority__search.decode_text(text_buf); single_value->field_thresh__gsm__low.decode_text(text_buf); single_value->field_h__prio.decode_text(text_buf); single_value->field_t__reselection.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 ServingCellPrioParamsDesc_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @GSM_RestOctets.ServingCellPrioParamsDesc."); } } void ServingCellPrioParamsDesc_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: { ServingCellPrioParamsDesc_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) geran__priority().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) thresh__priority__search().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) thresh__gsm__low().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) h__prio().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) t__reselection().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(), "geran_priority")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { geran__priority().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "thresh_priority_search")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { thresh__priority__search().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "thresh_gsm_low")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { thresh__gsm__low().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "h_prio")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { h__prio().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "t_reselection")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { t__reselection().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.ServingCellPrioParamsDesc: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { ServingCellPrioParamsDesc_template* precondition = new ServingCellPrioParamsDesc_template; precondition->set_param(*param.get_elem(0)); ServingCellPrioParamsDesc_template* implied_template = new ServingCellPrioParamsDesc_template; implied_template->set_param(*param.get_elem(1)); *this = ServingCellPrioParamsDesc_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.ServingCellPrioParamsDesc"); } is_ifpresent = param.get_ifpresent(); } void ServingCellPrioParamsDesc_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_geran__priority.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.ServingCellPrioParamsDesc"); single_value->field_thresh__priority__search.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.ServingCellPrioParamsDesc"); single_value->field_thresh__gsm__low.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.ServingCellPrioParamsDesc"); single_value->field_h__prio.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.ServingCellPrioParamsDesc"); single_value->field_t__reselection.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.ServingCellPrioParamsDesc"); return; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@GSM_RestOctets.ServingCellPrioParamsDesc"); } boolean ServingCellPrioParamsDesc_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean ServingCellPrioParamsDesc_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_desc) : field_presence(par_presence), field_desc(par_desc) { } UTRAN__PrioParamsDescOpt::UTRAN__PrioParamsDescOpt(const UTRAN__PrioParamsDescOpt& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.UTRAN_PrioParamsDescOpt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.desc().is_bound()) field_desc = other_value.desc(); else field_desc.clean_up(); } void UTRAN__PrioParamsDescOpt::clean_up() { field_presence.clean_up(); field_desc.clean_up(); } const TTCN_Typedescriptor_t* UTRAN__PrioParamsDescOpt::get_descriptor() const { return &UTRAN__PrioParamsDescOpt_descr_; } UTRAN__PrioParamsDescOpt& UTRAN__PrioParamsDescOpt::operator=(const UTRAN__PrioParamsDescOpt& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.UTRAN_PrioParamsDescOpt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.desc().is_bound()) field_desc = other_value.desc(); else field_desc.clean_up(); } return *this; } boolean UTRAN__PrioParamsDescOpt::operator==(const UTRAN__PrioParamsDescOpt& other_value) const { return field_presence==other_value.field_presence && field_desc==other_value.field_desc; } boolean UTRAN__PrioParamsDescOpt::is_bound() const { return (field_presence.is_bound()) || (OPTIONAL_OMIT == field_desc.get_selection() || field_desc.is_bound()); } boolean UTRAN__PrioParamsDescOpt::is_value() const { return field_presence.is_value() && (OPTIONAL_OMIT == field_desc.get_selection() || field_desc.is_value()); } int UTRAN__PrioParamsDescOpt::size_of() const { int ret_val = 1; if (field_desc.ispresent()) ret_val++; return ret_val; } void UTRAN__PrioParamsDescOpt::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ presence := "); field_presence.log(); TTCN_Logger::log_event_str(", desc := "); field_desc.log(); TTCN_Logger::log_event_str(" }"); } void UTRAN__PrioParamsDescOpt::set_implicit_omit() { if (presence().is_bound()) presence().set_implicit_omit(); if (!desc().is_bound()) desc() = OMIT_VALUE; else desc().set_implicit_omit(); } void UTRAN__PrioParamsDescOpt::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) presence().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) desc().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(), "presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.UTRAN_PrioParamsDescOpt: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.UTRAN_PrioParamsDescOpt"); } } void UTRAN__PrioParamsDescOpt::encode_text(Text_Buf& text_buf) const { field_presence.encode_text(text_buf); field_desc.encode_text(text_buf); } void UTRAN__PrioParamsDescOpt::decode_text(Text_Buf& text_buf) { field_presence.decode_text(text_buf); field_desc.decode_text(text_buf); } void UTRAN__PrioParamsDescOpt::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name); if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); PER_encode(p_td, p_buf, opt); break; } default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void UTRAN__PrioParamsDescOpt::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name); if(!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); try { PER_decode(p_td, p_buf, opt); p_buf.PER_octet_align(FALSE); } catch (PER_Buffer_Exception) { } break; } default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int UTRAN__PrioParamsDescOpt::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, UTRAN__PrioParamsDescOpt_presence_descr_.raw->forceomit); decoded_field_length = field_presence.RAW_decode(UTRAN__PrioParamsDescOpt_presence_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); if (limit > 0 && field_presence == bs_0){ if (force_omit != NULL && (*force_omit)(1)) { field_desc = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_1_force_omit(1, force_omit, UTRAN__PrioParamsDescOpt_desc_descr_.raw->forceomit); decoded_field_length = field_desc().RAW_decode(UTRAN__PrioParamsDescOpt_desc_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 1) { field_desc = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } else field_desc=OMIT_VALUE; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int UTRAN__PrioParamsDescOpt::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, UTRAN__PrioParamsDescOpt_presence_descr_.raw); if (field_desc.ispresent()) { myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, UTRAN__PrioParamsDescOpt_desc_descr_.raw); } else myleaf.body.node.nodes[1] = NULL; encoded_length += field_presence.RAW_encode(UTRAN__PrioParamsDescOpt_presence_descr_, *myleaf.body.node.nodes[0]); if (field_desc.ispresent()) { encoded_length += field_desc().RAW_encode(UTRAN__PrioParamsDescOpt_desc_descr_, *myleaf.body.node.nodes[1]); } if (field_desc.ispresent() && (field_presence != bs_0)) { 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){ bs_0.RAW_encode(UTRAN__PrioParamsDescOpt_presence_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 UTRAN__PrioParamsDescOpt_template::single_value_struct { BITSTRING_template field_presence; BITSTRING_template field_desc; }; void UTRAN__PrioParamsDescOpt_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_presence = ANY_VALUE; single_value->field_desc = ANY_OR_OMIT; } } } void UTRAN__PrioParamsDescOpt_template::copy_value(const UTRAN__PrioParamsDescOpt& other_value) { single_value = new single_value_struct; if (other_value.presence().is_bound()) { single_value->field_presence = other_value.presence(); } else { single_value->field_presence.clean_up(); } if (other_value.desc().is_bound()) { if (other_value.desc().ispresent()) single_value->field_desc = other_value.desc()(); else single_value->field_desc = OMIT_VALUE; } else { single_value->field_desc.clean_up(); } set_selection(SPECIFIC_VALUE); } void UTRAN__PrioParamsDescOpt_template::copy_template(const UTRAN__PrioParamsDescOpt_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.presence().get_selection()) { single_value->field_presence = other_value.presence(); } else { single_value->field_presence.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.desc().get_selection()) { single_value->field_desc = other_value.desc(); } else { single_value->field_desc.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 UTRAN__PrioParamsDescOpt_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 UTRAN__PrioParamsDescOpt_template(*other_value.implication_.precondition); implication_.implied_template = new UTRAN__PrioParamsDescOpt_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of type @GSM_RestOctets.UTRAN_PrioParamsDescOpt."); break; } set_selection(other_value); } UTRAN__PrioParamsDescOpt_template::UTRAN__PrioParamsDescOpt_template() { } UTRAN__PrioParamsDescOpt_template::UTRAN__PrioParamsDescOpt_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } UTRAN__PrioParamsDescOpt_template::UTRAN__PrioParamsDescOpt_template(const UTRAN__PrioParamsDescOpt& other_value) { copy_value(other_value); } UTRAN__PrioParamsDescOpt_template::UTRAN__PrioParamsDescOpt_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const UTRAN__PrioParamsDescOpt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.UTRAN_PrioParamsDescOpt from an unbound optional field."); } } UTRAN__PrioParamsDescOpt_template::UTRAN__PrioParamsDescOpt_template(UTRAN__PrioParamsDescOpt_template* p_precondition, UTRAN__PrioParamsDescOpt_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } UTRAN__PrioParamsDescOpt_template::UTRAN__PrioParamsDescOpt_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; } UTRAN__PrioParamsDescOpt_template::UTRAN__PrioParamsDescOpt_template(const UTRAN__PrioParamsDescOpt_template& other_value) : Base_Template() { copy_template(other_value); } UTRAN__PrioParamsDescOpt_template::~UTRAN__PrioParamsDescOpt_template() { clean_up(); } UTRAN__PrioParamsDescOpt_template& UTRAN__PrioParamsDescOpt_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } UTRAN__PrioParamsDescOpt_template& UTRAN__PrioParamsDescOpt_template::operator=(const UTRAN__PrioParamsDescOpt& other_value) { clean_up(); copy_value(other_value); return *this; } UTRAN__PrioParamsDescOpt_template& UTRAN__PrioParamsDescOpt_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const UTRAN__PrioParamsDescOpt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @GSM_RestOctets.UTRAN_PrioParamsDescOpt."); } return *this; } UTRAN__PrioParamsDescOpt_template& UTRAN__PrioParamsDescOpt_template::operator=(const UTRAN__PrioParamsDescOpt_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean UTRAN__PrioParamsDescOpt_template::match(const UTRAN__PrioParamsDescOpt& 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.presence().is_bound()) return FALSE; if(!single_value->field_presence.match(other_value.presence(), legacy))return FALSE; if(!other_value.desc().is_bound()) return FALSE; if((other_value.desc().ispresent() ? !single_value->field_desc.match((const BITSTRING&)other_value.desc(), legacy) : !single_value->field_desc.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 @GSM_RestOctets.UTRAN_PrioParamsDescOpt."); } return FALSE; } boolean UTRAN__PrioParamsDescOpt_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_presence.is_bound() || (single_value->field_desc.is_omit() || single_value->field_desc.is_bound()); } boolean UTRAN__PrioParamsDescOpt_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_presence.is_value() && (single_value->field_desc.is_omit() || single_value->field_desc.is_value()); } void UTRAN__PrioParamsDescOpt_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; } UTRAN__PrioParamsDescOpt UTRAN__PrioParamsDescOpt_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @GSM_RestOctets.UTRAN_PrioParamsDescOpt."); UTRAN__PrioParamsDescOpt ret_val; if (single_value->field_presence.is_bound()) { ret_val.presence() = single_value->field_presence.valueof(); } if (single_value->field_desc.is_omit()) ret_val.desc() = OMIT_VALUE; else if (single_value->field_desc.is_bound()) { ret_val.desc() = single_value->field_desc.valueof(); } return ret_val; } void UTRAN__PrioParamsDescOpt_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list for a template of type @GSM_RestOctets.UTRAN_PrioParamsDescOpt."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new UTRAN__PrioParamsDescOpt_template[list_length]; } UTRAN__PrioParamsDescOpt_template& UTRAN__PrioParamsDescOpt_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element of a non-list template of type @GSM_RestOctets.UTRAN_PrioParamsDescOpt."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.UTRAN_PrioParamsDescOpt."); return value_list.list_value[list_index]; } BITSTRING_template& UTRAN__PrioParamsDescOpt_template::presence() { set_specific(); return single_value->field_presence; } const BITSTRING_template& UTRAN__PrioParamsDescOpt_template::presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field presence of a non-specific template of type @GSM_RestOctets.UTRAN_PrioParamsDescOpt."); return single_value->field_presence; } BITSTRING_template& UTRAN__PrioParamsDescOpt_template::desc() { set_specific(); return single_value->field_desc; } const BITSTRING_template& UTRAN__PrioParamsDescOpt_template::desc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field desc of a non-specific template of type @GSM_RestOctets.UTRAN_PrioParamsDescOpt."); return single_value->field_desc; } int UTRAN__PrioParamsDescOpt_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_PrioParamsDescOpt which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 1; if (single_value->field_desc.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 @GSM_RestOctets.UTRAN_PrioParamsDescOpt containing an empty list."); int item_size = value_list.list_value[0].size_of(); for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++) { if (value_list.list_value[l_idx].size_of()!=item_size) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_PrioParamsDescOpt containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_PrioParamsDescOpt containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_PrioParamsDescOpt containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_PrioParamsDescOpt containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_PrioParamsDescOpt containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_PrioParamsDescOpt containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UTRAN_PrioParamsDescOpt containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.UTRAN_PrioParamsDescOpt."); } return 0; } void UTRAN__PrioParamsDescOpt_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ presence := "); single_value->field_presence.log(); TTCN_Logger::log_event_str(", desc := "); single_value->field_desc.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 UTRAN__PrioParamsDescOpt_template::log_match(const UTRAN__PrioParamsDescOpt& 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_presence.match(match_value.presence(), legacy)){ TTCN_Logger::log_logmatch_info(".presence"); single_value->field_presence.log_match(match_value.presence(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.desc().ispresent()){ if(!single_value->field_desc.match(match_value.desc(), legacy)){ TTCN_Logger::log_logmatch_info(".desc"); single_value->field_desc.log_match(match_value.desc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_desc.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".desc := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_desc.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("{ presence := "); single_value->field_presence.log_match(match_value.presence(), legacy); TTCN_Logger::log_event_str(", desc := "); if (match_value.desc().ispresent()) { single_value->field_desc.log_match(match_value.desc(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_desc.log(); if (single_value->field_desc.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 UTRAN__PrioParamsDescOpt_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (presence().is_bound()) presence().set_implicit_omit(); if (!desc().is_bound()) desc() = OMIT_VALUE; else desc().set_implicit_omit(); } void UTRAN__PrioParamsDescOpt_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_presence.encode_text(text_buf); single_value->field_desc.encode_text(text_buf); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @GSM_RestOctets.UTRAN_PrioParamsDescOpt."); } } void UTRAN__PrioParamsDescOpt_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_presence.decode_text(text_buf); single_value->field_desc.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 UTRAN__PrioParamsDescOpt_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @GSM_RestOctets.UTRAN_PrioParamsDescOpt."); } } void UTRAN__PrioParamsDescOpt_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: { UTRAN__PrioParamsDescOpt_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) presence().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) desc().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(), "presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.UTRAN_PrioParamsDescOpt: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { UTRAN__PrioParamsDescOpt_template* precondition = new UTRAN__PrioParamsDescOpt_template; precondition->set_param(*param.get_elem(0)); UTRAN__PrioParamsDescOpt_template* implied_template = new UTRAN__PrioParamsDescOpt_template; implied_template->set_param(*param.get_elem(1)); *this = UTRAN__PrioParamsDescOpt_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.UTRAN_PrioParamsDescOpt"); } is_ifpresent = param.get_ifpresent(); } void UTRAN__PrioParamsDescOpt_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_presence.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.UTRAN_PrioParamsDescOpt"); single_value->field_desc.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.UTRAN_PrioParamsDescOpt"); return; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@GSM_RestOctets.UTRAN_PrioParamsDescOpt"); } boolean UTRAN__PrioParamsDescOpt_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean UTRAN__PrioParamsDescOpt_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_desc) : field_presence(par_presence), field_desc(par_desc) { } EUTRAN__ParamsDescOpt::EUTRAN__ParamsDescOpt(const EUTRAN__ParamsDescOpt& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.EUTRAN_ParamsDescOpt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.desc().is_bound()) field_desc = other_value.desc(); else field_desc.clean_up(); } void EUTRAN__ParamsDescOpt::clean_up() { field_presence.clean_up(); field_desc.clean_up(); } const TTCN_Typedescriptor_t* EUTRAN__ParamsDescOpt::get_descriptor() const { return &EUTRAN__ParamsDescOpt_descr_; } EUTRAN__ParamsDescOpt& EUTRAN__ParamsDescOpt::operator=(const EUTRAN__ParamsDescOpt& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.EUTRAN_ParamsDescOpt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.desc().is_bound()) field_desc = other_value.desc(); else field_desc.clean_up(); } return *this; } boolean EUTRAN__ParamsDescOpt::operator==(const EUTRAN__ParamsDescOpt& other_value) const { return field_presence==other_value.field_presence && field_desc==other_value.field_desc; } boolean EUTRAN__ParamsDescOpt::is_bound() const { return (field_presence.is_bound()) || (OPTIONAL_OMIT == field_desc.get_selection() || field_desc.is_bound()); } boolean EUTRAN__ParamsDescOpt::is_value() const { return field_presence.is_value() && (OPTIONAL_OMIT == field_desc.get_selection() || field_desc.is_value()); } int EUTRAN__ParamsDescOpt::size_of() const { int ret_val = 1; if (field_desc.ispresent()) ret_val++; return ret_val; } void EUTRAN__ParamsDescOpt::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ presence := "); field_presence.log(); TTCN_Logger::log_event_str(", desc := "); field_desc.log(); TTCN_Logger::log_event_str(" }"); } void EUTRAN__ParamsDescOpt::set_implicit_omit() { if (presence().is_bound()) presence().set_implicit_omit(); if (!desc().is_bound()) desc() = OMIT_VALUE; else desc().set_implicit_omit(); } void EUTRAN__ParamsDescOpt::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) presence().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) desc().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(), "presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.EUTRAN_ParamsDescOpt: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.EUTRAN_ParamsDescOpt"); } } void EUTRAN__ParamsDescOpt::encode_text(Text_Buf& text_buf) const { field_presence.encode_text(text_buf); field_desc.encode_text(text_buf); } void EUTRAN__ParamsDescOpt::decode_text(Text_Buf& text_buf) { field_presence.decode_text(text_buf); field_desc.decode_text(text_buf); } void EUTRAN__ParamsDescOpt::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name); if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); PER_encode(p_td, p_buf, opt); break; } default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void EUTRAN__ParamsDescOpt::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name); if(!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); try { PER_decode(p_td, p_buf, opt); p_buf.PER_octet_align(FALSE); } catch (PER_Buffer_Exception) { } break; } default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int EUTRAN__ParamsDescOpt::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, EUTRAN__ParamsDescOpt_presence_descr_.raw->forceomit); decoded_field_length = field_presence.RAW_decode(EUTRAN__ParamsDescOpt_presence_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); if (limit > 0 && field_presence == bs_0){ if (force_omit != NULL && (*force_omit)(1)) { field_desc = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_1_force_omit(1, force_omit, EUTRAN__ParamsDescOpt_desc_descr_.raw->forceomit); decoded_field_length = field_desc().RAW_decode(EUTRAN__ParamsDescOpt_desc_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 1) { field_desc = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } else field_desc=OMIT_VALUE; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int EUTRAN__ParamsDescOpt::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, EUTRAN__ParamsDescOpt_presence_descr_.raw); if (field_desc.ispresent()) { myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, EUTRAN__ParamsDescOpt_desc_descr_.raw); } else myleaf.body.node.nodes[1] = NULL; encoded_length += field_presence.RAW_encode(EUTRAN__ParamsDescOpt_presence_descr_, *myleaf.body.node.nodes[0]); if (field_desc.ispresent()) { encoded_length += field_desc().RAW_encode(EUTRAN__ParamsDescOpt_desc_descr_, *myleaf.body.node.nodes[1]); } if (field_desc.ispresent() && (field_presence != bs_0)) { 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){ bs_0.RAW_encode(EUTRAN__ParamsDescOpt_presence_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 EUTRAN__ParamsDescOpt_template::single_value_struct { BITSTRING_template field_presence; EUTRAN__ParamsDesc_template field_desc; }; void EUTRAN__ParamsDescOpt_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_presence = ANY_VALUE; single_value->field_desc = ANY_OR_OMIT; } } } void EUTRAN__ParamsDescOpt_template::copy_value(const EUTRAN__ParamsDescOpt& other_value) { single_value = new single_value_struct; if (other_value.presence().is_bound()) { single_value->field_presence = other_value.presence(); } else { single_value->field_presence.clean_up(); } if (other_value.desc().is_bound()) { if (other_value.desc().ispresent()) single_value->field_desc = other_value.desc()(); else single_value->field_desc = OMIT_VALUE; } else { single_value->field_desc.clean_up(); } set_selection(SPECIFIC_VALUE); } void EUTRAN__ParamsDescOpt_template::copy_template(const EUTRAN__ParamsDescOpt_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.presence().get_selection()) { single_value->field_presence = other_value.presence(); } else { single_value->field_presence.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.desc().get_selection()) { single_value->field_desc = other_value.desc(); } else { single_value->field_desc.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 EUTRAN__ParamsDescOpt_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 EUTRAN__ParamsDescOpt_template(*other_value.implication_.precondition); implication_.implied_template = new EUTRAN__ParamsDescOpt_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of type @GSM_RestOctets.EUTRAN_ParamsDescOpt."); break; } set_selection(other_value); } EUTRAN__ParamsDescOpt_template::EUTRAN__ParamsDescOpt_template() { } EUTRAN__ParamsDescOpt_template::EUTRAN__ParamsDescOpt_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } EUTRAN__ParamsDescOpt_template::EUTRAN__ParamsDescOpt_template(const EUTRAN__ParamsDescOpt& other_value) { copy_value(other_value); } EUTRAN__ParamsDescOpt_template::EUTRAN__ParamsDescOpt_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const EUTRAN__ParamsDescOpt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.EUTRAN_ParamsDescOpt from an unbound optional field."); } } EUTRAN__ParamsDescOpt_template::EUTRAN__ParamsDescOpt_template(EUTRAN__ParamsDescOpt_template* p_precondition, EUTRAN__ParamsDescOpt_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } EUTRAN__ParamsDescOpt_template::EUTRAN__ParamsDescOpt_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; } EUTRAN__ParamsDescOpt_template::EUTRAN__ParamsDescOpt_template(const EUTRAN__ParamsDescOpt_template& other_value) : Base_Template() { copy_template(other_value); } EUTRAN__ParamsDescOpt_template::~EUTRAN__ParamsDescOpt_template() { clean_up(); } EUTRAN__ParamsDescOpt_template& EUTRAN__ParamsDescOpt_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } EUTRAN__ParamsDescOpt_template& EUTRAN__ParamsDescOpt_template::operator=(const EUTRAN__ParamsDescOpt& other_value) { clean_up(); copy_value(other_value); return *this; } EUTRAN__ParamsDescOpt_template& EUTRAN__ParamsDescOpt_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const EUTRAN__ParamsDescOpt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @GSM_RestOctets.EUTRAN_ParamsDescOpt."); } return *this; } EUTRAN__ParamsDescOpt_template& EUTRAN__ParamsDescOpt_template::operator=(const EUTRAN__ParamsDescOpt_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean EUTRAN__ParamsDescOpt_template::match(const EUTRAN__ParamsDescOpt& 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.presence().is_bound()) return FALSE; if(!single_value->field_presence.match(other_value.presence(), legacy))return FALSE; if(!other_value.desc().is_bound()) return FALSE; if((other_value.desc().ispresent() ? !single_value->field_desc.match((const EUTRAN__ParamsDesc&)other_value.desc(), legacy) : !single_value->field_desc.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 @GSM_RestOctets.EUTRAN_ParamsDescOpt."); } return FALSE; } boolean EUTRAN__ParamsDescOpt_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_presence.is_bound() || (single_value->field_desc.is_omit() || single_value->field_desc.is_bound()); } boolean EUTRAN__ParamsDescOpt_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_presence.is_value() && (single_value->field_desc.is_omit() || single_value->field_desc.is_value()); } void EUTRAN__ParamsDescOpt_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; } EUTRAN__ParamsDescOpt EUTRAN__ParamsDescOpt_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @GSM_RestOctets.EUTRAN_ParamsDescOpt."); EUTRAN__ParamsDescOpt ret_val; if (single_value->field_presence.is_bound()) { ret_val.presence() = single_value->field_presence.valueof(); } if (single_value->field_desc.is_omit()) ret_val.desc() = OMIT_VALUE; else if (single_value->field_desc.is_bound()) { ret_val.desc() = single_value->field_desc.valueof(); } return ret_val; } void EUTRAN__ParamsDescOpt_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list for a template of type @GSM_RestOctets.EUTRAN_ParamsDescOpt."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new EUTRAN__ParamsDescOpt_template[list_length]; } EUTRAN__ParamsDescOpt_template& EUTRAN__ParamsDescOpt_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element of a non-list template of type @GSM_RestOctets.EUTRAN_ParamsDescOpt."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.EUTRAN_ParamsDescOpt."); return value_list.list_value[list_index]; } BITSTRING_template& EUTRAN__ParamsDescOpt_template::presence() { set_specific(); return single_value->field_presence; } const BITSTRING_template& EUTRAN__ParamsDescOpt_template::presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field presence of a non-specific template of type @GSM_RestOctets.EUTRAN_ParamsDescOpt."); return single_value->field_presence; } EUTRAN__ParamsDesc_template& EUTRAN__ParamsDescOpt_template::desc() { set_specific(); return single_value->field_desc; } const EUTRAN__ParamsDesc_template& EUTRAN__ParamsDescOpt_template::desc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field desc of a non-specific template of type @GSM_RestOctets.EUTRAN_ParamsDescOpt."); return single_value->field_desc; } int EUTRAN__ParamsDescOpt_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_ParamsDescOpt which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 1; if (single_value->field_desc.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 @GSM_RestOctets.EUTRAN_ParamsDescOpt containing an empty list."); int item_size = value_list.list_value[0].size_of(); for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++) { if (value_list.list_value[l_idx].size_of()!=item_size) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_ParamsDescOpt containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_ParamsDescOpt containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_ParamsDescOpt containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_ParamsDescOpt containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_ParamsDescOpt containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_ParamsDescOpt containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_ParamsDescOpt containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.EUTRAN_ParamsDescOpt."); } return 0; } void EUTRAN__ParamsDescOpt_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ presence := "); single_value->field_presence.log(); TTCN_Logger::log_event_str(", desc := "); single_value->field_desc.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 EUTRAN__ParamsDescOpt_template::log_match(const EUTRAN__ParamsDescOpt& 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_presence.match(match_value.presence(), legacy)){ TTCN_Logger::log_logmatch_info(".presence"); single_value->field_presence.log_match(match_value.presence(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.desc().ispresent()){ if(!single_value->field_desc.match(match_value.desc(), legacy)){ TTCN_Logger::log_logmatch_info(".desc"); single_value->field_desc.log_match(match_value.desc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_desc.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".desc := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_desc.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("{ presence := "); single_value->field_presence.log_match(match_value.presence(), legacy); TTCN_Logger::log_event_str(", desc := "); if (match_value.desc().ispresent()) { single_value->field_desc.log_match(match_value.desc(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_desc.log(); if (single_value->field_desc.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 EUTRAN__ParamsDescOpt_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (presence().is_bound()) presence().set_implicit_omit(); if (!desc().is_bound()) desc() = OMIT_VALUE; else desc().set_implicit_omit(); } void EUTRAN__ParamsDescOpt_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_presence.encode_text(text_buf); single_value->field_desc.encode_text(text_buf); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @GSM_RestOctets.EUTRAN_ParamsDescOpt."); } } void EUTRAN__ParamsDescOpt_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_presence.decode_text(text_buf); single_value->field_desc.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 EUTRAN__ParamsDescOpt_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @GSM_RestOctets.EUTRAN_ParamsDescOpt."); } } void EUTRAN__ParamsDescOpt_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: { EUTRAN__ParamsDescOpt_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) presence().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) desc().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(), "presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.EUTRAN_ParamsDescOpt: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { EUTRAN__ParamsDescOpt_template* precondition = new EUTRAN__ParamsDescOpt_template; precondition->set_param(*param.get_elem(0)); EUTRAN__ParamsDescOpt_template* implied_template = new EUTRAN__ParamsDescOpt_template; implied_template->set_param(*param.get_elem(1)); *this = EUTRAN__ParamsDescOpt_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.EUTRAN_ParamsDescOpt"); } is_ifpresent = param.get_ifpresent(); } void EUTRAN__ParamsDescOpt_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_presence.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.EUTRAN_ParamsDescOpt"); single_value->field_desc.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.EUTRAN_ParamsDescOpt"); return; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@GSM_RestOctets.EUTRAN_ParamsDescOpt"); } boolean EUTRAN__ParamsDescOpt_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean EUTRAN__ParamsDescOpt_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_desc) : field_presence(par_presence), field_desc(par_desc) { } EUTRAN__MeasParamsDescOpt::EUTRAN__MeasParamsDescOpt(const EUTRAN__MeasParamsDescOpt& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.EUTRAN_MeasParamsDescOpt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.desc().is_bound()) field_desc = other_value.desc(); else field_desc.clean_up(); } void EUTRAN__MeasParamsDescOpt::clean_up() { field_presence.clean_up(); field_desc.clean_up(); } const TTCN_Typedescriptor_t* EUTRAN__MeasParamsDescOpt::get_descriptor() const { return &EUTRAN__MeasParamsDescOpt_descr_; } EUTRAN__MeasParamsDescOpt& EUTRAN__MeasParamsDescOpt::operator=(const EUTRAN__MeasParamsDescOpt& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.EUTRAN_MeasParamsDescOpt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.desc().is_bound()) field_desc = other_value.desc(); else field_desc.clean_up(); } return *this; } boolean EUTRAN__MeasParamsDescOpt::operator==(const EUTRAN__MeasParamsDescOpt& other_value) const { return field_presence==other_value.field_presence && field_desc==other_value.field_desc; } boolean EUTRAN__MeasParamsDescOpt::is_bound() const { return (field_presence.is_bound()) || (OPTIONAL_OMIT == field_desc.get_selection() || field_desc.is_bound()); } boolean EUTRAN__MeasParamsDescOpt::is_value() const { return field_presence.is_value() && (OPTIONAL_OMIT == field_desc.get_selection() || field_desc.is_value()); } int EUTRAN__MeasParamsDescOpt::size_of() const { int ret_val = 1; if (field_desc.ispresent()) ret_val++; return ret_val; } void EUTRAN__MeasParamsDescOpt::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ presence := "); field_presence.log(); TTCN_Logger::log_event_str(", desc := "); field_desc.log(); TTCN_Logger::log_event_str(" }"); } void EUTRAN__MeasParamsDescOpt::set_implicit_omit() { if (presence().is_bound()) presence().set_implicit_omit(); if (!desc().is_bound()) desc() = OMIT_VALUE; else desc().set_implicit_omit(); } void EUTRAN__MeasParamsDescOpt::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) presence().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) desc().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(), "presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.EUTRAN_MeasParamsDescOpt: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.EUTRAN_MeasParamsDescOpt"); } } void EUTRAN__MeasParamsDescOpt::encode_text(Text_Buf& text_buf) const { field_presence.encode_text(text_buf); field_desc.encode_text(text_buf); } void EUTRAN__MeasParamsDescOpt::decode_text(Text_Buf& text_buf) { field_presence.decode_text(text_buf); field_desc.decode_text(text_buf); } void EUTRAN__MeasParamsDescOpt::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name); if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); PER_encode(p_td, p_buf, opt); break; } default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void EUTRAN__MeasParamsDescOpt::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name); if(!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); try { PER_decode(p_td, p_buf, opt); p_buf.PER_octet_align(FALSE); } catch (PER_Buffer_Exception) { } break; } default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int EUTRAN__MeasParamsDescOpt::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, EUTRAN__MeasParamsDescOpt_presence_descr_.raw->forceomit); decoded_field_length = field_presence.RAW_decode(EUTRAN__MeasParamsDescOpt_presence_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); if (limit > 0 && field_presence == bs_0){ if (force_omit != NULL && (*force_omit)(1)) { field_desc = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_1_force_omit(1, force_omit, EUTRAN__MeasParamsDescOpt_desc_descr_.raw->forceomit); decoded_field_length = field_desc().RAW_decode(EUTRAN__MeasParamsDescOpt_desc_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 1) { field_desc = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } else field_desc=OMIT_VALUE; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int EUTRAN__MeasParamsDescOpt::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, EUTRAN__MeasParamsDescOpt_presence_descr_.raw); if (field_desc.ispresent()) { myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, EUTRAN__MeasParamsDescOpt_desc_descr_.raw); } else myleaf.body.node.nodes[1] = NULL; encoded_length += field_presence.RAW_encode(EUTRAN__MeasParamsDescOpt_presence_descr_, *myleaf.body.node.nodes[0]); if (field_desc.ispresent()) { encoded_length += field_desc().RAW_encode(EUTRAN__MeasParamsDescOpt_desc_descr_, *myleaf.body.node.nodes[1]); } if (field_desc.ispresent() && (field_presence != bs_0)) { 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){ bs_0.RAW_encode(EUTRAN__MeasParamsDescOpt_presence_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 EUTRAN__MeasParamsDescOpt_template::single_value_struct { BITSTRING_template field_presence; BITSTRING_template field_desc; }; void EUTRAN__MeasParamsDescOpt_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_presence = ANY_VALUE; single_value->field_desc = ANY_OR_OMIT; } } } void EUTRAN__MeasParamsDescOpt_template::copy_value(const EUTRAN__MeasParamsDescOpt& other_value) { single_value = new single_value_struct; if (other_value.presence().is_bound()) { single_value->field_presence = other_value.presence(); } else { single_value->field_presence.clean_up(); } if (other_value.desc().is_bound()) { if (other_value.desc().ispresent()) single_value->field_desc = other_value.desc()(); else single_value->field_desc = OMIT_VALUE; } else { single_value->field_desc.clean_up(); } set_selection(SPECIFIC_VALUE); } void EUTRAN__MeasParamsDescOpt_template::copy_template(const EUTRAN__MeasParamsDescOpt_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.presence().get_selection()) { single_value->field_presence = other_value.presence(); } else { single_value->field_presence.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.desc().get_selection()) { single_value->field_desc = other_value.desc(); } else { single_value->field_desc.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 EUTRAN__MeasParamsDescOpt_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 EUTRAN__MeasParamsDescOpt_template(*other_value.implication_.precondition); implication_.implied_template = new EUTRAN__MeasParamsDescOpt_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of type @GSM_RestOctets.EUTRAN_MeasParamsDescOpt."); break; } set_selection(other_value); } EUTRAN__MeasParamsDescOpt_template::EUTRAN__MeasParamsDescOpt_template() { } EUTRAN__MeasParamsDescOpt_template::EUTRAN__MeasParamsDescOpt_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } EUTRAN__MeasParamsDescOpt_template::EUTRAN__MeasParamsDescOpt_template(const EUTRAN__MeasParamsDescOpt& other_value) { copy_value(other_value); } EUTRAN__MeasParamsDescOpt_template::EUTRAN__MeasParamsDescOpt_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const EUTRAN__MeasParamsDescOpt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.EUTRAN_MeasParamsDescOpt from an unbound optional field."); } } EUTRAN__MeasParamsDescOpt_template::EUTRAN__MeasParamsDescOpt_template(EUTRAN__MeasParamsDescOpt_template* p_precondition, EUTRAN__MeasParamsDescOpt_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } EUTRAN__MeasParamsDescOpt_template::EUTRAN__MeasParamsDescOpt_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; } EUTRAN__MeasParamsDescOpt_template::EUTRAN__MeasParamsDescOpt_template(const EUTRAN__MeasParamsDescOpt_template& other_value) : Base_Template() { copy_template(other_value); } EUTRAN__MeasParamsDescOpt_template::~EUTRAN__MeasParamsDescOpt_template() { clean_up(); } EUTRAN__MeasParamsDescOpt_template& EUTRAN__MeasParamsDescOpt_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } EUTRAN__MeasParamsDescOpt_template& EUTRAN__MeasParamsDescOpt_template::operator=(const EUTRAN__MeasParamsDescOpt& other_value) { clean_up(); copy_value(other_value); return *this; } EUTRAN__MeasParamsDescOpt_template& EUTRAN__MeasParamsDescOpt_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const EUTRAN__MeasParamsDescOpt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @GSM_RestOctets.EUTRAN_MeasParamsDescOpt."); } return *this; } EUTRAN__MeasParamsDescOpt_template& EUTRAN__MeasParamsDescOpt_template::operator=(const EUTRAN__MeasParamsDescOpt_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean EUTRAN__MeasParamsDescOpt_template::match(const EUTRAN__MeasParamsDescOpt& 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.presence().is_bound()) return FALSE; if(!single_value->field_presence.match(other_value.presence(), legacy))return FALSE; if(!other_value.desc().is_bound()) return FALSE; if((other_value.desc().ispresent() ? !single_value->field_desc.match((const BITSTRING&)other_value.desc(), legacy) : !single_value->field_desc.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 @GSM_RestOctets.EUTRAN_MeasParamsDescOpt."); } return FALSE; } boolean EUTRAN__MeasParamsDescOpt_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_presence.is_bound() || (single_value->field_desc.is_omit() || single_value->field_desc.is_bound()); } boolean EUTRAN__MeasParamsDescOpt_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_presence.is_value() && (single_value->field_desc.is_omit() || single_value->field_desc.is_value()); } void EUTRAN__MeasParamsDescOpt_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; } EUTRAN__MeasParamsDescOpt EUTRAN__MeasParamsDescOpt_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @GSM_RestOctets.EUTRAN_MeasParamsDescOpt."); EUTRAN__MeasParamsDescOpt ret_val; if (single_value->field_presence.is_bound()) { ret_val.presence() = single_value->field_presence.valueof(); } if (single_value->field_desc.is_omit()) ret_val.desc() = OMIT_VALUE; else if (single_value->field_desc.is_bound()) { ret_val.desc() = single_value->field_desc.valueof(); } return ret_val; } void EUTRAN__MeasParamsDescOpt_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list for a template of type @GSM_RestOctets.EUTRAN_MeasParamsDescOpt."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new EUTRAN__MeasParamsDescOpt_template[list_length]; } EUTRAN__MeasParamsDescOpt_template& EUTRAN__MeasParamsDescOpt_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element of a non-list template of type @GSM_RestOctets.EUTRAN_MeasParamsDescOpt."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.EUTRAN_MeasParamsDescOpt."); return value_list.list_value[list_index]; } BITSTRING_template& EUTRAN__MeasParamsDescOpt_template::presence() { set_specific(); return single_value->field_presence; } const BITSTRING_template& EUTRAN__MeasParamsDescOpt_template::presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field presence of a non-specific template of type @GSM_RestOctets.EUTRAN_MeasParamsDescOpt."); return single_value->field_presence; } BITSTRING_template& EUTRAN__MeasParamsDescOpt_template::desc() { set_specific(); return single_value->field_desc; } const BITSTRING_template& EUTRAN__MeasParamsDescOpt_template::desc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field desc of a non-specific template of type @GSM_RestOctets.EUTRAN_MeasParamsDescOpt."); return single_value->field_desc; } int EUTRAN__MeasParamsDescOpt_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_MeasParamsDescOpt which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 1; if (single_value->field_desc.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 @GSM_RestOctets.EUTRAN_MeasParamsDescOpt containing an empty list."); int item_size = value_list.list_value[0].size_of(); for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++) { if (value_list.list_value[l_idx].size_of()!=item_size) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_MeasParamsDescOpt containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_MeasParamsDescOpt containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_MeasParamsDescOpt containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_MeasParamsDescOpt containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_MeasParamsDescOpt containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_MeasParamsDescOpt containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_MeasParamsDescOpt containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.EUTRAN_MeasParamsDescOpt."); } return 0; } void EUTRAN__MeasParamsDescOpt_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ presence := "); single_value->field_presence.log(); TTCN_Logger::log_event_str(", desc := "); single_value->field_desc.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 EUTRAN__MeasParamsDescOpt_template::log_match(const EUTRAN__MeasParamsDescOpt& 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_presence.match(match_value.presence(), legacy)){ TTCN_Logger::log_logmatch_info(".presence"); single_value->field_presence.log_match(match_value.presence(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.desc().ispresent()){ if(!single_value->field_desc.match(match_value.desc(), legacy)){ TTCN_Logger::log_logmatch_info(".desc"); single_value->field_desc.log_match(match_value.desc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_desc.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".desc := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_desc.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("{ presence := "); single_value->field_presence.log_match(match_value.presence(), legacy); TTCN_Logger::log_event_str(", desc := "); if (match_value.desc().ispresent()) { single_value->field_desc.log_match(match_value.desc(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_desc.log(); if (single_value->field_desc.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 EUTRAN__MeasParamsDescOpt_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (presence().is_bound()) presence().set_implicit_omit(); if (!desc().is_bound()) desc() = OMIT_VALUE; else desc().set_implicit_omit(); } void EUTRAN__MeasParamsDescOpt_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_presence.encode_text(text_buf); single_value->field_desc.encode_text(text_buf); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @GSM_RestOctets.EUTRAN_MeasParamsDescOpt."); } } void EUTRAN__MeasParamsDescOpt_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_presence.decode_text(text_buf); single_value->field_desc.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 EUTRAN__MeasParamsDescOpt_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @GSM_RestOctets.EUTRAN_MeasParamsDescOpt."); } } void EUTRAN__MeasParamsDescOpt_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: { EUTRAN__MeasParamsDescOpt_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) presence().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) desc().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(), "presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.EUTRAN_MeasParamsDescOpt: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { EUTRAN__MeasParamsDescOpt_template* precondition = new EUTRAN__MeasParamsDescOpt_template; precondition->set_param(*param.get_elem(0)); EUTRAN__MeasParamsDescOpt_template* implied_template = new EUTRAN__MeasParamsDescOpt_template; implied_template->set_param(*param.get_elem(1)); *this = EUTRAN__MeasParamsDescOpt_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.EUTRAN_MeasParamsDescOpt"); } is_ifpresent = param.get_ifpresent(); } void EUTRAN__MeasParamsDescOpt_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_presence.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.EUTRAN_MeasParamsDescOpt"); single_value->field_desc.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.EUTRAN_MeasParamsDescOpt"); return; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@GSM_RestOctets.EUTRAN_MeasParamsDescOpt"); } boolean EUTRAN__MeasParamsDescOpt_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean EUTRAN__MeasParamsDescOpt_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_desc) : field_presence(par_presence), field_desc(par_desc) { } EUTRAN__GPRSMeasParamsDescOpt::EUTRAN__GPRSMeasParamsDescOpt(const EUTRAN__GPRSMeasParamsDescOpt& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.EUTRAN_GPRSMeasParamsDescOpt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.desc().is_bound()) field_desc = other_value.desc(); else field_desc.clean_up(); } void EUTRAN__GPRSMeasParamsDescOpt::clean_up() { field_presence.clean_up(); field_desc.clean_up(); } const TTCN_Typedescriptor_t* EUTRAN__GPRSMeasParamsDescOpt::get_descriptor() const { return &EUTRAN__GPRSMeasParamsDescOpt_descr_; } EUTRAN__GPRSMeasParamsDescOpt& EUTRAN__GPRSMeasParamsDescOpt::operator=(const EUTRAN__GPRSMeasParamsDescOpt& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.EUTRAN_GPRSMeasParamsDescOpt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.desc().is_bound()) field_desc = other_value.desc(); else field_desc.clean_up(); } return *this; } boolean EUTRAN__GPRSMeasParamsDescOpt::operator==(const EUTRAN__GPRSMeasParamsDescOpt& other_value) const { return field_presence==other_value.field_presence && field_desc==other_value.field_desc; } boolean EUTRAN__GPRSMeasParamsDescOpt::is_bound() const { return (field_presence.is_bound()) || (OPTIONAL_OMIT == field_desc.get_selection() || field_desc.is_bound()); } boolean EUTRAN__GPRSMeasParamsDescOpt::is_value() const { return field_presence.is_value() && (OPTIONAL_OMIT == field_desc.get_selection() || field_desc.is_value()); } int EUTRAN__GPRSMeasParamsDescOpt::size_of() const { int ret_val = 1; if (field_desc.ispresent()) ret_val++; return ret_val; } void EUTRAN__GPRSMeasParamsDescOpt::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ presence := "); field_presence.log(); TTCN_Logger::log_event_str(", desc := "); field_desc.log(); TTCN_Logger::log_event_str(" }"); } void EUTRAN__GPRSMeasParamsDescOpt::set_implicit_omit() { if (presence().is_bound()) presence().set_implicit_omit(); if (!desc().is_bound()) desc() = OMIT_VALUE; else desc().set_implicit_omit(); } void EUTRAN__GPRSMeasParamsDescOpt::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) presence().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) desc().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(), "presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.EUTRAN_GPRSMeasParamsDescOpt: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.EUTRAN_GPRSMeasParamsDescOpt"); } } void EUTRAN__GPRSMeasParamsDescOpt::encode_text(Text_Buf& text_buf) const { field_presence.encode_text(text_buf); field_desc.encode_text(text_buf); } void EUTRAN__GPRSMeasParamsDescOpt::decode_text(Text_Buf& text_buf) { field_presence.decode_text(text_buf); field_desc.decode_text(text_buf); } void EUTRAN__GPRSMeasParamsDescOpt::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name); if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); PER_encode(p_td, p_buf, opt); break; } default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void EUTRAN__GPRSMeasParamsDescOpt::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name); if(!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); try { PER_decode(p_td, p_buf, opt); p_buf.PER_octet_align(FALSE); } catch (PER_Buffer_Exception) { } break; } default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int EUTRAN__GPRSMeasParamsDescOpt::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, EUTRAN__GPRSMeasParamsDescOpt_presence_descr_.raw->forceomit); decoded_field_length = field_presence.RAW_decode(EUTRAN__GPRSMeasParamsDescOpt_presence_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); if (limit > 0 && field_presence == bs_0){ if (force_omit != NULL && (*force_omit)(1)) { field_desc = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_1_force_omit(1, force_omit, EUTRAN__GPRSMeasParamsDescOpt_desc_descr_.raw->forceomit); decoded_field_length = field_desc().RAW_decode(EUTRAN__GPRSMeasParamsDescOpt_desc_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 1) { field_desc = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } else field_desc=OMIT_VALUE; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int EUTRAN__GPRSMeasParamsDescOpt::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, EUTRAN__GPRSMeasParamsDescOpt_presence_descr_.raw); if (field_desc.ispresent()) { myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, EUTRAN__GPRSMeasParamsDescOpt_desc_descr_.raw); } else myleaf.body.node.nodes[1] = NULL; encoded_length += field_presence.RAW_encode(EUTRAN__GPRSMeasParamsDescOpt_presence_descr_, *myleaf.body.node.nodes[0]); if (field_desc.ispresent()) { encoded_length += field_desc().RAW_encode(EUTRAN__GPRSMeasParamsDescOpt_desc_descr_, *myleaf.body.node.nodes[1]); } if (field_desc.ispresent() && (field_presence != bs_0)) { 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){ bs_0.RAW_encode(EUTRAN__GPRSMeasParamsDescOpt_presence_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 EUTRAN__GPRSMeasParamsDescOpt_template::single_value_struct { BITSTRING_template field_presence; BITSTRING_template field_desc; }; void EUTRAN__GPRSMeasParamsDescOpt_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_presence = ANY_VALUE; single_value->field_desc = ANY_OR_OMIT; } } } void EUTRAN__GPRSMeasParamsDescOpt_template::copy_value(const EUTRAN__GPRSMeasParamsDescOpt& other_value) { single_value = new single_value_struct; if (other_value.presence().is_bound()) { single_value->field_presence = other_value.presence(); } else { single_value->field_presence.clean_up(); } if (other_value.desc().is_bound()) { if (other_value.desc().ispresent()) single_value->field_desc = other_value.desc()(); else single_value->field_desc = OMIT_VALUE; } else { single_value->field_desc.clean_up(); } set_selection(SPECIFIC_VALUE); } void EUTRAN__GPRSMeasParamsDescOpt_template::copy_template(const EUTRAN__GPRSMeasParamsDescOpt_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.presence().get_selection()) { single_value->field_presence = other_value.presence(); } else { single_value->field_presence.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.desc().get_selection()) { single_value->field_desc = other_value.desc(); } else { single_value->field_desc.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 EUTRAN__GPRSMeasParamsDescOpt_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 EUTRAN__GPRSMeasParamsDescOpt_template(*other_value.implication_.precondition); implication_.implied_template = new EUTRAN__GPRSMeasParamsDescOpt_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of type @GSM_RestOctets.EUTRAN_GPRSMeasParamsDescOpt."); break; } set_selection(other_value); } EUTRAN__GPRSMeasParamsDescOpt_template::EUTRAN__GPRSMeasParamsDescOpt_template() { } EUTRAN__GPRSMeasParamsDescOpt_template::EUTRAN__GPRSMeasParamsDescOpt_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } EUTRAN__GPRSMeasParamsDescOpt_template::EUTRAN__GPRSMeasParamsDescOpt_template(const EUTRAN__GPRSMeasParamsDescOpt& other_value) { copy_value(other_value); } EUTRAN__GPRSMeasParamsDescOpt_template::EUTRAN__GPRSMeasParamsDescOpt_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const EUTRAN__GPRSMeasParamsDescOpt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.EUTRAN_GPRSMeasParamsDescOpt from an unbound optional field."); } } EUTRAN__GPRSMeasParamsDescOpt_template::EUTRAN__GPRSMeasParamsDescOpt_template(EUTRAN__GPRSMeasParamsDescOpt_template* p_precondition, EUTRAN__GPRSMeasParamsDescOpt_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } EUTRAN__GPRSMeasParamsDescOpt_template::EUTRAN__GPRSMeasParamsDescOpt_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; } EUTRAN__GPRSMeasParamsDescOpt_template::EUTRAN__GPRSMeasParamsDescOpt_template(const EUTRAN__GPRSMeasParamsDescOpt_template& other_value) : Base_Template() { copy_template(other_value); } EUTRAN__GPRSMeasParamsDescOpt_template::~EUTRAN__GPRSMeasParamsDescOpt_template() { clean_up(); } EUTRAN__GPRSMeasParamsDescOpt_template& EUTRAN__GPRSMeasParamsDescOpt_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } EUTRAN__GPRSMeasParamsDescOpt_template& EUTRAN__GPRSMeasParamsDescOpt_template::operator=(const EUTRAN__GPRSMeasParamsDescOpt& other_value) { clean_up(); copy_value(other_value); return *this; } EUTRAN__GPRSMeasParamsDescOpt_template& EUTRAN__GPRSMeasParamsDescOpt_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const EUTRAN__GPRSMeasParamsDescOpt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @GSM_RestOctets.EUTRAN_GPRSMeasParamsDescOpt."); } return *this; } EUTRAN__GPRSMeasParamsDescOpt_template& EUTRAN__GPRSMeasParamsDescOpt_template::operator=(const EUTRAN__GPRSMeasParamsDescOpt_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean EUTRAN__GPRSMeasParamsDescOpt_template::match(const EUTRAN__GPRSMeasParamsDescOpt& 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.presence().is_bound()) return FALSE; if(!single_value->field_presence.match(other_value.presence(), legacy))return FALSE; if(!other_value.desc().is_bound()) return FALSE; if((other_value.desc().ispresent() ? !single_value->field_desc.match((const BITSTRING&)other_value.desc(), legacy) : !single_value->field_desc.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 @GSM_RestOctets.EUTRAN_GPRSMeasParamsDescOpt."); } return FALSE; } boolean EUTRAN__GPRSMeasParamsDescOpt_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_presence.is_bound() || (single_value->field_desc.is_omit() || single_value->field_desc.is_bound()); } boolean EUTRAN__GPRSMeasParamsDescOpt_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_presence.is_value() && (single_value->field_desc.is_omit() || single_value->field_desc.is_value()); } void EUTRAN__GPRSMeasParamsDescOpt_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; } EUTRAN__GPRSMeasParamsDescOpt EUTRAN__GPRSMeasParamsDescOpt_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @GSM_RestOctets.EUTRAN_GPRSMeasParamsDescOpt."); EUTRAN__GPRSMeasParamsDescOpt ret_val; if (single_value->field_presence.is_bound()) { ret_val.presence() = single_value->field_presence.valueof(); } if (single_value->field_desc.is_omit()) ret_val.desc() = OMIT_VALUE; else if (single_value->field_desc.is_bound()) { ret_val.desc() = single_value->field_desc.valueof(); } return ret_val; } void EUTRAN__GPRSMeasParamsDescOpt_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list for a template of type @GSM_RestOctets.EUTRAN_GPRSMeasParamsDescOpt."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new EUTRAN__GPRSMeasParamsDescOpt_template[list_length]; } EUTRAN__GPRSMeasParamsDescOpt_template& EUTRAN__GPRSMeasParamsDescOpt_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element of a non-list template of type @GSM_RestOctets.EUTRAN_GPRSMeasParamsDescOpt."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.EUTRAN_GPRSMeasParamsDescOpt."); return value_list.list_value[list_index]; } BITSTRING_template& EUTRAN__GPRSMeasParamsDescOpt_template::presence() { set_specific(); return single_value->field_presence; } const BITSTRING_template& EUTRAN__GPRSMeasParamsDescOpt_template::presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field presence of a non-specific template of type @GSM_RestOctets.EUTRAN_GPRSMeasParamsDescOpt."); return single_value->field_presence; } BITSTRING_template& EUTRAN__GPRSMeasParamsDescOpt_template::desc() { set_specific(); return single_value->field_desc; } const BITSTRING_template& EUTRAN__GPRSMeasParamsDescOpt_template::desc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field desc of a non-specific template of type @GSM_RestOctets.EUTRAN_GPRSMeasParamsDescOpt."); return single_value->field_desc; } int EUTRAN__GPRSMeasParamsDescOpt_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_GPRSMeasParamsDescOpt which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 1; if (single_value->field_desc.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 @GSM_RestOctets.EUTRAN_GPRSMeasParamsDescOpt containing an empty list."); int item_size = value_list.list_value[0].size_of(); for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++) { if (value_list.list_value[l_idx].size_of()!=item_size) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_GPRSMeasParamsDescOpt containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_GPRSMeasParamsDescOpt containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_GPRSMeasParamsDescOpt containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_GPRSMeasParamsDescOpt containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_GPRSMeasParamsDescOpt containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_GPRSMeasParamsDescOpt containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_GPRSMeasParamsDescOpt containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.EUTRAN_GPRSMeasParamsDescOpt."); } return 0; } void EUTRAN__GPRSMeasParamsDescOpt_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ presence := "); single_value->field_presence.log(); TTCN_Logger::log_event_str(", desc := "); single_value->field_desc.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 EUTRAN__GPRSMeasParamsDescOpt_template::log_match(const EUTRAN__GPRSMeasParamsDescOpt& 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_presence.match(match_value.presence(), legacy)){ TTCN_Logger::log_logmatch_info(".presence"); single_value->field_presence.log_match(match_value.presence(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.desc().ispresent()){ if(!single_value->field_desc.match(match_value.desc(), legacy)){ TTCN_Logger::log_logmatch_info(".desc"); single_value->field_desc.log_match(match_value.desc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_desc.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".desc := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_desc.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("{ presence := "); single_value->field_presence.log_match(match_value.presence(), legacy); TTCN_Logger::log_event_str(", desc := "); if (match_value.desc().ispresent()) { single_value->field_desc.log_match(match_value.desc(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_desc.log(); if (single_value->field_desc.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 EUTRAN__GPRSMeasParamsDescOpt_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (presence().is_bound()) presence().set_implicit_omit(); if (!desc().is_bound()) desc() = OMIT_VALUE; else desc().set_implicit_omit(); } void EUTRAN__GPRSMeasParamsDescOpt_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_presence.encode_text(text_buf); single_value->field_desc.encode_text(text_buf); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @GSM_RestOctets.EUTRAN_GPRSMeasParamsDescOpt."); } } void EUTRAN__GPRSMeasParamsDescOpt_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_presence.decode_text(text_buf); single_value->field_desc.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 EUTRAN__GPRSMeasParamsDescOpt_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @GSM_RestOctets.EUTRAN_GPRSMeasParamsDescOpt."); } } void EUTRAN__GPRSMeasParamsDescOpt_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: { EUTRAN__GPRSMeasParamsDescOpt_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) presence().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) desc().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(), "presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.EUTRAN_GPRSMeasParamsDescOpt: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { EUTRAN__GPRSMeasParamsDescOpt_template* precondition = new EUTRAN__GPRSMeasParamsDescOpt_template; precondition->set_param(*param.get_elem(0)); EUTRAN__GPRSMeasParamsDescOpt_template* implied_template = new EUTRAN__GPRSMeasParamsDescOpt_template; implied_template->set_param(*param.get_elem(1)); *this = EUTRAN__GPRSMeasParamsDescOpt_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.EUTRAN_GPRSMeasParamsDescOpt"); } is_ifpresent = param.get_ifpresent(); } void EUTRAN__GPRSMeasParamsDescOpt_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_presence.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.EUTRAN_GPRSMeasParamsDescOpt"); single_value->field_desc.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.EUTRAN_GPRSMeasParamsDescOpt"); return; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@GSM_RestOctets.EUTRAN_GPRSMeasParamsDescOpt"); } boolean EUTRAN__GPRSMeasParamsDescOpt_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean EUTRAN__GPRSMeasParamsDescOpt_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_repeated__neigh__cells, const BITSTRING& par_repeated__neigh__cells__term, const OPTIONAL< EUTRAN__RepeatedNotAllowedCells >& par_repeated__not__allowed__cells, const BITSTRING& par_repeated__not__allowed__cells__term, const OPTIONAL< EUTRAN__PCID2TAMaps >& par_pcid2ta__map__list, const BITSTRING& par_pcid2ta__map__list__term) : field_ccn__active(par_ccn__active), field_e__start(par_e__start), field_e__stop(par_e__stop), field_meas__params__desc(par_meas__params__desc), field_gprs__meas__params__desc(par_gprs__meas__params__desc), field_repeated__neigh__cells(par_repeated__neigh__cells), field_repeated__neigh__cells__term(par_repeated__neigh__cells__term), field_repeated__not__allowed__cells(par_repeated__not__allowed__cells), field_repeated__not__allowed__cells__term(par_repeated__not__allowed__cells__term), field_pcid2ta__map__list(par_pcid2ta__map__list), field_pcid2ta__map__list__term(par_pcid2ta__map__list__term) { } EUTRAN__ParamsDesc::EUTRAN__ParamsDesc(const EUTRAN__ParamsDesc& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.EUTRAN_ParamsDesc."); if (other_value.ccn__active().is_bound()) field_ccn__active = other_value.ccn__active(); else field_ccn__active.clean_up(); if (other_value.e__start().is_bound()) field_e__start = other_value.e__start(); else field_e__start.clean_up(); if (other_value.e__stop().is_bound()) field_e__stop = other_value.e__stop(); else field_e__stop.clean_up(); if (other_value.meas__params__desc().is_bound()) field_meas__params__desc = other_value.meas__params__desc(); else field_meas__params__desc.clean_up(); if (other_value.gprs__meas__params__desc().is_bound()) field_gprs__meas__params__desc = other_value.gprs__meas__params__desc(); else field_gprs__meas__params__desc.clean_up(); if (other_value.repeated__neigh__cells().is_bound()) field_repeated__neigh__cells = other_value.repeated__neigh__cells(); else field_repeated__neigh__cells.clean_up(); if (other_value.repeated__neigh__cells__term().is_bound()) field_repeated__neigh__cells__term = other_value.repeated__neigh__cells__term(); else field_repeated__neigh__cells__term.clean_up(); if (other_value.repeated__not__allowed__cells().is_bound()) field_repeated__not__allowed__cells = other_value.repeated__not__allowed__cells(); else field_repeated__not__allowed__cells.clean_up(); if (other_value.repeated__not__allowed__cells__term().is_bound()) field_repeated__not__allowed__cells__term = other_value.repeated__not__allowed__cells__term(); else field_repeated__not__allowed__cells__term.clean_up(); if (other_value.pcid2ta__map__list().is_bound()) field_pcid2ta__map__list = other_value.pcid2ta__map__list(); else field_pcid2ta__map__list.clean_up(); if (other_value.pcid2ta__map__list__term().is_bound()) field_pcid2ta__map__list__term = other_value.pcid2ta__map__list__term(); else field_pcid2ta__map__list__term.clean_up(); } void EUTRAN__ParamsDesc::clean_up() { field_ccn__active.clean_up(); field_e__start.clean_up(); field_e__stop.clean_up(); field_meas__params__desc.clean_up(); field_gprs__meas__params__desc.clean_up(); field_repeated__neigh__cells.clean_up(); field_repeated__neigh__cells__term.clean_up(); field_repeated__not__allowed__cells.clean_up(); field_repeated__not__allowed__cells__term.clean_up(); field_pcid2ta__map__list.clean_up(); field_pcid2ta__map__list__term.clean_up(); } const TTCN_Typedescriptor_t* EUTRAN__ParamsDesc::get_descriptor() const { return &EUTRAN__ParamsDesc_descr_; } EUTRAN__ParamsDesc& EUTRAN__ParamsDesc::operator=(const EUTRAN__ParamsDesc& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.EUTRAN_ParamsDesc."); if (other_value.ccn__active().is_bound()) field_ccn__active = other_value.ccn__active(); else field_ccn__active.clean_up(); if (other_value.e__start().is_bound()) field_e__start = other_value.e__start(); else field_e__start.clean_up(); if (other_value.e__stop().is_bound()) field_e__stop = other_value.e__stop(); else field_e__stop.clean_up(); if (other_value.meas__params__desc().is_bound()) field_meas__params__desc = other_value.meas__params__desc(); else field_meas__params__desc.clean_up(); if (other_value.gprs__meas__params__desc().is_bound()) field_gprs__meas__params__desc = other_value.gprs__meas__params__desc(); else field_gprs__meas__params__desc.clean_up(); if (other_value.repeated__neigh__cells().is_bound()) field_repeated__neigh__cells = other_value.repeated__neigh__cells(); else field_repeated__neigh__cells.clean_up(); if (other_value.repeated__neigh__cells__term().is_bound()) field_repeated__neigh__cells__term = other_value.repeated__neigh__cells__term(); else field_repeated__neigh__cells__term.clean_up(); if (other_value.repeated__not__allowed__cells().is_bound()) field_repeated__not__allowed__cells = other_value.repeated__not__allowed__cells(); else field_repeated__not__allowed__cells.clean_up(); if (other_value.repeated__not__allowed__cells__term().is_bound()) field_repeated__not__allowed__cells__term = other_value.repeated__not__allowed__cells__term(); else field_repeated__not__allowed__cells__term.clean_up(); if (other_value.pcid2ta__map__list().is_bound()) field_pcid2ta__map__list = other_value.pcid2ta__map__list(); else field_pcid2ta__map__list.clean_up(); if (other_value.pcid2ta__map__list__term().is_bound()) field_pcid2ta__map__list__term = other_value.pcid2ta__map__list__term(); else field_pcid2ta__map__list__term.clean_up(); } return *this; } boolean EUTRAN__ParamsDesc::operator==(const EUTRAN__ParamsDesc& other_value) const { return field_ccn__active==other_value.field_ccn__active && field_e__start==other_value.field_e__start && field_e__stop==other_value.field_e__stop && field_meas__params__desc==other_value.field_meas__params__desc && field_gprs__meas__params__desc==other_value.field_gprs__meas__params__desc && field_repeated__neigh__cells==other_value.field_repeated__neigh__cells && field_repeated__neigh__cells__term==other_value.field_repeated__neigh__cells__term && field_repeated__not__allowed__cells==other_value.field_repeated__not__allowed__cells && field_repeated__not__allowed__cells__term==other_value.field_repeated__not__allowed__cells__term && field_pcid2ta__map__list==other_value.field_pcid2ta__map__list && field_pcid2ta__map__list__term==other_value.field_pcid2ta__map__list__term; } boolean EUTRAN__ParamsDesc::is_bound() const { return (field_ccn__active.is_bound()) || (field_e__start.is_bound()) || (field_e__stop.is_bound()) || (field_meas__params__desc.is_bound()) || (field_gprs__meas__params__desc.is_bound()) || (OPTIONAL_OMIT == field_repeated__neigh__cells.get_selection() || field_repeated__neigh__cells.is_bound()) || (field_repeated__neigh__cells__term.is_bound()) || (OPTIONAL_OMIT == field_repeated__not__allowed__cells.get_selection() || field_repeated__not__allowed__cells.is_bound()) || (field_repeated__not__allowed__cells__term.is_bound()) || (OPTIONAL_OMIT == field_pcid2ta__map__list.get_selection() || field_pcid2ta__map__list.is_bound()) || (field_pcid2ta__map__list__term.is_bound()); } boolean EUTRAN__ParamsDesc::is_value() const { return field_ccn__active.is_value() && field_e__start.is_value() && field_e__stop.is_value() && field_meas__params__desc.is_value() && field_gprs__meas__params__desc.is_value() && (OPTIONAL_OMIT == field_repeated__neigh__cells.get_selection() || field_repeated__neigh__cells.is_value()) && field_repeated__neigh__cells__term.is_value() && (OPTIONAL_OMIT == field_repeated__not__allowed__cells.get_selection() || field_repeated__not__allowed__cells.is_value()) && field_repeated__not__allowed__cells__term.is_value() && (OPTIONAL_OMIT == field_pcid2ta__map__list.get_selection() || field_pcid2ta__map__list.is_value()) && field_pcid2ta__map__list__term.is_value(); } int EUTRAN__ParamsDesc::size_of() const { int ret_val = 8; if (field_repeated__neigh__cells.ispresent()) ret_val++; if (field_repeated__not__allowed__cells.ispresent()) ret_val++; if (field_pcid2ta__map__list.ispresent()) ret_val++; return ret_val; } void EUTRAN__ParamsDesc::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ ccn_active := "); field_ccn__active.log(); TTCN_Logger::log_event_str(", e_start := "); field_e__start.log(); TTCN_Logger::log_event_str(", e_stop := "); field_e__stop.log(); TTCN_Logger::log_event_str(", meas_params_desc := "); field_meas__params__desc.log(); TTCN_Logger::log_event_str(", gprs_meas_params_desc := "); field_gprs__meas__params__desc.log(); TTCN_Logger::log_event_str(", repeated_neigh_cells := "); field_repeated__neigh__cells.log(); TTCN_Logger::log_event_str(", repeated_neigh_cells_term := "); field_repeated__neigh__cells__term.log(); TTCN_Logger::log_event_str(", repeated_not_allowed_cells := "); field_repeated__not__allowed__cells.log(); TTCN_Logger::log_event_str(", repeated_not_allowed_cells_term := "); field_repeated__not__allowed__cells__term.log(); TTCN_Logger::log_event_str(", pcid2ta_map_list := "); field_pcid2ta__map__list.log(); TTCN_Logger::log_event_str(", pcid2ta_map_list_term := "); field_pcid2ta__map__list__term.log(); TTCN_Logger::log_event_str(" }"); } void EUTRAN__ParamsDesc::set_implicit_omit() { if (ccn__active().is_bound()) ccn__active().set_implicit_omit(); if (e__start().is_bound()) e__start().set_implicit_omit(); if (e__stop().is_bound()) e__stop().set_implicit_omit(); if (meas__params__desc().is_bound()) meas__params__desc().set_implicit_omit(); if (gprs__meas__params__desc().is_bound()) gprs__meas__params__desc().set_implicit_omit(); if (!repeated__neigh__cells().is_bound()) repeated__neigh__cells() = OMIT_VALUE; else repeated__neigh__cells().set_implicit_omit(); if (repeated__neigh__cells__term().is_bound()) repeated__neigh__cells__term().set_implicit_omit(); if (!repeated__not__allowed__cells().is_bound()) repeated__not__allowed__cells() = OMIT_VALUE; else repeated__not__allowed__cells().set_implicit_omit(); if (repeated__not__allowed__cells__term().is_bound()) repeated__not__allowed__cells__term().set_implicit_omit(); if (!pcid2ta__map__list().is_bound()) pcid2ta__map__list() = OMIT_VALUE; else pcid2ta__map__list().set_implicit_omit(); if (pcid2ta__map__list__term().is_bound()) pcid2ta__map__list__term().set_implicit_omit(); } void EUTRAN__ParamsDesc::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 (110 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) ccn__active().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) e__start().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) e__stop().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) meas__params__desc().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) gprs__meas__params__desc().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) repeated__neigh__cells().set_param(*param.get_elem(5)); if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) repeated__neigh__cells__term().set_param(*param.get_elem(6)); if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) repeated__not__allowed__cells().set_param(*param.get_elem(7)); if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) repeated__not__allowed__cells__term().set_param(*param.get_elem(8)); if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) pcid2ta__map__list().set_param(*param.get_elem(9)); if (param.get_size()>10 && param.get_elem(10)->get_type()!=Module_Param::MP_NotUsed) pcid2ta__map__list__term().set_param(*param.get_elem(10)); 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(), "ccn_active")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ccn__active().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "e_start")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { e__start().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "e_stop")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { e__stop().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "meas_params_desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { meas__params__desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "gprs_meas_params_desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { gprs__meas__params__desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "repeated_neigh_cells")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { repeated__neigh__cells().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "repeated_neigh_cells_term")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { repeated__neigh__cells__term().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "repeated_not_allowed_cells")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { repeated__not__allowed__cells().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "repeated_not_allowed_cells_term")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { repeated__not__allowed__cells__term().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "pcid2ta_map_list")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { pcid2ta__map__list().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "pcid2ta_map_list_term")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { pcid2ta__map__list__term().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.EUTRAN_ParamsDesc: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.EUTRAN_ParamsDesc"); } } void EUTRAN__ParamsDesc::encode_text(Text_Buf& text_buf) const { field_ccn__active.encode_text(text_buf); field_e__start.encode_text(text_buf); field_e__stop.encode_text(text_buf); field_meas__params__desc.encode_text(text_buf); field_gprs__meas__params__desc.encode_text(text_buf); field_repeated__neigh__cells.encode_text(text_buf); field_repeated__neigh__cells__term.encode_text(text_buf); field_repeated__not__allowed__cells.encode_text(text_buf); field_repeated__not__allowed__cells__term.encode_text(text_buf); field_pcid2ta__map__list.encode_text(text_buf); field_pcid2ta__map__list__term.encode_text(text_buf); } void EUTRAN__ParamsDesc::decode_text(Text_Buf& text_buf) { field_ccn__active.decode_text(text_buf); field_e__start.decode_text(text_buf); field_e__stop.decode_text(text_buf); field_meas__params__desc.decode_text(text_buf); field_gprs__meas__params__desc.decode_text(text_buf); field_repeated__neigh__cells.decode_text(text_buf); field_repeated__neigh__cells__term.decode_text(text_buf); field_repeated__not__allowed__cells.decode_text(text_buf); field_repeated__not__allowed__cells__term.decode_text(text_buf); field_pcid2ta__map__list.decode_text(text_buf); field_pcid2ta__map__list__term.decode_text(text_buf); } void EUTRAN__ParamsDesc::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name); if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); PER_encode(p_td, p_buf, opt); break; } default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void EUTRAN__ParamsDesc::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name); if(!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); try { PER_decode(p_td, p_buf, opt); p_buf.PER_octet_align(FALSE); } catch (PER_Buffer_Exception) { } break; } default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int EUTRAN__ParamsDesc::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, EUTRAN__ParamsDesc_ccn__active_descr_.raw->forceomit); decoded_field_length = field_ccn__active.RAW_decode(EUTRAN__ParamsDesc_ccn__active_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, EUTRAN__ParamsDesc_e__start_descr_.raw->forceomit); decoded_field_length = field_e__start.RAW_decode(EUTRAN__ParamsDesc_e__start_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, EUTRAN__ParamsDesc_e__stop_descr_.raw->forceomit); decoded_field_length = field_e__stop.RAW_decode(EUTRAN__ParamsDesc_e__stop_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, EUTRAN__ParamsDesc_meas__params__desc_descr_.raw->forceomit); decoded_field_length = field_meas__params__desc.RAW_decode(EUTRAN__ParamsDesc_meas__params__desc_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, EUTRAN__ParamsDesc_gprs__meas__params__desc_descr_.raw->forceomit); decoded_field_length = field_gprs__meas__params__desc.RAW_decode(EUTRAN__ParamsDesc_gprs__meas__params__desc_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()); if (limit > 0){ if (force_omit != NULL && (*force_omit)(5)) { field_repeated__neigh__cells = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_5_force_omit(5, force_omit, EUTRAN__ParamsDesc_repeated__neigh__cells_descr_.raw->forceomit); decoded_field_length = field_repeated__neigh__cells().RAW_decode(EUTRAN__ParamsDesc_repeated__neigh__cells_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_5_force_omit); if (decoded_field_length < 1) { field_repeated__neigh__cells = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } else field_repeated__neigh__cells=OMIT_VALUE; RAW_Force_Omit field_6_force_omit(6, force_omit, EUTRAN__ParamsDesc_repeated__neigh__cells__term_descr_.raw->forceomit); decoded_field_length = field_repeated__neigh__cells__term.RAW_decode(EUTRAN__ParamsDesc_repeated__neigh__cells__term_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()); if (limit > 0){ if (force_omit != NULL && (*force_omit)(7)) { field_repeated__not__allowed__cells = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_7_force_omit(7, force_omit, EUTRAN__ParamsDesc_repeated__not__allowed__cells_descr_.raw->forceomit); decoded_field_length = field_repeated__not__allowed__cells().RAW_decode(EUTRAN__ParamsDesc_repeated__not__allowed__cells_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_7_force_omit); if (decoded_field_length < 1) { field_repeated__not__allowed__cells = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } else field_repeated__not__allowed__cells=OMIT_VALUE; RAW_Force_Omit field_8_force_omit(8, force_omit, EUTRAN__ParamsDesc_repeated__not__allowed__cells__term_descr_.raw->forceomit); decoded_field_length = field_repeated__not__allowed__cells__term.RAW_decode(EUTRAN__ParamsDesc_repeated__not__allowed__cells__term_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()); if (limit > 0){ if (force_omit != NULL && (*force_omit)(9)) { field_pcid2ta__map__list = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_9_force_omit(9, force_omit, EUTRAN__ParamsDesc_pcid2ta__map__list_descr_.raw->forceomit); decoded_field_length = field_pcid2ta__map__list().RAW_decode(EUTRAN__ParamsDesc_pcid2ta__map__list_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_9_force_omit); if (decoded_field_length < 1) { field_pcid2ta__map__list = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } else field_pcid2ta__map__list=OMIT_VALUE; RAW_Force_Omit field_10_force_omit(10, force_omit, EUTRAN__ParamsDesc_pcid2ta__map__list__term_descr_.raw->forceomit); decoded_field_length = field_pcid2ta__map__list__term.RAW_decode(EUTRAN__ParamsDesc_pcid2ta__map__list__term_descr_, p_buf, limit, 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()); p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int EUTRAN__ParamsDesc::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 = 11; myleaf.body.node.nodes = init_nodes_of_enc_tree(11); myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, EUTRAN__ParamsDesc_ccn__active_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, EUTRAN__ParamsDesc_e__start_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, EUTRAN__ParamsDesc_e__stop_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, EUTRAN__ParamsDesc_meas__params__desc_descr_.raw); myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, EUTRAN__ParamsDesc_gprs__meas__params__desc_descr_.raw); if (field_repeated__neigh__cells.ispresent()) { myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, EUTRAN__ParamsDesc_repeated__neigh__cells_descr_.raw); } else myleaf.body.node.nodes[5] = NULL; myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, EUTRAN__ParamsDesc_repeated__neigh__cells__term_descr_.raw); if (field_repeated__not__allowed__cells.ispresent()) { myleaf.body.node.nodes[7] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 7, EUTRAN__ParamsDesc_repeated__not__allowed__cells_descr_.raw); } else myleaf.body.node.nodes[7] = NULL; myleaf.body.node.nodes[8] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 8, EUTRAN__ParamsDesc_repeated__not__allowed__cells__term_descr_.raw); if (field_pcid2ta__map__list.ispresent()) { myleaf.body.node.nodes[9] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 9, EUTRAN__ParamsDesc_pcid2ta__map__list_descr_.raw); } else myleaf.body.node.nodes[9] = NULL; myleaf.body.node.nodes[10] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 10, EUTRAN__ParamsDesc_pcid2ta__map__list__term_descr_.raw); encoded_length += field_ccn__active.RAW_encode(EUTRAN__ParamsDesc_ccn__active_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_e__start.RAW_encode(EUTRAN__ParamsDesc_e__start_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_e__stop.RAW_encode(EUTRAN__ParamsDesc_e__stop_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_meas__params__desc.RAW_encode(EUTRAN__ParamsDesc_meas__params__desc_descr_, *myleaf.body.node.nodes[3]); encoded_length += field_gprs__meas__params__desc.RAW_encode(EUTRAN__ParamsDesc_gprs__meas__params__desc_descr_, *myleaf.body.node.nodes[4]); if (field_repeated__neigh__cells.ispresent()) { encoded_length += field_repeated__neigh__cells().RAW_encode(EUTRAN__ParamsDesc_repeated__neigh__cells_descr_, *myleaf.body.node.nodes[5]); } encoded_length += field_repeated__neigh__cells__term.RAW_encode(EUTRAN__ParamsDesc_repeated__neigh__cells__term_descr_, *myleaf.body.node.nodes[6]); if (field_repeated__not__allowed__cells.ispresent()) { encoded_length += field_repeated__not__allowed__cells().RAW_encode(EUTRAN__ParamsDesc_repeated__not__allowed__cells_descr_, *myleaf.body.node.nodes[7]); } encoded_length += field_repeated__not__allowed__cells__term.RAW_encode(EUTRAN__ParamsDesc_repeated__not__allowed__cells__term_descr_, *myleaf.body.node.nodes[8]); if (field_pcid2ta__map__list.ispresent()) { encoded_length += field_pcid2ta__map__list().RAW_encode(EUTRAN__ParamsDesc_pcid2ta__map__list_descr_, *myleaf.body.node.nodes[9]); } encoded_length += field_pcid2ta__map__list__term.RAW_encode(EUTRAN__ParamsDesc_pcid2ta__map__list__term_descr_, *myleaf.body.node.nodes[10]); return myleaf.length = encoded_length; } struct EUTRAN__ParamsDesc_template::single_value_struct { BITSTRING_template field_ccn__active; BITSTRING_template field_e__start; BITSTRING_template field_e__stop; EUTRAN__MeasParamsDescOpt_template field_meas__params__desc; EUTRAN__GPRSMeasParamsDescOpt_template field_gprs__meas__params__desc; EUTRAN__RepeatedNeighbourCells_template field_repeated__neigh__cells; BITSTRING_template field_repeated__neigh__cells__term; EUTRAN__RepeatedNotAllowedCells_template field_repeated__not__allowed__cells; BITSTRING_template field_repeated__not__allowed__cells__term; EUTRAN__PCID2TAMaps_template field_pcid2ta__map__list; BITSTRING_template field_pcid2ta__map__list__term; }; void EUTRAN__ParamsDesc_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_ccn__active = ANY_VALUE; single_value->field_e__start = ANY_VALUE; single_value->field_e__stop = ANY_VALUE; single_value->field_meas__params__desc = ANY_VALUE; single_value->field_gprs__meas__params__desc = ANY_VALUE; single_value->field_repeated__neigh__cells = ANY_OR_OMIT; single_value->field_repeated__neigh__cells__term = ANY_VALUE; single_value->field_repeated__not__allowed__cells = ANY_OR_OMIT; single_value->field_repeated__not__allowed__cells__term = ANY_VALUE; single_value->field_pcid2ta__map__list = ANY_OR_OMIT; single_value->field_pcid2ta__map__list__term = ANY_VALUE; } } } void EUTRAN__ParamsDesc_template::copy_value(const EUTRAN__ParamsDesc& other_value) { single_value = new single_value_struct; if (other_value.ccn__active().is_bound()) { single_value->field_ccn__active = other_value.ccn__active(); } else { single_value->field_ccn__active.clean_up(); } if (other_value.e__start().is_bound()) { single_value->field_e__start = other_value.e__start(); } else { single_value->field_e__start.clean_up(); } if (other_value.e__stop().is_bound()) { single_value->field_e__stop = other_value.e__stop(); } else { single_value->field_e__stop.clean_up(); } if (other_value.meas__params__desc().is_bound()) { single_value->field_meas__params__desc = other_value.meas__params__desc(); } else { single_value->field_meas__params__desc.clean_up(); } if (other_value.gprs__meas__params__desc().is_bound()) { single_value->field_gprs__meas__params__desc = other_value.gprs__meas__params__desc(); } else { single_value->field_gprs__meas__params__desc.clean_up(); } if (other_value.repeated__neigh__cells().is_bound()) { if (other_value.repeated__neigh__cells().ispresent()) single_value->field_repeated__neigh__cells = other_value.repeated__neigh__cells()(); else single_value->field_repeated__neigh__cells = OMIT_VALUE; } else { single_value->field_repeated__neigh__cells.clean_up(); } if (other_value.repeated__neigh__cells__term().is_bound()) { single_value->field_repeated__neigh__cells__term = other_value.repeated__neigh__cells__term(); } else { single_value->field_repeated__neigh__cells__term.clean_up(); } if (other_value.repeated__not__allowed__cells().is_bound()) { if (other_value.repeated__not__allowed__cells().ispresent()) single_value->field_repeated__not__allowed__cells = other_value.repeated__not__allowed__cells()(); else single_value->field_repeated__not__allowed__cells = OMIT_VALUE; } else { single_value->field_repeated__not__allowed__cells.clean_up(); } if (other_value.repeated__not__allowed__cells__term().is_bound()) { single_value->field_repeated__not__allowed__cells__term = other_value.repeated__not__allowed__cells__term(); } else { single_value->field_repeated__not__allowed__cells__term.clean_up(); } if (other_value.pcid2ta__map__list().is_bound()) { if (other_value.pcid2ta__map__list().ispresent()) single_value->field_pcid2ta__map__list = other_value.pcid2ta__map__list()(); else single_value->field_pcid2ta__map__list = OMIT_VALUE; } else { single_value->field_pcid2ta__map__list.clean_up(); } if (other_value.pcid2ta__map__list__term().is_bound()) { single_value->field_pcid2ta__map__list__term = other_value.pcid2ta__map__list__term(); } else { single_value->field_pcid2ta__map__list__term.clean_up(); } set_selection(SPECIFIC_VALUE); } void EUTRAN__ParamsDesc_template::copy_template(const EUTRAN__ParamsDesc_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.ccn__active().get_selection()) { single_value->field_ccn__active = other_value.ccn__active(); } else { single_value->field_ccn__active.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.e__start().get_selection()) { single_value->field_e__start = other_value.e__start(); } else { single_value->field_e__start.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.e__stop().get_selection()) { single_value->field_e__stop = other_value.e__stop(); } else { single_value->field_e__stop.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.meas__params__desc().get_selection()) { single_value->field_meas__params__desc = other_value.meas__params__desc(); } else { single_value->field_meas__params__desc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.gprs__meas__params__desc().get_selection()) { single_value->field_gprs__meas__params__desc = other_value.gprs__meas__params__desc(); } else { single_value->field_gprs__meas__params__desc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.repeated__neigh__cells().get_selection()) { single_value->field_repeated__neigh__cells = other_value.repeated__neigh__cells(); } else { single_value->field_repeated__neigh__cells.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.repeated__neigh__cells__term().get_selection()) { single_value->field_repeated__neigh__cells__term = other_value.repeated__neigh__cells__term(); } else { single_value->field_repeated__neigh__cells__term.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.repeated__not__allowed__cells().get_selection()) { single_value->field_repeated__not__allowed__cells = other_value.repeated__not__allowed__cells(); } else { single_value->field_repeated__not__allowed__cells.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.repeated__not__allowed__cells__term().get_selection()) { single_value->field_repeated__not__allowed__cells__term = other_value.repeated__not__allowed__cells__term(); } else { single_value->field_repeated__not__allowed__cells__term.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.pcid2ta__map__list().get_selection()) { single_value->field_pcid2ta__map__list = other_value.pcid2ta__map__list(); } else { single_value->field_pcid2ta__map__list.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.pcid2ta__map__list__term().get_selection()) { single_value->field_pcid2ta__map__list__term = other_value.pcid2ta__map__list__term(); } else { single_value->field_pcid2ta__map__list__term.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 EUTRAN__ParamsDesc_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 EUTRAN__ParamsDesc_template(*other_value.implication_.precondition); implication_.implied_template = new EUTRAN__ParamsDesc_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of type @GSM_RestOctets.EUTRAN_ParamsDesc."); break; } set_selection(other_value); } EUTRAN__ParamsDesc_template::EUTRAN__ParamsDesc_template() { } EUTRAN__ParamsDesc_template::EUTRAN__ParamsDesc_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } EUTRAN__ParamsDesc_template::EUTRAN__ParamsDesc_template(const EUTRAN__ParamsDesc& other_value) { copy_value(other_value); } EUTRAN__ParamsDesc_template::EUTRAN__ParamsDesc_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const EUTRAN__ParamsDesc&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.EUTRAN_ParamsDesc from an unbound optional field."); } } EUTRAN__ParamsDesc_template::EUTRAN__ParamsDesc_template(EUTRAN__ParamsDesc_template* p_precondition, EUTRAN__ParamsDesc_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } EUTRAN__ParamsDesc_template::EUTRAN__ParamsDesc_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; } EUTRAN__ParamsDesc_template::EUTRAN__ParamsDesc_template(const EUTRAN__ParamsDesc_template& other_value) : Base_Template() { copy_template(other_value); } EUTRAN__ParamsDesc_template::~EUTRAN__ParamsDesc_template() { clean_up(); } EUTRAN__ParamsDesc_template& EUTRAN__ParamsDesc_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } EUTRAN__ParamsDesc_template& EUTRAN__ParamsDesc_template::operator=(const EUTRAN__ParamsDesc& other_value) { clean_up(); copy_value(other_value); return *this; } EUTRAN__ParamsDesc_template& EUTRAN__ParamsDesc_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const EUTRAN__ParamsDesc&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @GSM_RestOctets.EUTRAN_ParamsDesc."); } return *this; } EUTRAN__ParamsDesc_template& EUTRAN__ParamsDesc_template::operator=(const EUTRAN__ParamsDesc_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean EUTRAN__ParamsDesc_template::match(const EUTRAN__ParamsDesc& 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.ccn__active().is_bound()) return FALSE; if(!single_value->field_ccn__active.match(other_value.ccn__active(), legacy))return FALSE; if(!other_value.e__start().is_bound()) return FALSE; if(!single_value->field_e__start.match(other_value.e__start(), legacy))return FALSE; if(!other_value.e__stop().is_bound()) return FALSE; if(!single_value->field_e__stop.match(other_value.e__stop(), legacy))return FALSE; if(!other_value.meas__params__desc().is_bound()) return FALSE; if(!single_value->field_meas__params__desc.match(other_value.meas__params__desc(), legacy))return FALSE; if(!other_value.gprs__meas__params__desc().is_bound()) return FALSE; if(!single_value->field_gprs__meas__params__desc.match(other_value.gprs__meas__params__desc(), legacy))return FALSE; if(!other_value.repeated__neigh__cells().is_bound()) return FALSE; if((other_value.repeated__neigh__cells().ispresent() ? !single_value->field_repeated__neigh__cells.match((const EUTRAN__RepeatedNeighbourCells&)other_value.repeated__neigh__cells(), legacy) : !single_value->field_repeated__neigh__cells.match_omit(legacy)))return FALSE; if(!other_value.repeated__neigh__cells__term().is_bound()) return FALSE; if(!single_value->field_repeated__neigh__cells__term.match(other_value.repeated__neigh__cells__term(), legacy))return FALSE; if(!other_value.repeated__not__allowed__cells().is_bound()) return FALSE; if((other_value.repeated__not__allowed__cells().ispresent() ? !single_value->field_repeated__not__allowed__cells.match((const EUTRAN__RepeatedNotAllowedCells&)other_value.repeated__not__allowed__cells(), legacy) : !single_value->field_repeated__not__allowed__cells.match_omit(legacy)))return FALSE; if(!other_value.repeated__not__allowed__cells__term().is_bound()) return FALSE; if(!single_value->field_repeated__not__allowed__cells__term.match(other_value.repeated__not__allowed__cells__term(), legacy))return FALSE; if(!other_value.pcid2ta__map__list().is_bound()) return FALSE; if((other_value.pcid2ta__map__list().ispresent() ? !single_value->field_pcid2ta__map__list.match((const EUTRAN__PCID2TAMaps&)other_value.pcid2ta__map__list(), legacy) : !single_value->field_pcid2ta__map__list.match_omit(legacy)))return FALSE; if(!other_value.pcid2ta__map__list__term().is_bound()) return FALSE; if(!single_value->field_pcid2ta__map__list__term.match(other_value.pcid2ta__map__list__term(), legacy))return FALSE; return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of type @GSM_RestOctets.EUTRAN_ParamsDesc."); } return FALSE; } boolean EUTRAN__ParamsDesc_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_ccn__active.is_bound() || single_value->field_e__start.is_bound() || single_value->field_e__stop.is_bound() || single_value->field_meas__params__desc.is_bound() || single_value->field_gprs__meas__params__desc.is_bound() || (single_value->field_repeated__neigh__cells.is_omit() || single_value->field_repeated__neigh__cells.is_bound()) || single_value->field_repeated__neigh__cells__term.is_bound() || (single_value->field_repeated__not__allowed__cells.is_omit() || single_value->field_repeated__not__allowed__cells.is_bound()) || single_value->field_repeated__not__allowed__cells__term.is_bound() || (single_value->field_pcid2ta__map__list.is_omit() || single_value->field_pcid2ta__map__list.is_bound()) || single_value->field_pcid2ta__map__list__term.is_bound(); } boolean EUTRAN__ParamsDesc_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_ccn__active.is_value() && single_value->field_e__start.is_value() && single_value->field_e__stop.is_value() && single_value->field_meas__params__desc.is_value() && single_value->field_gprs__meas__params__desc.is_value() && (single_value->field_repeated__neigh__cells.is_omit() || single_value->field_repeated__neigh__cells.is_value()) && single_value->field_repeated__neigh__cells__term.is_value() && (single_value->field_repeated__not__allowed__cells.is_omit() || single_value->field_repeated__not__allowed__cells.is_value()) && single_value->field_repeated__not__allowed__cells__term.is_value() && (single_value->field_pcid2ta__map__list.is_omit() || single_value->field_pcid2ta__map__list.is_value()) && single_value->field_pcid2ta__map__list__term.is_value(); } void EUTRAN__ParamsDesc_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; } EUTRAN__ParamsDesc EUTRAN__ParamsDesc_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @GSM_RestOctets.EUTRAN_ParamsDesc."); EUTRAN__ParamsDesc ret_val; if (single_value->field_ccn__active.is_bound()) { ret_val.ccn__active() = single_value->field_ccn__active.valueof(); } if (single_value->field_e__start.is_bound()) { ret_val.e__start() = single_value->field_e__start.valueof(); } if (single_value->field_e__stop.is_bound()) { ret_val.e__stop() = single_value->field_e__stop.valueof(); } if (single_value->field_meas__params__desc.is_bound()) { ret_val.meas__params__desc() = single_value->field_meas__params__desc.valueof(); } if (single_value->field_gprs__meas__params__desc.is_bound()) { ret_val.gprs__meas__params__desc() = single_value->field_gprs__meas__params__desc.valueof(); } if (single_value->field_repeated__neigh__cells.is_omit()) ret_val.repeated__neigh__cells() = OMIT_VALUE; else if (single_value->field_repeated__neigh__cells.is_bound()) { ret_val.repeated__neigh__cells() = single_value->field_repeated__neigh__cells.valueof(); } if (single_value->field_repeated__neigh__cells__term.is_bound()) { ret_val.repeated__neigh__cells__term() = single_value->field_repeated__neigh__cells__term.valueof(); } if (single_value->field_repeated__not__allowed__cells.is_omit()) ret_val.repeated__not__allowed__cells() = OMIT_VALUE; else if (single_value->field_repeated__not__allowed__cells.is_bound()) { ret_val.repeated__not__allowed__cells() = single_value->field_repeated__not__allowed__cells.valueof(); } if (single_value->field_repeated__not__allowed__cells__term.is_bound()) { ret_val.repeated__not__allowed__cells__term() = single_value->field_repeated__not__allowed__cells__term.valueof(); } if (single_value->field_pcid2ta__map__list.is_omit()) ret_val.pcid2ta__map__list() = OMIT_VALUE; else if (single_value->field_pcid2ta__map__list.is_bound()) { ret_val.pcid2ta__map__list() = single_value->field_pcid2ta__map__list.valueof(); } if (single_value->field_pcid2ta__map__list__term.is_bound()) { ret_val.pcid2ta__map__list__term() = single_value->field_pcid2ta__map__list__term.valueof(); } return ret_val; } void EUTRAN__ParamsDesc_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list for a template of type @GSM_RestOctets.EUTRAN_ParamsDesc."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new EUTRAN__ParamsDesc_template[list_length]; } EUTRAN__ParamsDesc_template& EUTRAN__ParamsDesc_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element of a non-list template of type @GSM_RestOctets.EUTRAN_ParamsDesc."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.EUTRAN_ParamsDesc."); return value_list.list_value[list_index]; } BITSTRING_template& EUTRAN__ParamsDesc_template::ccn__active() { set_specific(); return single_value->field_ccn__active; } const BITSTRING_template& EUTRAN__ParamsDesc_template::ccn__active() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ccn_active of a non-specific template of type @GSM_RestOctets.EUTRAN_ParamsDesc."); return single_value->field_ccn__active; } BITSTRING_template& EUTRAN__ParamsDesc_template::e__start() { set_specific(); return single_value->field_e__start; } const BITSTRING_template& EUTRAN__ParamsDesc_template::e__start() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field e_start of a non-specific template of type @GSM_RestOctets.EUTRAN_ParamsDesc."); return single_value->field_e__start; } BITSTRING_template& EUTRAN__ParamsDesc_template::e__stop() { set_specific(); return single_value->field_e__stop; } const BITSTRING_template& EUTRAN__ParamsDesc_template::e__stop() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field e_stop of a non-specific template of type @GSM_RestOctets.EUTRAN_ParamsDesc."); return single_value->field_e__stop; } EUTRAN__MeasParamsDescOpt_template& EUTRAN__ParamsDesc_template::meas__params__desc() { set_specific(); return single_value->field_meas__params__desc; } const EUTRAN__MeasParamsDescOpt_template& EUTRAN__ParamsDesc_template::meas__params__desc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field meas_params_desc of a non-specific template of type @GSM_RestOctets.EUTRAN_ParamsDesc."); return single_value->field_meas__params__desc; } EUTRAN__GPRSMeasParamsDescOpt_template& EUTRAN__ParamsDesc_template::gprs__meas__params__desc() { set_specific(); return single_value->field_gprs__meas__params__desc; } const EUTRAN__GPRSMeasParamsDescOpt_template& EUTRAN__ParamsDesc_template::gprs__meas__params__desc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field gprs_meas_params_desc of a non-specific template of type @GSM_RestOctets.EUTRAN_ParamsDesc."); return single_value->field_gprs__meas__params__desc; } EUTRAN__RepeatedNeighbourCells_template& EUTRAN__ParamsDesc_template::repeated__neigh__cells() { set_specific(); return single_value->field_repeated__neigh__cells; } const EUTRAN__RepeatedNeighbourCells_template& EUTRAN__ParamsDesc_template::repeated__neigh__cells() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field repeated_neigh_cells of a non-specific template of type @GSM_RestOctets.EUTRAN_ParamsDesc."); return single_value->field_repeated__neigh__cells; } BITSTRING_template& EUTRAN__ParamsDesc_template::repeated__neigh__cells__term() { set_specific(); return single_value->field_repeated__neigh__cells__term; } const BITSTRING_template& EUTRAN__ParamsDesc_template::repeated__neigh__cells__term() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field repeated_neigh_cells_term of a non-specific template of type @GSM_RestOctets.EUTRAN_ParamsDesc."); return single_value->field_repeated__neigh__cells__term; } EUTRAN__RepeatedNotAllowedCells_template& EUTRAN__ParamsDesc_template::repeated__not__allowed__cells() { set_specific(); return single_value->field_repeated__not__allowed__cells; } const EUTRAN__RepeatedNotAllowedCells_template& EUTRAN__ParamsDesc_template::repeated__not__allowed__cells() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field repeated_not_allowed_cells of a non-specific template of type @GSM_RestOctets.EUTRAN_ParamsDesc."); return single_value->field_repeated__not__allowed__cells; } BITSTRING_template& EUTRAN__ParamsDesc_template::repeated__not__allowed__cells__term() { set_specific(); return single_value->field_repeated__not__allowed__cells__term; } const BITSTRING_template& EUTRAN__ParamsDesc_template::repeated__not__allowed__cells__term() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field repeated_not_allowed_cells_term of a non-specific template of type @GSM_RestOctets.EUTRAN_ParamsDesc."); return single_value->field_repeated__not__allowed__cells__term; } EUTRAN__PCID2TAMaps_template& EUTRAN__ParamsDesc_template::pcid2ta__map__list() { set_specific(); return single_value->field_pcid2ta__map__list; } const EUTRAN__PCID2TAMaps_template& EUTRAN__ParamsDesc_template::pcid2ta__map__list() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field pcid2ta_map_list of a non-specific template of type @GSM_RestOctets.EUTRAN_ParamsDesc."); return single_value->field_pcid2ta__map__list; } BITSTRING_template& EUTRAN__ParamsDesc_template::pcid2ta__map__list__term() { set_specific(); return single_value->field_pcid2ta__map__list__term; } const BITSTRING_template& EUTRAN__ParamsDesc_template::pcid2ta__map__list__term() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field pcid2ta_map_list_term of a non-specific template of type @GSM_RestOctets.EUTRAN_ParamsDesc."); return single_value->field_pcid2ta__map__list__term; } int EUTRAN__ParamsDesc_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_ParamsDesc which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 8; if (single_value->field_repeated__neigh__cells.is_present()) ret_val++; if (single_value->field_repeated__not__allowed__cells.is_present()) ret_val++; if (single_value->field_pcid2ta__map__list.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 @GSM_RestOctets.EUTRAN_ParamsDesc containing an empty list."); int item_size = value_list.list_value[0].size_of(); for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++) { if (value_list.list_value[l_idx].size_of()!=item_size) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_ParamsDesc containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_ParamsDesc containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_ParamsDesc containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_ParamsDesc containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_ParamsDesc containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_ParamsDesc containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_ParamsDesc containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.EUTRAN_ParamsDesc."); } return 0; } void EUTRAN__ParamsDesc_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ ccn_active := "); single_value->field_ccn__active.log(); TTCN_Logger::log_event_str(", e_start := "); single_value->field_e__start.log(); TTCN_Logger::log_event_str(", e_stop := "); single_value->field_e__stop.log(); TTCN_Logger::log_event_str(", meas_params_desc := "); single_value->field_meas__params__desc.log(); TTCN_Logger::log_event_str(", gprs_meas_params_desc := "); single_value->field_gprs__meas__params__desc.log(); TTCN_Logger::log_event_str(", repeated_neigh_cells := "); single_value->field_repeated__neigh__cells.log(); TTCN_Logger::log_event_str(", repeated_neigh_cells_term := "); single_value->field_repeated__neigh__cells__term.log(); TTCN_Logger::log_event_str(", repeated_not_allowed_cells := "); single_value->field_repeated__not__allowed__cells.log(); TTCN_Logger::log_event_str(", repeated_not_allowed_cells_term := "); single_value->field_repeated__not__allowed__cells__term.log(); TTCN_Logger::log_event_str(", pcid2ta_map_list := "); single_value->field_pcid2ta__map__list.log(); TTCN_Logger::log_event_str(", pcid2ta_map_list_term := "); single_value->field_pcid2ta__map__list__term.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 EUTRAN__ParamsDesc_template::log_match(const EUTRAN__ParamsDesc& 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_ccn__active.match(match_value.ccn__active(), legacy)){ TTCN_Logger::log_logmatch_info(".ccn_active"); single_value->field_ccn__active.log_match(match_value.ccn__active(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_e__start.match(match_value.e__start(), legacy)){ TTCN_Logger::log_logmatch_info(".e_start"); single_value->field_e__start.log_match(match_value.e__start(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_e__stop.match(match_value.e__stop(), legacy)){ TTCN_Logger::log_logmatch_info(".e_stop"); single_value->field_e__stop.log_match(match_value.e__stop(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_meas__params__desc.match(match_value.meas__params__desc(), legacy)){ TTCN_Logger::log_logmatch_info(".meas_params_desc"); single_value->field_meas__params__desc.log_match(match_value.meas__params__desc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_gprs__meas__params__desc.match(match_value.gprs__meas__params__desc(), legacy)){ TTCN_Logger::log_logmatch_info(".gprs_meas_params_desc"); single_value->field_gprs__meas__params__desc.log_match(match_value.gprs__meas__params__desc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.repeated__neigh__cells().ispresent()){ if(!single_value->field_repeated__neigh__cells.match(match_value.repeated__neigh__cells(), legacy)){ TTCN_Logger::log_logmatch_info(".repeated_neigh_cells"); single_value->field_repeated__neigh__cells.log_match(match_value.repeated__neigh__cells(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_repeated__neigh__cells.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".repeated_neigh_cells := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_repeated__neigh__cells.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if(!single_value->field_repeated__neigh__cells__term.match(match_value.repeated__neigh__cells__term(), legacy)){ TTCN_Logger::log_logmatch_info(".repeated_neigh_cells_term"); single_value->field_repeated__neigh__cells__term.log_match(match_value.repeated__neigh__cells__term(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.repeated__not__allowed__cells().ispresent()){ if(!single_value->field_repeated__not__allowed__cells.match(match_value.repeated__not__allowed__cells(), legacy)){ TTCN_Logger::log_logmatch_info(".repeated_not_allowed_cells"); single_value->field_repeated__not__allowed__cells.log_match(match_value.repeated__not__allowed__cells(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_repeated__not__allowed__cells.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".repeated_not_allowed_cells := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_repeated__not__allowed__cells.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if(!single_value->field_repeated__not__allowed__cells__term.match(match_value.repeated__not__allowed__cells__term(), legacy)){ TTCN_Logger::log_logmatch_info(".repeated_not_allowed_cells_term"); single_value->field_repeated__not__allowed__cells__term.log_match(match_value.repeated__not__allowed__cells__term(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.pcid2ta__map__list().ispresent()){ if(!single_value->field_pcid2ta__map__list.match(match_value.pcid2ta__map__list(), legacy)){ TTCN_Logger::log_logmatch_info(".pcid2ta_map_list"); single_value->field_pcid2ta__map__list.log_match(match_value.pcid2ta__map__list(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_pcid2ta__map__list.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".pcid2ta_map_list := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_pcid2ta__map__list.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if(!single_value->field_pcid2ta__map__list__term.match(match_value.pcid2ta__map__list__term(), legacy)){ TTCN_Logger::log_logmatch_info(".pcid2ta_map_list_term"); single_value->field_pcid2ta__map__list__term.log_match(match_value.pcid2ta__map__list__term(), 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("{ ccn_active := "); single_value->field_ccn__active.log_match(match_value.ccn__active(), legacy); TTCN_Logger::log_event_str(", e_start := "); single_value->field_e__start.log_match(match_value.e__start(), legacy); TTCN_Logger::log_event_str(", e_stop := "); single_value->field_e__stop.log_match(match_value.e__stop(), legacy); TTCN_Logger::log_event_str(", meas_params_desc := "); single_value->field_meas__params__desc.log_match(match_value.meas__params__desc(), legacy); TTCN_Logger::log_event_str(", gprs_meas_params_desc := "); single_value->field_gprs__meas__params__desc.log_match(match_value.gprs__meas__params__desc(), legacy); TTCN_Logger::log_event_str(", repeated_neigh_cells := "); if (match_value.repeated__neigh__cells().ispresent()) { single_value->field_repeated__neigh__cells.log_match(match_value.repeated__neigh__cells(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_repeated__neigh__cells.log(); if (single_value->field_repeated__neigh__cells.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", repeated_neigh_cells_term := "); single_value->field_repeated__neigh__cells__term.log_match(match_value.repeated__neigh__cells__term(), legacy); TTCN_Logger::log_event_str(", repeated_not_allowed_cells := "); if (match_value.repeated__not__allowed__cells().ispresent()) { single_value->field_repeated__not__allowed__cells.log_match(match_value.repeated__not__allowed__cells(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_repeated__not__allowed__cells.log(); if (single_value->field_repeated__not__allowed__cells.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", repeated_not_allowed_cells_term := "); single_value->field_repeated__not__allowed__cells__term.log_match(match_value.repeated__not__allowed__cells__term(), legacy); TTCN_Logger::log_event_str(", pcid2ta_map_list := "); if (match_value.pcid2ta__map__list().ispresent()) { single_value->field_pcid2ta__map__list.log_match(match_value.pcid2ta__map__list(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_pcid2ta__map__list.log(); if (single_value->field_pcid2ta__map__list.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", pcid2ta_map_list_term := "); single_value->field_pcid2ta__map__list__term.log_match(match_value.pcid2ta__map__list__term(), 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 EUTRAN__ParamsDesc_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (ccn__active().is_bound()) ccn__active().set_implicit_omit(); if (e__start().is_bound()) e__start().set_implicit_omit(); if (e__stop().is_bound()) e__stop().set_implicit_omit(); if (meas__params__desc().is_bound()) meas__params__desc().set_implicit_omit(); if (gprs__meas__params__desc().is_bound()) gprs__meas__params__desc().set_implicit_omit(); if (!repeated__neigh__cells().is_bound()) repeated__neigh__cells() = OMIT_VALUE; else repeated__neigh__cells().set_implicit_omit(); if (repeated__neigh__cells__term().is_bound()) repeated__neigh__cells__term().set_implicit_omit(); if (!repeated__not__allowed__cells().is_bound()) repeated__not__allowed__cells() = OMIT_VALUE; else repeated__not__allowed__cells().set_implicit_omit(); if (repeated__not__allowed__cells__term().is_bound()) repeated__not__allowed__cells__term().set_implicit_omit(); if (!pcid2ta__map__list().is_bound()) pcid2ta__map__list() = OMIT_VALUE; else pcid2ta__map__list().set_implicit_omit(); if (pcid2ta__map__list__term().is_bound()) pcid2ta__map__list__term().set_implicit_omit(); } void EUTRAN__ParamsDesc_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_ccn__active.encode_text(text_buf); single_value->field_e__start.encode_text(text_buf); single_value->field_e__stop.encode_text(text_buf); single_value->field_meas__params__desc.encode_text(text_buf); single_value->field_gprs__meas__params__desc.encode_text(text_buf); single_value->field_repeated__neigh__cells.encode_text(text_buf); single_value->field_repeated__neigh__cells__term.encode_text(text_buf); single_value->field_repeated__not__allowed__cells.encode_text(text_buf); single_value->field_repeated__not__allowed__cells__term.encode_text(text_buf); single_value->field_pcid2ta__map__list.encode_text(text_buf); single_value->field_pcid2ta__map__list__term.encode_text(text_buf); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @GSM_RestOctets.EUTRAN_ParamsDesc."); } } void EUTRAN__ParamsDesc_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_ccn__active.decode_text(text_buf); single_value->field_e__start.decode_text(text_buf); single_value->field_e__stop.decode_text(text_buf); single_value->field_meas__params__desc.decode_text(text_buf); single_value->field_gprs__meas__params__desc.decode_text(text_buf); single_value->field_repeated__neigh__cells.decode_text(text_buf); single_value->field_repeated__neigh__cells__term.decode_text(text_buf); single_value->field_repeated__not__allowed__cells.decode_text(text_buf); single_value->field_repeated__not__allowed__cells__term.decode_text(text_buf); single_value->field_pcid2ta__map__list.decode_text(text_buf); single_value->field_pcid2ta__map__list__term.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 EUTRAN__ParamsDesc_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @GSM_RestOctets.EUTRAN_ParamsDesc."); } } void EUTRAN__ParamsDesc_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: { EUTRAN__ParamsDesc_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) ccn__active().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) e__start().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) e__stop().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) meas__params__desc().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) gprs__meas__params__desc().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) repeated__neigh__cells().set_param(*param.get_elem(5)); if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) repeated__neigh__cells__term().set_param(*param.get_elem(6)); if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) repeated__not__allowed__cells().set_param(*param.get_elem(7)); if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) repeated__not__allowed__cells__term().set_param(*param.get_elem(8)); if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) pcid2ta__map__list().set_param(*param.get_elem(9)); if (param.get_size()>10 && param.get_elem(10)->get_type()!=Module_Param::MP_NotUsed) pcid2ta__map__list__term().set_param(*param.get_elem(10)); 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(), "ccn_active")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ccn__active().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "e_start")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { e__start().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "e_stop")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { e__stop().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "meas_params_desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { meas__params__desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "gprs_meas_params_desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { gprs__meas__params__desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "repeated_neigh_cells")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { repeated__neigh__cells().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "repeated_neigh_cells_term")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { repeated__neigh__cells__term().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "repeated_not_allowed_cells")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { repeated__not__allowed__cells().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "repeated_not_allowed_cells_term")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { repeated__not__allowed__cells__term().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "pcid2ta_map_list")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { pcid2ta__map__list().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "pcid2ta_map_list_term")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { pcid2ta__map__list__term().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.EUTRAN_ParamsDesc: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { EUTRAN__ParamsDesc_template* precondition = new EUTRAN__ParamsDesc_template; precondition->set_param(*param.get_elem(0)); EUTRAN__ParamsDesc_template* implied_template = new EUTRAN__ParamsDesc_template; implied_template->set_param(*param.get_elem(1)); *this = EUTRAN__ParamsDesc_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.EUTRAN_ParamsDesc"); } is_ifpresent = param.get_ifpresent(); } void EUTRAN__ParamsDesc_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_ccn__active.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.EUTRAN_ParamsDesc"); single_value->field_e__start.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.EUTRAN_ParamsDesc"); single_value->field_e__stop.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.EUTRAN_ParamsDesc"); single_value->field_meas__params__desc.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.EUTRAN_ParamsDesc"); single_value->field_gprs__meas__params__desc.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.EUTRAN_ParamsDesc"); single_value->field_repeated__neigh__cells.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.EUTRAN_ParamsDesc"); single_value->field_repeated__neigh__cells__term.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.EUTRAN_ParamsDesc"); single_value->field_repeated__not__allowed__cells.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.EUTRAN_ParamsDesc"); single_value->field_repeated__not__allowed__cells__term.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.EUTRAN_ParamsDesc"); single_value->field_pcid2ta__map__list.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.EUTRAN_ParamsDesc"); single_value->field_pcid2ta__map__list__term.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.EUTRAN_ParamsDesc"); return; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@GSM_RestOctets.EUTRAN_ParamsDesc"); } boolean EUTRAN__ParamsDesc_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean EUTRAN__ParamsDesc_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; } EUTRAN__RepeatedNeighbourCells::EUTRAN__RepeatedNeighbourCells(const EUTRAN__RepeatedNeighbourCells& other_value) { if (!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells."); val_ptr = other_value.val_ptr; val_ptr->ref_count++; } EUTRAN__RepeatedNeighbourCells::~EUTRAN__RepeatedNeighbourCells() { clean_up(); if (val_ptr != NULL) val_ptr = NULL; } void EUTRAN__RepeatedNeighbourCells::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."); } } EUTRAN__RepeatedNeighbourCells& EUTRAN__RepeatedNeighbourCells::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; } EUTRAN__RepeatedNeighbourCells& EUTRAN__RepeatedNeighbourCells::operator=(const EUTRAN__RepeatedNeighbourCells& other_value) { if (other_value.val_ptr == NULL) TTCN_error("Assigning an unbound value of type @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells."); if (this != &other_value) { clean_up(); val_ptr = other_value.val_ptr; val_ptr->ref_count++; } return *this; } boolean EUTRAN__RepeatedNeighbourCells::operator==(null_type) const { if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells."); return val_ptr->n_elements == 0 ; } boolean EUTRAN__RepeatedNeighbourCells::operator==(const EUTRAN__RepeatedNeighbourCells& other_value) const { if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells."); if (other_value.val_ptr == NULL) TTCN_error("The right operand of comparison is an unbound value of type @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells."); 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; } EUTRAN__NeighbourCells& EUTRAN__RepeatedNeighbourCells::operator[](int index_value) { if (index_value < 0) TTCN_error("Accessing an element of type @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells 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 = (EUTRAN__NeighbourCells**)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 EUTRAN__NeighbourCells(*(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 EUTRAN__NeighbourCells; } return *val_ptr->value_elements[index_value]; } EUTRAN__NeighbourCells& EUTRAN__RepeatedNeighbourCells::operator[](const INTEGER& index_value) { index_value.must_bound("Using an unbound integer value for indexing a value of type @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells."); return (*this)[(int)index_value]; } const EUTRAN__NeighbourCells& EUTRAN__RepeatedNeighbourCells::operator[](int index_value) const { if (val_ptr == NULL) TTCN_error("Accessing an element in an unbound value of type @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells."); if (index_value < 0) TTCN_error("Accessing an element of type @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells using a negative index: %d.", index_value); if (index_value >= val_ptr->n_elements) TTCN_error("Index overflow in a value of type @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells: 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 EUTRAN__NeighbourCells& EUTRAN__RepeatedNeighbourCells::operator[](const INTEGER& index_value) const { index_value.must_bound("Using an unbound integer value for indexing a value of type @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells."); return (*this)[(int)index_value]; } EUTRAN__RepeatedNeighbourCells EUTRAN__RepeatedNeighbourCells::operator<<=(int rotate_count) const { return *this >>= (-rotate_count); } EUTRAN__RepeatedNeighbourCells EUTRAN__RepeatedNeighbourCells::operator<<=(const INTEGER& rotate_count) const { rotate_count.must_bound("Unbound integer operand of rotate left operator."); return *this >>= (int)(-rotate_count); } EUTRAN__RepeatedNeighbourCells EUTRAN__RepeatedNeighbourCells::operator>>=(const INTEGER& rotate_count) const { rotate_count.must_bound("Unbound integer operand of rotate right operator."); return *this >>= (int)rotate_count; } EUTRAN__RepeatedNeighbourCells EUTRAN__RepeatedNeighbourCells::operator>>=(int rotate_count) const { if (val_ptr == NULL) TTCN_error("Performing rotation operation on an unbound value of type @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells."); 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; EUTRAN__RepeatedNeighbourCells 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 EUTRAN__NeighbourCells(*val_ptr->value_elements[i]); } } return ret_val; } EUTRAN__RepeatedNeighbourCells EUTRAN__RepeatedNeighbourCells::operator+(const EUTRAN__RepeatedNeighbourCells& other_value) const { if (val_ptr == NULL || other_value.val_ptr == NULL) TTCN_error("Unbound operand of @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells concatenation."); if (val_ptr->n_elements == 0) return other_value; if (other_value.val_ptr->n_elements == 0) return *this; EUTRAN__RepeatedNeighbourCells 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 EUTRAN__NeighbourCells(*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 EUTRAN__NeighbourCells(*other_value.val_ptr->value_elements[i]); } } return ret_val; } EUTRAN__RepeatedNeighbourCells EUTRAN__RepeatedNeighbourCells::substr(int index, int returncount) const { if (val_ptr == NULL) TTCN_error("The first argument of substr() is an unbound value of type @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells."); check_substr_arguments(val_ptr->n_elements, index, returncount, "@GSM_RestOctets.EUTRAN_RepeatedNeighbourCells","element"); EUTRAN__RepeatedNeighbourCells ret_val; ret_val.set_size(returncount); for (int i=0; ivalue_elements[i+index] != NULL) { ret_val.val_ptr->value_elements[i] = new EUTRAN__NeighbourCells(*val_ptr->value_elements[i+index]); } } return ret_val; } EUTRAN__RepeatedNeighbourCells EUTRAN__RepeatedNeighbourCells::replace(int index, int len, const EUTRAN__RepeatedNeighbourCells& repl) const { if (val_ptr == NULL) TTCN_error("The first argument of replace() is an unbound value of type @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells."); if (repl.val_ptr == NULL) TTCN_error("The fourth argument of replace() is an unbound value of type @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells."); check_replace_arguments(val_ptr->n_elements, index, len, "@GSM_RestOctets.EUTRAN_RepeatedNeighbourCells","element"); EUTRAN__RepeatedNeighbourCells 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 EUTRAN__NeighbourCells(*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 EUTRAN__NeighbourCells(*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 EUTRAN__NeighbourCells(*val_ptr->value_elements[index+i+len]); } } return ret_val; } EUTRAN__RepeatedNeighbourCells EUTRAN__RepeatedNeighbourCells::replace(int index, int len, const EUTRAN__RepeatedNeighbourCells_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 EUTRAN__RepeatedNeighbourCells::set_size(int new_size) { if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a value of type @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells."); 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 = (EUTRAN__NeighbourCells**)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 EUTRAN__NeighbourCells(*(val_ptr->value_elements[elem_count])); } } clean_up(); val_ptr = new_val_ptr; } if (new_size > val_ptr->n_elements) { val_ptr->value_elements = (EUTRAN__NeighbourCells**)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 @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells: %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 = (EUTRAN__NeighbourCells**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size); val_ptr->n_elements = new_size; } } boolean EUTRAN__RepeatedNeighbourCells::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 EUTRAN__RepeatedNeighbourCells::size_of() const { if (val_ptr == NULL) TTCN_error("Performing sizeof operation on an unbound value of type @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells."); return val_ptr->n_elements; } int EUTRAN__RepeatedNeighbourCells::lengthof() const { if (val_ptr == NULL) TTCN_error("Performing lengthof operation on an unbound value of type @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells."); 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 EUTRAN__RepeatedNeighbourCells::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 EUTRAN__RepeatedNeighbourCells::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 EUTRAN__RepeatedNeighbourCells::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", "@GSM_RestOctets.EUTRAN_RepeatedNeighbourCells"); } 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", "@GSM_RestOctets.EUTRAN_RepeatedNeighbourCells"); } break; default: TTCN_error("Internal error: Unknown operation type."); } } void EUTRAN__RepeatedNeighbourCells::encode_text(Text_Buf& text_buf) const { if (val_ptr == NULL) TTCN_error("Text encoder: Encoding an unbound value of type @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells."); 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 EUTRAN__RepeatedNeighbourCells::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 @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells."); val_ptr->value_elements = (EUTRAN__NeighbourCells**)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 EUTRAN__NeighbourCells; val_ptr->value_elements[elem_count]->decode_text(text_buf); } } void EUTRAN__RepeatedNeighbourCells::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name); if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); PER_encode(p_td, p_buf, opt); break; } default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void EUTRAN__RepeatedNeighbourCells::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name); if(!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); try { PER_decode(p_td, p_buf, opt); p_buf.PER_octet_align(FALSE); } catch (PER_Buffer_Exception) { } break; } default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int EUTRAN__RepeatedNeighbourCells::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 EUTRAN__RepeatedNeighbourCells::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 EUTRAN__RepeatedNeighbourCells_template::copy_value(const EUTRAN__RepeatedNeighbourCells& other_value) { if (!other_value.is_bound()) TTCN_error("Initialization of a template of type @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells with an unbound value."); single_value.n_elements = other_value.size_of(); single_value.value_elements = (EUTRAN__NeighbourCells_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 EUTRAN__NeighbourCells_template(other_value[elem_count]); } else { single_value.value_elements[elem_count] = new EUTRAN__NeighbourCells_template; } } set_selection(SPECIFIC_VALUE); } void EUTRAN__RepeatedNeighbourCells_template::copy_template(const EUTRAN__RepeatedNeighbourCells_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 = (EUTRAN__NeighbourCells_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 EUTRAN__NeighbourCells_template(*other_value.single_value.value_elements[elem_count]); } else { single_value.value_elements[elem_count] = new EUTRAN__NeighbourCells_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 EUTRAN__RepeatedNeighbourCells_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 EUTRAN__RepeatedNeighbourCells_template(*other_value.implication_.precondition); implication_.implied_template = new EUTRAN__RepeatedNeighbourCells_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of type @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells."); break; } set_selection(other_value); } boolean EUTRAN__RepeatedNeighbourCells_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 EUTRAN__RepeatedNeighbourCells_template*)template_ptr)->single_value.value_elements[template_index]->match((*(const EUTRAN__RepeatedNeighbourCells*)value_ptr)[value_index], legacy); else return ((const EUTRAN__RepeatedNeighbourCells_template*)template_ptr)->single_value.value_elements[template_index]->is_any_or_omit(); } EUTRAN__RepeatedNeighbourCells_template::EUTRAN__RepeatedNeighbourCells_template() { } EUTRAN__RepeatedNeighbourCells_template::EUTRAN__RepeatedNeighbourCells_template(template_sel other_value) : Base_Record_Of_Template(other_value) { check_single_selection(other_value); } EUTRAN__RepeatedNeighbourCells_template::EUTRAN__RepeatedNeighbourCells_template(null_type) : Base_Record_Of_Template(SPECIFIC_VALUE) { single_value.n_elements = 0; single_value.value_elements = NULL; } EUTRAN__RepeatedNeighbourCells_template::EUTRAN__RepeatedNeighbourCells_template(const EUTRAN__RepeatedNeighbourCells& other_value) { copy_value(other_value); } EUTRAN__RepeatedNeighbourCells_template::EUTRAN__RepeatedNeighbourCells_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const EUTRAN__RepeatedNeighbourCells&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells from an unbound optional field."); } } EUTRAN__RepeatedNeighbourCells_template::EUTRAN__RepeatedNeighbourCells_template(EUTRAN__RepeatedNeighbourCells_template* p_precondition, EUTRAN__RepeatedNeighbourCells_template* p_implied_template) : Base_Record_Of_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } EUTRAN__RepeatedNeighbourCells_template::EUTRAN__RepeatedNeighbourCells_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; } EUTRAN__RepeatedNeighbourCells_template::EUTRAN__RepeatedNeighbourCells_template(const EUTRAN__RepeatedNeighbourCells_template& other_value) : Base_Record_Of_Template() { copy_template(other_value); } EUTRAN__RepeatedNeighbourCells_template::~EUTRAN__RepeatedNeighbourCells_template() { clean_up(); } void EUTRAN__RepeatedNeighbourCells_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; } EUTRAN__RepeatedNeighbourCells_template& EUTRAN__RepeatedNeighbourCells_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } EUTRAN__RepeatedNeighbourCells_template& EUTRAN__RepeatedNeighbourCells_template::operator=(null_type) { clean_up(); set_selection(SPECIFIC_VALUE); single_value.n_elements = 0; single_value.value_elements = NULL; return *this; } EUTRAN__RepeatedNeighbourCells_template& EUTRAN__RepeatedNeighbourCells_template::operator=(const EUTRAN__RepeatedNeighbourCells& other_value) { clean_up(); copy_value(other_value); return *this; } EUTRAN__RepeatedNeighbourCells_template& EUTRAN__RepeatedNeighbourCells_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const EUTRAN__RepeatedNeighbourCells&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells."); } return *this; } EUTRAN__RepeatedNeighbourCells_template& EUTRAN__RepeatedNeighbourCells_template::operator=(const EUTRAN__RepeatedNeighbourCells_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } EUTRAN__NeighbourCells_template& EUTRAN__RepeatedNeighbourCells_template::operator[](int index_value) { if (index_value < 0) TTCN_error("Accessing an element of a template for type @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells 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 @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells."); break; } return *single_value.value_elements[index_value]; } EUTRAN__NeighbourCells_template& EUTRAN__RepeatedNeighbourCells_template::operator[](const INTEGER& index_value) { index_value.must_bound("Using an unbound integer value for indexing a template of type @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells."); return (*this)[(int)index_value]; } const EUTRAN__NeighbourCells_template& EUTRAN__RepeatedNeighbourCells_template::operator[](int index_value) const { if (index_value < 0) TTCN_error("Accessing an element of a template for type @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells using a negative index: %d.", index_value); if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing an element of a non-specific template for type @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells."); if (index_value >= single_value.n_elements) TTCN_error("Index overflow in a template of type @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells: 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 EUTRAN__NeighbourCells_template& EUTRAN__RepeatedNeighbourCells_template::operator[](const INTEGER& index_value) const { index_value.must_bound("Using an unbound integer value for indexing a template of type @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells."); return (*this)[(int)index_value]; } void EUTRAN__RepeatedNeighbourCells_template::set_size(int new_size) { if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a template of type @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells."); 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 = (EUTRAN__NeighbourCells_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 EUTRAN__NeighbourCells_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 EUTRAN__NeighbourCells_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 = (EUTRAN__NeighbourCells_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size); single_value.n_elements = new_size; } } int EUTRAN__RepeatedNeighbourCells_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 EUTRAN__RepeatedNeighbourCells_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 @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells 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 @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells 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 @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells 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 @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells 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 @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells 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 @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells containing complemented list.", op_name); default: TTCN_error("Performing %sof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells.", op_name); } return check_section_is_single(min_size, has_any_or_none, op_name, "a", "template of type @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells"); } boolean EUTRAN__RepeatedNeighbourCells_template::match(const EUTRAN__RepeatedNeighbourCells& 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 @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells."); } return FALSE; } boolean EUTRAN__RepeatedNeighbourCells_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; } EUTRAN__RepeatedNeighbourCells EUTRAN__RepeatedNeighbourCells_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells."); EUTRAN__RepeatedNeighbourCells 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; } EUTRAN__RepeatedNeighbourCells EUTRAN__RepeatedNeighbourCells_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); } EUTRAN__RepeatedNeighbourCells EUTRAN__RepeatedNeighbourCells_template::replace(int index, int len, const EUTRAN__RepeatedNeighbourCells_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()); } EUTRAN__RepeatedNeighbourCells EUTRAN__RepeatedNeighbourCells_template::replace(int index, int len, const EUTRAN__RepeatedNeighbourCells& 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 EUTRAN__RepeatedNeighbourCells_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 EUTRAN__RepeatedNeighbourCells_template[list_length]; break; default: TTCN_error("Internal error: Setting an invalid type for a template of type @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells."); } set_selection(template_type); } EUTRAN__RepeatedNeighbourCells_template& EUTRAN__RepeatedNeighbourCells_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 @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells."); if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of type @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells."); return value_list.list_value[list_index]; } void EUTRAN__RepeatedNeighbourCells_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 EUTRAN__RepeatedNeighbourCells_template::log_match(const EUTRAN__RepeatedNeighbourCells& 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 EUTRAN__RepeatedNeighbourCells_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 @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells."); } } void EUTRAN__RepeatedNeighbourCells_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 @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells."); single_value.value_elements = (EUTRAN__NeighbourCells_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 EUTRAN__NeighbourCells_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 EUTRAN__RepeatedNeighbourCells_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 @GSM_RestOctets.EUTRAN_RepeatedNeighbourCells."); } } boolean EUTRAN__RepeatedNeighbourCells_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean EUTRAN__RepeatedNeighbourCells_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iset_implicit_omit(); } } void EUTRAN__RepeatedNeighbourCells_template::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_TEMPLATE|Module_Param::BC_LIST, "record of template"); switch (param.get_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { EUTRAN__RepeatedNeighbourCells_template temp; temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size()); for (size_t p_i=0; p_iget_id()->get_index())].set_param(*param.get_elem(p_i)); } break; case Module_Param::MP_Value_List: { set_size(param.get_size()); int curr_idx = 0; for (size_t p_i=0; p_iget_type()) { case Module_Param::MP_NotUsed: curr_idx++; break; case Module_Param::MP_Permutation_Template: { int perm_start_idx = curr_idx; Module_Param* param_i = param.get_elem(p_i); for (size_t perm_i=0; perm_iget_size(); perm_i++) { (*this)[curr_idx].set_param(*(param_i->get_elem(perm_i))); curr_idx++; } int perm_end_idx = curr_idx - 1; add_permutation(perm_start_idx, perm_end_idx); } break; default: (*this)[curr_idx].set_param(*param.get_elem(p_i)); curr_idx++; } } } break; case Module_Param::MP_Implication_Template: { EUTRAN__RepeatedNeighbourCells_template* precondition = new EUTRAN__RepeatedNeighbourCells_template; precondition->set_param(*param.get_elem(0)); EUTRAN__RepeatedNeighbourCells_template* implied_template = new EUTRAN__RepeatedNeighbourCells_template; implied_template->set_param(*param.get_elem(1)); *this = EUTRAN__RepeatedNeighbourCells_template(precondition, implied_template); } break; default: param.type_error("record of template", "@GSM_RestOctets.EUTRAN_RepeatedNeighbourCells"); } is_ifpresent = param.get_ifpresent(); set_length_range(param); } void EUTRAN__RepeatedNeighbourCells_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 : "@GSM_RestOctets.EUTRAN_RepeatedNeighbourCells"); return; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@GSM_RestOctets.EUTRAN_RepeatedNeighbourCells"); } boolean EUTRAN__RepeatedNeighbourCells_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); } } EUTRAN__NeighbourCells::EUTRAN__NeighbourCells() { } EUTRAN__NeighbourCells::EUTRAN__NeighbourCells(const BITSTRING& par_item__ind, const OPTIONAL< EUTRAN__CellDescs >& par_cell__desc__list, const BITSTRING& par_cell__desc__list__term, const BITSTRING& par_prio__presence, const OPTIONAL< INTEGER >& par_prio, const INTEGER& par_thresh__high, const BITSTRING& par_thresh__low__presence, const OPTIONAL< INTEGER >& par_thresh__low, const BITSTRING& par_qrxlevmin__presence, const OPTIONAL< INTEGER >& par_qrxlevmin) : field_item__ind(par_item__ind), field_cell__desc__list(par_cell__desc__list), field_cell__desc__list__term(par_cell__desc__list__term), field_prio__presence(par_prio__presence), field_prio(par_prio), field_thresh__high(par_thresh__high), field_thresh__low__presence(par_thresh__low__presence), field_thresh__low(par_thresh__low), field_qrxlevmin__presence(par_qrxlevmin__presence), field_qrxlevmin(par_qrxlevmin) { } EUTRAN__NeighbourCells::EUTRAN__NeighbourCells(const EUTRAN__NeighbourCells& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.EUTRAN_NeighbourCells."); if (other_value.item__ind().is_bound()) field_item__ind = other_value.item__ind(); else field_item__ind.clean_up(); if (other_value.cell__desc__list().is_bound()) field_cell__desc__list = other_value.cell__desc__list(); else field_cell__desc__list.clean_up(); if (other_value.cell__desc__list__term().is_bound()) field_cell__desc__list__term = other_value.cell__desc__list__term(); else field_cell__desc__list__term.clean_up(); if (other_value.prio__presence().is_bound()) field_prio__presence = other_value.prio__presence(); else field_prio__presence.clean_up(); if (other_value.prio().is_bound()) field_prio = other_value.prio(); else field_prio.clean_up(); if (other_value.thresh__high().is_bound()) field_thresh__high = other_value.thresh__high(); else field_thresh__high.clean_up(); if (other_value.thresh__low__presence().is_bound()) field_thresh__low__presence = other_value.thresh__low__presence(); else field_thresh__low__presence.clean_up(); if (other_value.thresh__low().is_bound()) field_thresh__low = other_value.thresh__low(); else field_thresh__low.clean_up(); if (other_value.qrxlevmin__presence().is_bound()) field_qrxlevmin__presence = other_value.qrxlevmin__presence(); else field_qrxlevmin__presence.clean_up(); if (other_value.qrxlevmin().is_bound()) field_qrxlevmin = other_value.qrxlevmin(); else field_qrxlevmin.clean_up(); } void EUTRAN__NeighbourCells::clean_up() { field_item__ind.clean_up(); field_cell__desc__list.clean_up(); field_cell__desc__list__term.clean_up(); field_prio__presence.clean_up(); field_prio.clean_up(); field_thresh__high.clean_up(); field_thresh__low__presence.clean_up(); field_thresh__low.clean_up(); field_qrxlevmin__presence.clean_up(); field_qrxlevmin.clean_up(); } const TTCN_Typedescriptor_t* EUTRAN__NeighbourCells::get_descriptor() const { return &EUTRAN__NeighbourCells_descr_; } EUTRAN__NeighbourCells& EUTRAN__NeighbourCells::operator=(const EUTRAN__NeighbourCells& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.EUTRAN_NeighbourCells."); if (other_value.item__ind().is_bound()) field_item__ind = other_value.item__ind(); else field_item__ind.clean_up(); if (other_value.cell__desc__list().is_bound()) field_cell__desc__list = other_value.cell__desc__list(); else field_cell__desc__list.clean_up(); if (other_value.cell__desc__list__term().is_bound()) field_cell__desc__list__term = other_value.cell__desc__list__term(); else field_cell__desc__list__term.clean_up(); if (other_value.prio__presence().is_bound()) field_prio__presence = other_value.prio__presence(); else field_prio__presence.clean_up(); if (other_value.prio().is_bound()) field_prio = other_value.prio(); else field_prio.clean_up(); if (other_value.thresh__high().is_bound()) field_thresh__high = other_value.thresh__high(); else field_thresh__high.clean_up(); if (other_value.thresh__low__presence().is_bound()) field_thresh__low__presence = other_value.thresh__low__presence(); else field_thresh__low__presence.clean_up(); if (other_value.thresh__low().is_bound()) field_thresh__low = other_value.thresh__low(); else field_thresh__low.clean_up(); if (other_value.qrxlevmin__presence().is_bound()) field_qrxlevmin__presence = other_value.qrxlevmin__presence(); else field_qrxlevmin__presence.clean_up(); if (other_value.qrxlevmin().is_bound()) field_qrxlevmin = other_value.qrxlevmin(); else field_qrxlevmin.clean_up(); } return *this; } boolean EUTRAN__NeighbourCells::operator==(const EUTRAN__NeighbourCells& other_value) const { return field_item__ind==other_value.field_item__ind && field_cell__desc__list==other_value.field_cell__desc__list && field_cell__desc__list__term==other_value.field_cell__desc__list__term && field_prio__presence==other_value.field_prio__presence && field_prio==other_value.field_prio && field_thresh__high==other_value.field_thresh__high && field_thresh__low__presence==other_value.field_thresh__low__presence && field_thresh__low==other_value.field_thresh__low && field_qrxlevmin__presence==other_value.field_qrxlevmin__presence && field_qrxlevmin==other_value.field_qrxlevmin; } boolean EUTRAN__NeighbourCells::is_bound() const { return (field_item__ind.is_bound()) || (OPTIONAL_OMIT == field_cell__desc__list.get_selection() || field_cell__desc__list.is_bound()) || (field_cell__desc__list__term.is_bound()) || (field_prio__presence.is_bound()) || (OPTIONAL_OMIT == field_prio.get_selection() || field_prio.is_bound()) || (field_thresh__high.is_bound()) || (field_thresh__low__presence.is_bound()) || (OPTIONAL_OMIT == field_thresh__low.get_selection() || field_thresh__low.is_bound()) || (field_qrxlevmin__presence.is_bound()) || (OPTIONAL_OMIT == field_qrxlevmin.get_selection() || field_qrxlevmin.is_bound()); } boolean EUTRAN__NeighbourCells::is_value() const { return field_item__ind.is_value() && (OPTIONAL_OMIT == field_cell__desc__list.get_selection() || field_cell__desc__list.is_value()) && field_cell__desc__list__term.is_value() && field_prio__presence.is_value() && (OPTIONAL_OMIT == field_prio.get_selection() || field_prio.is_value()) && field_thresh__high.is_value() && field_thresh__low__presence.is_value() && (OPTIONAL_OMIT == field_thresh__low.get_selection() || field_thresh__low.is_value()) && field_qrxlevmin__presence.is_value() && (OPTIONAL_OMIT == field_qrxlevmin.get_selection() || field_qrxlevmin.is_value()); } int EUTRAN__NeighbourCells::size_of() const { int ret_val = 6; if (field_cell__desc__list.ispresent()) ret_val++; if (field_prio.ispresent()) ret_val++; if (field_thresh__low.ispresent()) ret_val++; if (field_qrxlevmin.ispresent()) ret_val++; return ret_val; } void EUTRAN__NeighbourCells::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ item_ind := "); field_item__ind.log(); TTCN_Logger::log_event_str(", cell_desc_list := "); field_cell__desc__list.log(); TTCN_Logger::log_event_str(", cell_desc_list_term := "); field_cell__desc__list__term.log(); TTCN_Logger::log_event_str(", prio_presence := "); field_prio__presence.log(); TTCN_Logger::log_event_str(", prio := "); field_prio.log(); TTCN_Logger::log_event_str(", thresh_high := "); field_thresh__high.log(); TTCN_Logger::log_event_str(", thresh_low_presence := "); field_thresh__low__presence.log(); TTCN_Logger::log_event_str(", thresh_low := "); field_thresh__low.log(); TTCN_Logger::log_event_str(", qrxlevmin_presence := "); field_qrxlevmin__presence.log(); TTCN_Logger::log_event_str(", qrxlevmin := "); field_qrxlevmin.log(); TTCN_Logger::log_event_str(" }"); } void EUTRAN__NeighbourCells::set_implicit_omit() { if (item__ind().is_bound()) item__ind().set_implicit_omit(); if (!cell__desc__list().is_bound()) cell__desc__list() = OMIT_VALUE; else cell__desc__list().set_implicit_omit(); if (cell__desc__list__term().is_bound()) cell__desc__list__term().set_implicit_omit(); if (prio__presence().is_bound()) prio__presence().set_implicit_omit(); if (!prio().is_bound()) prio() = OMIT_VALUE; else prio().set_implicit_omit(); if (thresh__high().is_bound()) thresh__high().set_implicit_omit(); if (thresh__low__presence().is_bound()) thresh__low__presence().set_implicit_omit(); if (!thresh__low().is_bound()) thresh__low() = OMIT_VALUE; else thresh__low().set_implicit_omit(); if (qrxlevmin__presence().is_bound()) qrxlevmin__presence().set_implicit_omit(); if (!qrxlevmin().is_bound()) qrxlevmin() = OMIT_VALUE; else qrxlevmin().set_implicit_omit(); } void EUTRAN__NeighbourCells::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 (100 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) item__ind().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) cell__desc__list().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) cell__desc__list__term().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) prio__presence().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) prio().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) thresh__high().set_param(*param.get_elem(5)); if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) thresh__low__presence().set_param(*param.get_elem(6)); if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) thresh__low().set_param(*param.get_elem(7)); if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) qrxlevmin__presence().set_param(*param.get_elem(8)); if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) qrxlevmin().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(), "item_ind")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { item__ind().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "cell_desc_list")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cell__desc__list().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "cell_desc_list_term")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cell__desc__list__term().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "prio_presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { prio__presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "prio")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { prio().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "thresh_high")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { thresh__high().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "thresh_low_presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { thresh__low__presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "thresh_low")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { thresh__low().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "qrxlevmin_presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { qrxlevmin__presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "qrxlevmin")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { qrxlevmin().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.EUTRAN_NeighbourCells: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.EUTRAN_NeighbourCells"); } } void EUTRAN__NeighbourCells::encode_text(Text_Buf& text_buf) const { field_item__ind.encode_text(text_buf); field_cell__desc__list.encode_text(text_buf); field_cell__desc__list__term.encode_text(text_buf); field_prio__presence.encode_text(text_buf); field_prio.encode_text(text_buf); field_thresh__high.encode_text(text_buf); field_thresh__low__presence.encode_text(text_buf); field_thresh__low.encode_text(text_buf); field_qrxlevmin__presence.encode_text(text_buf); field_qrxlevmin.encode_text(text_buf); } void EUTRAN__NeighbourCells::decode_text(Text_Buf& text_buf) { field_item__ind.decode_text(text_buf); field_cell__desc__list.decode_text(text_buf); field_cell__desc__list__term.decode_text(text_buf); field_prio__presence.decode_text(text_buf); field_prio.decode_text(text_buf); field_thresh__high.decode_text(text_buf); field_thresh__low__presence.decode_text(text_buf); field_thresh__low.decode_text(text_buf); field_qrxlevmin__presence.decode_text(text_buf); field_qrxlevmin.decode_text(text_buf); } void EUTRAN__NeighbourCells::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name); if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); PER_encode(p_td, p_buf, opt); break; } default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void EUTRAN__NeighbourCells::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name); if(!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); try { PER_decode(p_td, p_buf, opt); p_buf.PER_octet_align(FALSE); } catch (PER_Buffer_Exception) { } break; } default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int EUTRAN__NeighbourCells::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, EUTRAN__NeighbourCells_item__ind_descr_.raw->forceomit); decoded_field_length = field_item__ind.RAW_decode(EUTRAN__NeighbourCells_item__ind_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_0_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); if (limit > 0){ if (force_omit != NULL && (*force_omit)(1)) { field_cell__desc__list = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_1_force_omit(1, force_omit, EUTRAN__NeighbourCells_cell__desc__list_descr_.raw->forceomit); decoded_field_length = field_cell__desc__list().RAW_decode(EUTRAN__NeighbourCells_cell__desc__list_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 1) { field_cell__desc__list = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } else field_cell__desc__list=OMIT_VALUE; RAW_Force_Omit field_2_force_omit(2, force_omit, EUTRAN__NeighbourCells_cell__desc__list__term_descr_.raw->forceomit); decoded_field_length = field_cell__desc__list__term.RAW_decode(EUTRAN__NeighbourCells_cell__desc__list__term_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, EUTRAN__NeighbourCells_prio__presence_descr_.raw->forceomit); decoded_field_length = field_prio__presence.RAW_decode(EUTRAN__NeighbourCells_prio__presence_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_3_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); if (limit > 0 && field_prio__presence == bs_0){ if (force_omit != NULL && (*force_omit)(4)) { field_prio = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_4_force_omit(4, force_omit, EUTRAN__NeighbourCells_prio_descr_.raw->forceomit); decoded_field_length = field_prio().RAW_decode(EUTRAN__NeighbourCells_prio_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_4_force_omit); if (decoded_field_length < 1) { field_prio = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } else field_prio=OMIT_VALUE; RAW_Force_Omit field_5_force_omit(5, force_omit, EUTRAN__NeighbourCells_thresh__high_descr_.raw->forceomit); decoded_field_length = field_thresh__high.RAW_decode(EUTRAN__NeighbourCells_thresh__high_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, EUTRAN__NeighbourCells_thresh__low__presence_descr_.raw->forceomit); decoded_field_length = field_thresh__low__presence.RAW_decode(EUTRAN__NeighbourCells_thresh__low__presence_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()); if (limit > 0 && field_thresh__low__presence == bs_0){ if (force_omit != NULL && (*force_omit)(7)) { field_thresh__low = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_7_force_omit(7, force_omit, EUTRAN__NeighbourCells_thresh__low_descr_.raw->forceomit); decoded_field_length = field_thresh__low().RAW_decode(EUTRAN__NeighbourCells_thresh__low_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_7_force_omit); if (decoded_field_length < 1) { field_thresh__low = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } else field_thresh__low=OMIT_VALUE; RAW_Force_Omit field_8_force_omit(8, force_omit, EUTRAN__NeighbourCells_qrxlevmin__presence_descr_.raw->forceomit); decoded_field_length = field_qrxlevmin__presence.RAW_decode(EUTRAN__NeighbourCells_qrxlevmin__presence_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()); if (limit > 0 && field_qrxlevmin__presence == bs_0){ if (force_omit != NULL && (*force_omit)(9)) { field_qrxlevmin = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_9_force_omit(9, force_omit, EUTRAN__NeighbourCells_qrxlevmin_descr_.raw->forceomit); decoded_field_length = field_qrxlevmin().RAW_decode(EUTRAN__NeighbourCells_qrxlevmin_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_9_force_omit); if (decoded_field_length < 1) { field_qrxlevmin = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } else field_qrxlevmin=OMIT_VALUE; if (field_item__ind != bs_0) return -1; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int EUTRAN__NeighbourCells::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, EUTRAN__NeighbourCells_item__ind_descr_.raw); if (field_cell__desc__list.ispresent()) { myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, EUTRAN__NeighbourCells_cell__desc__list_descr_.raw); } else myleaf.body.node.nodes[1] = NULL; myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, EUTRAN__NeighbourCells_cell__desc__list__term_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, EUTRAN__NeighbourCells_prio__presence_descr_.raw); if (field_prio.ispresent()) { myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, EUTRAN__NeighbourCells_prio_descr_.raw); } else myleaf.body.node.nodes[4] = NULL; myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, EUTRAN__NeighbourCells_thresh__high_descr_.raw); myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, EUTRAN__NeighbourCells_thresh__low__presence_descr_.raw); if (field_thresh__low.ispresent()) { myleaf.body.node.nodes[7] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 7, EUTRAN__NeighbourCells_thresh__low_descr_.raw); } else myleaf.body.node.nodes[7] = NULL; myleaf.body.node.nodes[8] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 8, EUTRAN__NeighbourCells_qrxlevmin__presence_descr_.raw); if (field_qrxlevmin.ispresent()) { myleaf.body.node.nodes[9] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 9, EUTRAN__NeighbourCells_qrxlevmin_descr_.raw); } else myleaf.body.node.nodes[9] = NULL; encoded_length += field_item__ind.RAW_encode(EUTRAN__NeighbourCells_item__ind_descr_, *myleaf.body.node.nodes[0]); if (field_cell__desc__list.ispresent()) { encoded_length += field_cell__desc__list().RAW_encode(EUTRAN__NeighbourCells_cell__desc__list_descr_, *myleaf.body.node.nodes[1]); } encoded_length += field_cell__desc__list__term.RAW_encode(EUTRAN__NeighbourCells_cell__desc__list__term_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_prio__presence.RAW_encode(EUTRAN__NeighbourCells_prio__presence_descr_, *myleaf.body.node.nodes[3]); if (field_prio.ispresent()) { encoded_length += field_prio().RAW_encode(EUTRAN__NeighbourCells_prio_descr_, *myleaf.body.node.nodes[4]); } encoded_length += field_thresh__high.RAW_encode(EUTRAN__NeighbourCells_thresh__high_descr_, *myleaf.body.node.nodes[5]); encoded_length += field_thresh__low__presence.RAW_encode(EUTRAN__NeighbourCells_thresh__low__presence_descr_, *myleaf.body.node.nodes[6]); if (field_thresh__low.ispresent()) { encoded_length += field_thresh__low().RAW_encode(EUTRAN__NeighbourCells_thresh__low_descr_, *myleaf.body.node.nodes[7]); } encoded_length += field_qrxlevmin__presence.RAW_encode(EUTRAN__NeighbourCells_qrxlevmin__presence_descr_, *myleaf.body.node.nodes[8]); if (field_qrxlevmin.ispresent()) { encoded_length += field_qrxlevmin().RAW_encode(EUTRAN__NeighbourCells_qrxlevmin_descr_, *myleaf.body.node.nodes[9]); } if (field_prio.ispresent() && (field_prio__presence != bs_0)) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={3}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ bs_0.RAW_encode(EUTRAN__NeighbourCells_prio__presence_descr_,*temp_leaf); } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value."); } free_tree_pos(pr_pos0.pos); } } if (field_thresh__low.ispresent() && (field_thresh__low__presence != bs_0)) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={6}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ bs_0.RAW_encode(EUTRAN__NeighbourCells_thresh__low__presence_descr_,*temp_leaf); } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value."); } free_tree_pos(pr_pos0.pos); } } if (field_qrxlevmin.ispresent() && (field_qrxlevmin__presence != bs_0)) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={8}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ bs_0.RAW_encode(EUTRAN__NeighbourCells_qrxlevmin__presence_descr_,*temp_leaf); } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value."); } free_tree_pos(pr_pos0.pos); } } if (field_item__ind != bs_0) { 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){ bs_0.RAW_encode(EUTRAN__NeighbourCells_item__ind_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 EUTRAN__NeighbourCells_template::single_value_struct { BITSTRING_template field_item__ind; EUTRAN__CellDescs_template field_cell__desc__list; BITSTRING_template field_cell__desc__list__term; BITSTRING_template field_prio__presence; INTEGER_template field_prio; INTEGER_template field_thresh__high; BITSTRING_template field_thresh__low__presence; INTEGER_template field_thresh__low; BITSTRING_template field_qrxlevmin__presence; INTEGER_template field_qrxlevmin; }; void EUTRAN__NeighbourCells_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_item__ind = ANY_VALUE; single_value->field_cell__desc__list = ANY_OR_OMIT; single_value->field_cell__desc__list__term = ANY_VALUE; single_value->field_prio__presence = ANY_VALUE; single_value->field_prio = ANY_OR_OMIT; single_value->field_thresh__high = ANY_VALUE; single_value->field_thresh__low__presence = ANY_VALUE; single_value->field_thresh__low = ANY_OR_OMIT; single_value->field_qrxlevmin__presence = ANY_VALUE; single_value->field_qrxlevmin = ANY_OR_OMIT; } } } void EUTRAN__NeighbourCells_template::copy_value(const EUTRAN__NeighbourCells& other_value) { single_value = new single_value_struct; if (other_value.item__ind().is_bound()) { single_value->field_item__ind = other_value.item__ind(); } else { single_value->field_item__ind.clean_up(); } if (other_value.cell__desc__list().is_bound()) { if (other_value.cell__desc__list().ispresent()) single_value->field_cell__desc__list = other_value.cell__desc__list()(); else single_value->field_cell__desc__list = OMIT_VALUE; } else { single_value->field_cell__desc__list.clean_up(); } if (other_value.cell__desc__list__term().is_bound()) { single_value->field_cell__desc__list__term = other_value.cell__desc__list__term(); } else { single_value->field_cell__desc__list__term.clean_up(); } if (other_value.prio__presence().is_bound()) { single_value->field_prio__presence = other_value.prio__presence(); } else { single_value->field_prio__presence.clean_up(); } if (other_value.prio().is_bound()) { if (other_value.prio().ispresent()) single_value->field_prio = other_value.prio()(); else single_value->field_prio = OMIT_VALUE; } else { single_value->field_prio.clean_up(); } if (other_value.thresh__high().is_bound()) { single_value->field_thresh__high = other_value.thresh__high(); } else { single_value->field_thresh__high.clean_up(); } if (other_value.thresh__low__presence().is_bound()) { single_value->field_thresh__low__presence = other_value.thresh__low__presence(); } else { single_value->field_thresh__low__presence.clean_up(); } if (other_value.thresh__low().is_bound()) { if (other_value.thresh__low().ispresent()) single_value->field_thresh__low = other_value.thresh__low()(); else single_value->field_thresh__low = OMIT_VALUE; } else { single_value->field_thresh__low.clean_up(); } if (other_value.qrxlevmin__presence().is_bound()) { single_value->field_qrxlevmin__presence = other_value.qrxlevmin__presence(); } else { single_value->field_qrxlevmin__presence.clean_up(); } if (other_value.qrxlevmin().is_bound()) { if (other_value.qrxlevmin().ispresent()) single_value->field_qrxlevmin = other_value.qrxlevmin()(); else single_value->field_qrxlevmin = OMIT_VALUE; } else { single_value->field_qrxlevmin.clean_up(); } set_selection(SPECIFIC_VALUE); } void EUTRAN__NeighbourCells_template::copy_template(const EUTRAN__NeighbourCells_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.item__ind().get_selection()) { single_value->field_item__ind = other_value.item__ind(); } else { single_value->field_item__ind.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.cell__desc__list().get_selection()) { single_value->field_cell__desc__list = other_value.cell__desc__list(); } else { single_value->field_cell__desc__list.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.cell__desc__list__term().get_selection()) { single_value->field_cell__desc__list__term = other_value.cell__desc__list__term(); } else { single_value->field_cell__desc__list__term.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.prio__presence().get_selection()) { single_value->field_prio__presence = other_value.prio__presence(); } else { single_value->field_prio__presence.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.prio().get_selection()) { single_value->field_prio = other_value.prio(); } else { single_value->field_prio.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.thresh__high().get_selection()) { single_value->field_thresh__high = other_value.thresh__high(); } else { single_value->field_thresh__high.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.thresh__low__presence().get_selection()) { single_value->field_thresh__low__presence = other_value.thresh__low__presence(); } else { single_value->field_thresh__low__presence.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.thresh__low().get_selection()) { single_value->field_thresh__low = other_value.thresh__low(); } else { single_value->field_thresh__low.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.qrxlevmin__presence().get_selection()) { single_value->field_qrxlevmin__presence = other_value.qrxlevmin__presence(); } else { single_value->field_qrxlevmin__presence.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.qrxlevmin().get_selection()) { single_value->field_qrxlevmin = other_value.qrxlevmin(); } else { single_value->field_qrxlevmin.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 EUTRAN__NeighbourCells_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 EUTRAN__NeighbourCells_template(*other_value.implication_.precondition); implication_.implied_template = new EUTRAN__NeighbourCells_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of type @GSM_RestOctets.EUTRAN_NeighbourCells."); break; } set_selection(other_value); } EUTRAN__NeighbourCells_template::EUTRAN__NeighbourCells_template() { } EUTRAN__NeighbourCells_template::EUTRAN__NeighbourCells_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } EUTRAN__NeighbourCells_template::EUTRAN__NeighbourCells_template(const EUTRAN__NeighbourCells& other_value) { copy_value(other_value); } EUTRAN__NeighbourCells_template::EUTRAN__NeighbourCells_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const EUTRAN__NeighbourCells&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.EUTRAN_NeighbourCells from an unbound optional field."); } } EUTRAN__NeighbourCells_template::EUTRAN__NeighbourCells_template(EUTRAN__NeighbourCells_template* p_precondition, EUTRAN__NeighbourCells_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } EUTRAN__NeighbourCells_template::EUTRAN__NeighbourCells_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; } EUTRAN__NeighbourCells_template::EUTRAN__NeighbourCells_template(const EUTRAN__NeighbourCells_template& other_value) : Base_Template() { copy_template(other_value); } EUTRAN__NeighbourCells_template::~EUTRAN__NeighbourCells_template() { clean_up(); } EUTRAN__NeighbourCells_template& EUTRAN__NeighbourCells_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } EUTRAN__NeighbourCells_template& EUTRAN__NeighbourCells_template::operator=(const EUTRAN__NeighbourCells& other_value) { clean_up(); copy_value(other_value); return *this; } EUTRAN__NeighbourCells_template& EUTRAN__NeighbourCells_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const EUTRAN__NeighbourCells&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @GSM_RestOctets.EUTRAN_NeighbourCells."); } return *this; } EUTRAN__NeighbourCells_template& EUTRAN__NeighbourCells_template::operator=(const EUTRAN__NeighbourCells_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean EUTRAN__NeighbourCells_template::match(const EUTRAN__NeighbourCells& 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.item__ind().is_bound()) return FALSE; if(!single_value->field_item__ind.match(other_value.item__ind(), legacy))return FALSE; if(!other_value.cell__desc__list().is_bound()) return FALSE; if((other_value.cell__desc__list().ispresent() ? !single_value->field_cell__desc__list.match((const EUTRAN__CellDescs&)other_value.cell__desc__list(), legacy) : !single_value->field_cell__desc__list.match_omit(legacy)))return FALSE; if(!other_value.cell__desc__list__term().is_bound()) return FALSE; if(!single_value->field_cell__desc__list__term.match(other_value.cell__desc__list__term(), legacy))return FALSE; if(!other_value.prio__presence().is_bound()) return FALSE; if(!single_value->field_prio__presence.match(other_value.prio__presence(), legacy))return FALSE; if(!other_value.prio().is_bound()) return FALSE; if((other_value.prio().ispresent() ? !single_value->field_prio.match((const INTEGER&)other_value.prio(), legacy) : !single_value->field_prio.match_omit(legacy)))return FALSE; if(!other_value.thresh__high().is_bound()) return FALSE; if(!single_value->field_thresh__high.match(other_value.thresh__high(), legacy))return FALSE; if(!other_value.thresh__low__presence().is_bound()) return FALSE; if(!single_value->field_thresh__low__presence.match(other_value.thresh__low__presence(), legacy))return FALSE; if(!other_value.thresh__low().is_bound()) return FALSE; if((other_value.thresh__low().ispresent() ? !single_value->field_thresh__low.match((const INTEGER&)other_value.thresh__low(), legacy) : !single_value->field_thresh__low.match_omit(legacy)))return FALSE; if(!other_value.qrxlevmin__presence().is_bound()) return FALSE; if(!single_value->field_qrxlevmin__presence.match(other_value.qrxlevmin__presence(), legacy))return FALSE; if(!other_value.qrxlevmin().is_bound()) return FALSE; if((other_value.qrxlevmin().ispresent() ? !single_value->field_qrxlevmin.match((const INTEGER&)other_value.qrxlevmin(), legacy) : !single_value->field_qrxlevmin.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 @GSM_RestOctets.EUTRAN_NeighbourCells."); } return FALSE; } boolean EUTRAN__NeighbourCells_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_item__ind.is_bound() || (single_value->field_cell__desc__list.is_omit() || single_value->field_cell__desc__list.is_bound()) || single_value->field_cell__desc__list__term.is_bound() || single_value->field_prio__presence.is_bound() || (single_value->field_prio.is_omit() || single_value->field_prio.is_bound()) || single_value->field_thresh__high.is_bound() || single_value->field_thresh__low__presence.is_bound() || (single_value->field_thresh__low.is_omit() || single_value->field_thresh__low.is_bound()) || single_value->field_qrxlevmin__presence.is_bound() || (single_value->field_qrxlevmin.is_omit() || single_value->field_qrxlevmin.is_bound()); } boolean EUTRAN__NeighbourCells_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_item__ind.is_value() && (single_value->field_cell__desc__list.is_omit() || single_value->field_cell__desc__list.is_value()) && single_value->field_cell__desc__list__term.is_value() && single_value->field_prio__presence.is_value() && (single_value->field_prio.is_omit() || single_value->field_prio.is_value()) && single_value->field_thresh__high.is_value() && single_value->field_thresh__low__presence.is_value() && (single_value->field_thresh__low.is_omit() || single_value->field_thresh__low.is_value()) && single_value->field_qrxlevmin__presence.is_value() && (single_value->field_qrxlevmin.is_omit() || single_value->field_qrxlevmin.is_value()); } void EUTRAN__NeighbourCells_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; } EUTRAN__NeighbourCells EUTRAN__NeighbourCells_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @GSM_RestOctets.EUTRAN_NeighbourCells."); EUTRAN__NeighbourCells ret_val; if (single_value->field_item__ind.is_bound()) { ret_val.item__ind() = single_value->field_item__ind.valueof(); } if (single_value->field_cell__desc__list.is_omit()) ret_val.cell__desc__list() = OMIT_VALUE; else if (single_value->field_cell__desc__list.is_bound()) { ret_val.cell__desc__list() = single_value->field_cell__desc__list.valueof(); } if (single_value->field_cell__desc__list__term.is_bound()) { ret_val.cell__desc__list__term() = single_value->field_cell__desc__list__term.valueof(); } if (single_value->field_prio__presence.is_bound()) { ret_val.prio__presence() = single_value->field_prio__presence.valueof(); } if (single_value->field_prio.is_omit()) ret_val.prio() = OMIT_VALUE; else if (single_value->field_prio.is_bound()) { ret_val.prio() = single_value->field_prio.valueof(); } if (single_value->field_thresh__high.is_bound()) { ret_val.thresh__high() = single_value->field_thresh__high.valueof(); } if (single_value->field_thresh__low__presence.is_bound()) { ret_val.thresh__low__presence() = single_value->field_thresh__low__presence.valueof(); } if (single_value->field_thresh__low.is_omit()) ret_val.thresh__low() = OMIT_VALUE; else if (single_value->field_thresh__low.is_bound()) { ret_val.thresh__low() = single_value->field_thresh__low.valueof(); } if (single_value->field_qrxlevmin__presence.is_bound()) { ret_val.qrxlevmin__presence() = single_value->field_qrxlevmin__presence.valueof(); } if (single_value->field_qrxlevmin.is_omit()) ret_val.qrxlevmin() = OMIT_VALUE; else if (single_value->field_qrxlevmin.is_bound()) { ret_val.qrxlevmin() = single_value->field_qrxlevmin.valueof(); } return ret_val; } void EUTRAN__NeighbourCells_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list for a template of type @GSM_RestOctets.EUTRAN_NeighbourCells."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new EUTRAN__NeighbourCells_template[list_length]; } EUTRAN__NeighbourCells_template& EUTRAN__NeighbourCells_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element of a non-list template of type @GSM_RestOctets.EUTRAN_NeighbourCells."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.EUTRAN_NeighbourCells."); return value_list.list_value[list_index]; } BITSTRING_template& EUTRAN__NeighbourCells_template::item__ind() { set_specific(); return single_value->field_item__ind; } const BITSTRING_template& EUTRAN__NeighbourCells_template::item__ind() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field item_ind of a non-specific template of type @GSM_RestOctets.EUTRAN_NeighbourCells."); return single_value->field_item__ind; } EUTRAN__CellDescs_template& EUTRAN__NeighbourCells_template::cell__desc__list() { set_specific(); return single_value->field_cell__desc__list; } const EUTRAN__CellDescs_template& EUTRAN__NeighbourCells_template::cell__desc__list() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field cell_desc_list of a non-specific template of type @GSM_RestOctets.EUTRAN_NeighbourCells."); return single_value->field_cell__desc__list; } BITSTRING_template& EUTRAN__NeighbourCells_template::cell__desc__list__term() { set_specific(); return single_value->field_cell__desc__list__term; } const BITSTRING_template& EUTRAN__NeighbourCells_template::cell__desc__list__term() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field cell_desc_list_term of a non-specific template of type @GSM_RestOctets.EUTRAN_NeighbourCells."); return single_value->field_cell__desc__list__term; } BITSTRING_template& EUTRAN__NeighbourCells_template::prio__presence() { set_specific(); return single_value->field_prio__presence; } const BITSTRING_template& EUTRAN__NeighbourCells_template::prio__presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field prio_presence of a non-specific template of type @GSM_RestOctets.EUTRAN_NeighbourCells."); return single_value->field_prio__presence; } INTEGER_template& EUTRAN__NeighbourCells_template::prio() { set_specific(); return single_value->field_prio; } const INTEGER_template& EUTRAN__NeighbourCells_template::prio() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field prio of a non-specific template of type @GSM_RestOctets.EUTRAN_NeighbourCells."); return single_value->field_prio; } INTEGER_template& EUTRAN__NeighbourCells_template::thresh__high() { set_specific(); return single_value->field_thresh__high; } const INTEGER_template& EUTRAN__NeighbourCells_template::thresh__high() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field thresh_high of a non-specific template of type @GSM_RestOctets.EUTRAN_NeighbourCells."); return single_value->field_thresh__high; } BITSTRING_template& EUTRAN__NeighbourCells_template::thresh__low__presence() { set_specific(); return single_value->field_thresh__low__presence; } const BITSTRING_template& EUTRAN__NeighbourCells_template::thresh__low__presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field thresh_low_presence of a non-specific template of type @GSM_RestOctets.EUTRAN_NeighbourCells."); return single_value->field_thresh__low__presence; } INTEGER_template& EUTRAN__NeighbourCells_template::thresh__low() { set_specific(); return single_value->field_thresh__low; } const INTEGER_template& EUTRAN__NeighbourCells_template::thresh__low() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field thresh_low of a non-specific template of type @GSM_RestOctets.EUTRAN_NeighbourCells."); return single_value->field_thresh__low; } BITSTRING_template& EUTRAN__NeighbourCells_template::qrxlevmin__presence() { set_specific(); return single_value->field_qrxlevmin__presence; } const BITSTRING_template& EUTRAN__NeighbourCells_template::qrxlevmin__presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field qrxlevmin_presence of a non-specific template of type @GSM_RestOctets.EUTRAN_NeighbourCells."); return single_value->field_qrxlevmin__presence; } INTEGER_template& EUTRAN__NeighbourCells_template::qrxlevmin() { set_specific(); return single_value->field_qrxlevmin; } const INTEGER_template& EUTRAN__NeighbourCells_template::qrxlevmin() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field qrxlevmin of a non-specific template of type @GSM_RestOctets.EUTRAN_NeighbourCells."); return single_value->field_qrxlevmin; } int EUTRAN__NeighbourCells_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_NeighbourCells which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 6; if (single_value->field_cell__desc__list.is_present()) ret_val++; if (single_value->field_prio.is_present()) ret_val++; if (single_value->field_thresh__low.is_present()) ret_val++; if (single_value->field_qrxlevmin.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 @GSM_RestOctets.EUTRAN_NeighbourCells containing an empty list."); int item_size = value_list.list_value[0].size_of(); for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++) { if (value_list.list_value[l_idx].size_of()!=item_size) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_NeighbourCells containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_NeighbourCells containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_NeighbourCells containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_NeighbourCells containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_NeighbourCells containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_NeighbourCells containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_NeighbourCells containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.EUTRAN_NeighbourCells."); } return 0; } void EUTRAN__NeighbourCells_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ item_ind := "); single_value->field_item__ind.log(); TTCN_Logger::log_event_str(", cell_desc_list := "); single_value->field_cell__desc__list.log(); TTCN_Logger::log_event_str(", cell_desc_list_term := "); single_value->field_cell__desc__list__term.log(); TTCN_Logger::log_event_str(", prio_presence := "); single_value->field_prio__presence.log(); TTCN_Logger::log_event_str(", prio := "); single_value->field_prio.log(); TTCN_Logger::log_event_str(", thresh_high := "); single_value->field_thresh__high.log(); TTCN_Logger::log_event_str(", thresh_low_presence := "); single_value->field_thresh__low__presence.log(); TTCN_Logger::log_event_str(", thresh_low := "); single_value->field_thresh__low.log(); TTCN_Logger::log_event_str(", qrxlevmin_presence := "); single_value->field_qrxlevmin__presence.log(); TTCN_Logger::log_event_str(", qrxlevmin := "); single_value->field_qrxlevmin.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 EUTRAN__NeighbourCells_template::log_match(const EUTRAN__NeighbourCells& 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_item__ind.match(match_value.item__ind(), legacy)){ TTCN_Logger::log_logmatch_info(".item_ind"); single_value->field_item__ind.log_match(match_value.item__ind(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.cell__desc__list().ispresent()){ if(!single_value->field_cell__desc__list.match(match_value.cell__desc__list(), legacy)){ TTCN_Logger::log_logmatch_info(".cell_desc_list"); single_value->field_cell__desc__list.log_match(match_value.cell__desc__list(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_cell__desc__list.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".cell_desc_list := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_cell__desc__list.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if(!single_value->field_cell__desc__list__term.match(match_value.cell__desc__list__term(), legacy)){ TTCN_Logger::log_logmatch_info(".cell_desc_list_term"); single_value->field_cell__desc__list__term.log_match(match_value.cell__desc__list__term(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_prio__presence.match(match_value.prio__presence(), legacy)){ TTCN_Logger::log_logmatch_info(".prio_presence"); single_value->field_prio__presence.log_match(match_value.prio__presence(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.prio().ispresent()){ if(!single_value->field_prio.match(match_value.prio(), legacy)){ TTCN_Logger::log_logmatch_info(".prio"); single_value->field_prio.log_match(match_value.prio(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_prio.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".prio := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_prio.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if(!single_value->field_thresh__high.match(match_value.thresh__high(), legacy)){ TTCN_Logger::log_logmatch_info(".thresh_high"); single_value->field_thresh__high.log_match(match_value.thresh__high(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_thresh__low__presence.match(match_value.thresh__low__presence(), legacy)){ TTCN_Logger::log_logmatch_info(".thresh_low_presence"); single_value->field_thresh__low__presence.log_match(match_value.thresh__low__presence(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.thresh__low().ispresent()){ if(!single_value->field_thresh__low.match(match_value.thresh__low(), legacy)){ TTCN_Logger::log_logmatch_info(".thresh_low"); single_value->field_thresh__low.log_match(match_value.thresh__low(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_thresh__low.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".thresh_low := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_thresh__low.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if(!single_value->field_qrxlevmin__presence.match(match_value.qrxlevmin__presence(), legacy)){ TTCN_Logger::log_logmatch_info(".qrxlevmin_presence"); single_value->field_qrxlevmin__presence.log_match(match_value.qrxlevmin__presence(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.qrxlevmin().ispresent()){ if(!single_value->field_qrxlevmin.match(match_value.qrxlevmin(), legacy)){ TTCN_Logger::log_logmatch_info(".qrxlevmin"); single_value->field_qrxlevmin.log_match(match_value.qrxlevmin(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_qrxlevmin.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".qrxlevmin := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_qrxlevmin.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("{ item_ind := "); single_value->field_item__ind.log_match(match_value.item__ind(), legacy); TTCN_Logger::log_event_str(", cell_desc_list := "); if (match_value.cell__desc__list().ispresent()) { single_value->field_cell__desc__list.log_match(match_value.cell__desc__list(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_cell__desc__list.log(); if (single_value->field_cell__desc__list.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", cell_desc_list_term := "); single_value->field_cell__desc__list__term.log_match(match_value.cell__desc__list__term(), legacy); TTCN_Logger::log_event_str(", prio_presence := "); single_value->field_prio__presence.log_match(match_value.prio__presence(), legacy); TTCN_Logger::log_event_str(", prio := "); if (match_value.prio().ispresent()) { single_value->field_prio.log_match(match_value.prio(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_prio.log(); if (single_value->field_prio.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", thresh_high := "); single_value->field_thresh__high.log_match(match_value.thresh__high(), legacy); TTCN_Logger::log_event_str(", thresh_low_presence := "); single_value->field_thresh__low__presence.log_match(match_value.thresh__low__presence(), legacy); TTCN_Logger::log_event_str(", thresh_low := "); if (match_value.thresh__low().ispresent()) { single_value->field_thresh__low.log_match(match_value.thresh__low(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_thresh__low.log(); if (single_value->field_thresh__low.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", qrxlevmin_presence := "); single_value->field_qrxlevmin__presence.log_match(match_value.qrxlevmin__presence(), legacy); TTCN_Logger::log_event_str(", qrxlevmin := "); if (match_value.qrxlevmin().ispresent()) { single_value->field_qrxlevmin.log_match(match_value.qrxlevmin(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_qrxlevmin.log(); if (single_value->field_qrxlevmin.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 EUTRAN__NeighbourCells_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (item__ind().is_bound()) item__ind().set_implicit_omit(); if (!cell__desc__list().is_bound()) cell__desc__list() = OMIT_VALUE; else cell__desc__list().set_implicit_omit(); if (cell__desc__list__term().is_bound()) cell__desc__list__term().set_implicit_omit(); if (prio__presence().is_bound()) prio__presence().set_implicit_omit(); if (!prio().is_bound()) prio() = OMIT_VALUE; else prio().set_implicit_omit(); if (thresh__high().is_bound()) thresh__high().set_implicit_omit(); if (thresh__low__presence().is_bound()) thresh__low__presence().set_implicit_omit(); if (!thresh__low().is_bound()) thresh__low() = OMIT_VALUE; else thresh__low().set_implicit_omit(); if (qrxlevmin__presence().is_bound()) qrxlevmin__presence().set_implicit_omit(); if (!qrxlevmin().is_bound()) qrxlevmin() = OMIT_VALUE; else qrxlevmin().set_implicit_omit(); } void EUTRAN__NeighbourCells_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_item__ind.encode_text(text_buf); single_value->field_cell__desc__list.encode_text(text_buf); single_value->field_cell__desc__list__term.encode_text(text_buf); single_value->field_prio__presence.encode_text(text_buf); single_value->field_prio.encode_text(text_buf); single_value->field_thresh__high.encode_text(text_buf); single_value->field_thresh__low__presence.encode_text(text_buf); single_value->field_thresh__low.encode_text(text_buf); single_value->field_qrxlevmin__presence.encode_text(text_buf); single_value->field_qrxlevmin.encode_text(text_buf); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @GSM_RestOctets.EUTRAN_NeighbourCells."); } } void EUTRAN__NeighbourCells_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_item__ind.decode_text(text_buf); single_value->field_cell__desc__list.decode_text(text_buf); single_value->field_cell__desc__list__term.decode_text(text_buf); single_value->field_prio__presence.decode_text(text_buf); single_value->field_prio.decode_text(text_buf); single_value->field_thresh__high.decode_text(text_buf); single_value->field_thresh__low__presence.decode_text(text_buf); single_value->field_thresh__low.decode_text(text_buf); single_value->field_qrxlevmin__presence.decode_text(text_buf); single_value->field_qrxlevmin.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 EUTRAN__NeighbourCells_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @GSM_RestOctets.EUTRAN_NeighbourCells."); } } void EUTRAN__NeighbourCells_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: { EUTRAN__NeighbourCells_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) item__ind().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) cell__desc__list().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) cell__desc__list__term().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) prio__presence().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) prio().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) thresh__high().set_param(*param.get_elem(5)); if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) thresh__low__presence().set_param(*param.get_elem(6)); if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) thresh__low().set_param(*param.get_elem(7)); if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) qrxlevmin__presence().set_param(*param.get_elem(8)); if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) qrxlevmin().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(), "item_ind")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { item__ind().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "cell_desc_list")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cell__desc__list().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "cell_desc_list_term")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cell__desc__list__term().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "prio_presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { prio__presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "prio")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { prio().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "thresh_high")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { thresh__high().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "thresh_low_presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { thresh__low__presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "thresh_low")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { thresh__low().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "qrxlevmin_presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { qrxlevmin__presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "qrxlevmin")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { qrxlevmin().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.EUTRAN_NeighbourCells: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { EUTRAN__NeighbourCells_template* precondition = new EUTRAN__NeighbourCells_template; precondition->set_param(*param.get_elem(0)); EUTRAN__NeighbourCells_template* implied_template = new EUTRAN__NeighbourCells_template; implied_template->set_param(*param.get_elem(1)); *this = EUTRAN__NeighbourCells_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.EUTRAN_NeighbourCells"); } is_ifpresent = param.get_ifpresent(); } void EUTRAN__NeighbourCells_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_item__ind.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.EUTRAN_NeighbourCells"); single_value->field_cell__desc__list.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.EUTRAN_NeighbourCells"); single_value->field_cell__desc__list__term.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.EUTRAN_NeighbourCells"); single_value->field_prio__presence.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.EUTRAN_NeighbourCells"); single_value->field_prio.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.EUTRAN_NeighbourCells"); single_value->field_thresh__high.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.EUTRAN_NeighbourCells"); single_value->field_thresh__low__presence.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.EUTRAN_NeighbourCells"); single_value->field_thresh__low.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.EUTRAN_NeighbourCells"); single_value->field_qrxlevmin__presence.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.EUTRAN_NeighbourCells"); single_value->field_qrxlevmin.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.EUTRAN_NeighbourCells"); return; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@GSM_RestOctets.EUTRAN_NeighbourCells"); } boolean EUTRAN__NeighbourCells_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean EUTRAN__NeighbourCells_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; } EUTRAN__CellDescs::EUTRAN__CellDescs(const EUTRAN__CellDescs& other_value) { if (!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.EUTRAN_CellDescs."); val_ptr = other_value.val_ptr; val_ptr->ref_count++; } EUTRAN__CellDescs::~EUTRAN__CellDescs() { clean_up(); if (val_ptr != NULL) val_ptr = NULL; } void EUTRAN__CellDescs::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."); } } EUTRAN__CellDescs& EUTRAN__CellDescs::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; } EUTRAN__CellDescs& EUTRAN__CellDescs::operator=(const EUTRAN__CellDescs& other_value) { if (other_value.val_ptr == NULL) TTCN_error("Assigning an unbound value of type @GSM_RestOctets.EUTRAN_CellDescs."); if (this != &other_value) { clean_up(); val_ptr = other_value.val_ptr; val_ptr->ref_count++; } return *this; } boolean EUTRAN__CellDescs::operator==(null_type) const { if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @GSM_RestOctets.EUTRAN_CellDescs."); return val_ptr->n_elements == 0 ; } boolean EUTRAN__CellDescs::operator==(const EUTRAN__CellDescs& other_value) const { if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @GSM_RestOctets.EUTRAN_CellDescs."); if (other_value.val_ptr == NULL) TTCN_error("The right operand of comparison is an unbound value of type @GSM_RestOctets.EUTRAN_CellDescs."); 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; } EUTRAN__CellDesc& EUTRAN__CellDescs::operator[](int index_value) { if (index_value < 0) TTCN_error("Accessing an element of type @GSM_RestOctets.EUTRAN_CellDescs 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 = (EUTRAN__CellDesc**)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 EUTRAN__CellDesc(*(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 EUTRAN__CellDesc; } return *val_ptr->value_elements[index_value]; } EUTRAN__CellDesc& EUTRAN__CellDescs::operator[](const INTEGER& index_value) { index_value.must_bound("Using an unbound integer value for indexing a value of type @GSM_RestOctets.EUTRAN_CellDescs."); return (*this)[(int)index_value]; } const EUTRAN__CellDesc& EUTRAN__CellDescs::operator[](int index_value) const { if (val_ptr == NULL) TTCN_error("Accessing an element in an unbound value of type @GSM_RestOctets.EUTRAN_CellDescs."); if (index_value < 0) TTCN_error("Accessing an element of type @GSM_RestOctets.EUTRAN_CellDescs using a negative index: %d.", index_value); if (index_value >= val_ptr->n_elements) TTCN_error("Index overflow in a value of type @GSM_RestOctets.EUTRAN_CellDescs: 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 EUTRAN__CellDesc& EUTRAN__CellDescs::operator[](const INTEGER& index_value) const { index_value.must_bound("Using an unbound integer value for indexing a value of type @GSM_RestOctets.EUTRAN_CellDescs."); return (*this)[(int)index_value]; } EUTRAN__CellDescs EUTRAN__CellDescs::operator<<=(int rotate_count) const { return *this >>= (-rotate_count); } EUTRAN__CellDescs EUTRAN__CellDescs::operator<<=(const INTEGER& rotate_count) const { rotate_count.must_bound("Unbound integer operand of rotate left operator."); return *this >>= (int)(-rotate_count); } EUTRAN__CellDescs EUTRAN__CellDescs::operator>>=(const INTEGER& rotate_count) const { rotate_count.must_bound("Unbound integer operand of rotate right operator."); return *this >>= (int)rotate_count; } EUTRAN__CellDescs EUTRAN__CellDescs::operator>>=(int rotate_count) const { if (val_ptr == NULL) TTCN_error("Performing rotation operation on an unbound value of type @GSM_RestOctets.EUTRAN_CellDescs."); 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; EUTRAN__CellDescs 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 EUTRAN__CellDesc(*val_ptr->value_elements[i]); } } return ret_val; } EUTRAN__CellDescs EUTRAN__CellDescs::operator+(const EUTRAN__CellDescs& other_value) const { if (val_ptr == NULL || other_value.val_ptr == NULL) TTCN_error("Unbound operand of @GSM_RestOctets.EUTRAN_CellDescs concatenation."); if (val_ptr->n_elements == 0) return other_value; if (other_value.val_ptr->n_elements == 0) return *this; EUTRAN__CellDescs 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 EUTRAN__CellDesc(*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 EUTRAN__CellDesc(*other_value.val_ptr->value_elements[i]); } } return ret_val; } EUTRAN__CellDescs EUTRAN__CellDescs::substr(int index, int returncount) const { if (val_ptr == NULL) TTCN_error("The first argument of substr() is an unbound value of type @GSM_RestOctets.EUTRAN_CellDescs."); check_substr_arguments(val_ptr->n_elements, index, returncount, "@GSM_RestOctets.EUTRAN_CellDescs","element"); EUTRAN__CellDescs ret_val; ret_val.set_size(returncount); for (int i=0; ivalue_elements[i+index] != NULL) { ret_val.val_ptr->value_elements[i] = new EUTRAN__CellDesc(*val_ptr->value_elements[i+index]); } } return ret_val; } EUTRAN__CellDescs EUTRAN__CellDescs::replace(int index, int len, const EUTRAN__CellDescs& repl) const { if (val_ptr == NULL) TTCN_error("The first argument of replace() is an unbound value of type @GSM_RestOctets.EUTRAN_CellDescs."); if (repl.val_ptr == NULL) TTCN_error("The fourth argument of replace() is an unbound value of type @GSM_RestOctets.EUTRAN_CellDescs."); check_replace_arguments(val_ptr->n_elements, index, len, "@GSM_RestOctets.EUTRAN_CellDescs","element"); EUTRAN__CellDescs 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 EUTRAN__CellDesc(*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 EUTRAN__CellDesc(*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 EUTRAN__CellDesc(*val_ptr->value_elements[index+i+len]); } } return ret_val; } EUTRAN__CellDescs EUTRAN__CellDescs::replace(int index, int len, const EUTRAN__CellDescs_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 EUTRAN__CellDescs::set_size(int new_size) { if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a value of type @GSM_RestOctets.EUTRAN_CellDescs."); 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 = (EUTRAN__CellDesc**)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 EUTRAN__CellDesc(*(val_ptr->value_elements[elem_count])); } } clean_up(); val_ptr = new_val_ptr; } if (new_size > val_ptr->n_elements) { val_ptr->value_elements = (EUTRAN__CellDesc**)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 @GSM_RestOctets.EUTRAN_CellDescs: %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 = (EUTRAN__CellDesc**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size); val_ptr->n_elements = new_size; } } boolean EUTRAN__CellDescs::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 EUTRAN__CellDescs::size_of() const { if (val_ptr == NULL) TTCN_error("Performing sizeof operation on an unbound value of type @GSM_RestOctets.EUTRAN_CellDescs."); return val_ptr->n_elements; } int EUTRAN__CellDescs::lengthof() const { if (val_ptr == NULL) TTCN_error("Performing lengthof operation on an unbound value of type @GSM_RestOctets.EUTRAN_CellDescs."); 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 EUTRAN__CellDescs::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 EUTRAN__CellDescs::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 EUTRAN__CellDescs::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", "@GSM_RestOctets.EUTRAN_CellDescs"); } 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", "@GSM_RestOctets.EUTRAN_CellDescs"); } break; default: TTCN_error("Internal error: Unknown operation type."); } } void EUTRAN__CellDescs::encode_text(Text_Buf& text_buf) const { if (val_ptr == NULL) TTCN_error("Text encoder: Encoding an unbound value of type @GSM_RestOctets.EUTRAN_CellDescs."); 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 EUTRAN__CellDescs::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 @GSM_RestOctets.EUTRAN_CellDescs."); val_ptr->value_elements = (EUTRAN__CellDesc**)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 EUTRAN__CellDesc; val_ptr->value_elements[elem_count]->decode_text(text_buf); } } void EUTRAN__CellDescs::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name); if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); PER_encode(p_td, p_buf, opt); break; } default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void EUTRAN__CellDescs::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name); if(!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); try { PER_decode(p_td, p_buf, opt); p_buf.PER_octet_align(FALSE); } catch (PER_Buffer_Exception) { } break; } default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int EUTRAN__CellDescs::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 EUTRAN__CellDescs::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 EUTRAN__CellDescs_template::copy_value(const EUTRAN__CellDescs& other_value) { if (!other_value.is_bound()) TTCN_error("Initialization of a template of type @GSM_RestOctets.EUTRAN_CellDescs with an unbound value."); single_value.n_elements = other_value.size_of(); single_value.value_elements = (EUTRAN__CellDesc_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 EUTRAN__CellDesc_template(other_value[elem_count]); } else { single_value.value_elements[elem_count] = new EUTRAN__CellDesc_template; } } set_selection(SPECIFIC_VALUE); } void EUTRAN__CellDescs_template::copy_template(const EUTRAN__CellDescs_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 = (EUTRAN__CellDesc_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 EUTRAN__CellDesc_template(*other_value.single_value.value_elements[elem_count]); } else { single_value.value_elements[elem_count] = new EUTRAN__CellDesc_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 EUTRAN__CellDescs_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 EUTRAN__CellDescs_template(*other_value.implication_.precondition); implication_.implied_template = new EUTRAN__CellDescs_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of type @GSM_RestOctets.EUTRAN_CellDescs."); break; } set_selection(other_value); } boolean EUTRAN__CellDescs_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 EUTRAN__CellDescs_template*)template_ptr)->single_value.value_elements[template_index]->match((*(const EUTRAN__CellDescs*)value_ptr)[value_index], legacy); else return ((const EUTRAN__CellDescs_template*)template_ptr)->single_value.value_elements[template_index]->is_any_or_omit(); } EUTRAN__CellDescs_template::EUTRAN__CellDescs_template() { } EUTRAN__CellDescs_template::EUTRAN__CellDescs_template(template_sel other_value) : Base_Record_Of_Template(other_value) { check_single_selection(other_value); } EUTRAN__CellDescs_template::EUTRAN__CellDescs_template(null_type) : Base_Record_Of_Template(SPECIFIC_VALUE) { single_value.n_elements = 0; single_value.value_elements = NULL; } EUTRAN__CellDescs_template::EUTRAN__CellDescs_template(const EUTRAN__CellDescs& other_value) { copy_value(other_value); } EUTRAN__CellDescs_template::EUTRAN__CellDescs_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const EUTRAN__CellDescs&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.EUTRAN_CellDescs from an unbound optional field."); } } EUTRAN__CellDescs_template::EUTRAN__CellDescs_template(EUTRAN__CellDescs_template* p_precondition, EUTRAN__CellDescs_template* p_implied_template) : Base_Record_Of_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } EUTRAN__CellDescs_template::EUTRAN__CellDescs_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; } EUTRAN__CellDescs_template::EUTRAN__CellDescs_template(const EUTRAN__CellDescs_template& other_value) : Base_Record_Of_Template() { copy_template(other_value); } EUTRAN__CellDescs_template::~EUTRAN__CellDescs_template() { clean_up(); } void EUTRAN__CellDescs_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; } EUTRAN__CellDescs_template& EUTRAN__CellDescs_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } EUTRAN__CellDescs_template& EUTRAN__CellDescs_template::operator=(null_type) { clean_up(); set_selection(SPECIFIC_VALUE); single_value.n_elements = 0; single_value.value_elements = NULL; return *this; } EUTRAN__CellDescs_template& EUTRAN__CellDescs_template::operator=(const EUTRAN__CellDescs& other_value) { clean_up(); copy_value(other_value); return *this; } EUTRAN__CellDescs_template& EUTRAN__CellDescs_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const EUTRAN__CellDescs&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @GSM_RestOctets.EUTRAN_CellDescs."); } return *this; } EUTRAN__CellDescs_template& EUTRAN__CellDescs_template::operator=(const EUTRAN__CellDescs_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } EUTRAN__CellDesc_template& EUTRAN__CellDescs_template::operator[](int index_value) { if (index_value < 0) TTCN_error("Accessing an element of a template for type @GSM_RestOctets.EUTRAN_CellDescs 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 @GSM_RestOctets.EUTRAN_CellDescs."); break; } return *single_value.value_elements[index_value]; } EUTRAN__CellDesc_template& EUTRAN__CellDescs_template::operator[](const INTEGER& index_value) { index_value.must_bound("Using an unbound integer value for indexing a template of type @GSM_RestOctets.EUTRAN_CellDescs."); return (*this)[(int)index_value]; } const EUTRAN__CellDesc_template& EUTRAN__CellDescs_template::operator[](int index_value) const { if (index_value < 0) TTCN_error("Accessing an element of a template for type @GSM_RestOctets.EUTRAN_CellDescs using a negative index: %d.", index_value); if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing an element of a non-specific template for type @GSM_RestOctets.EUTRAN_CellDescs."); if (index_value >= single_value.n_elements) TTCN_error("Index overflow in a template of type @GSM_RestOctets.EUTRAN_CellDescs: 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 EUTRAN__CellDesc_template& EUTRAN__CellDescs_template::operator[](const INTEGER& index_value) const { index_value.must_bound("Using an unbound integer value for indexing a template of type @GSM_RestOctets.EUTRAN_CellDescs."); return (*this)[(int)index_value]; } void EUTRAN__CellDescs_template::set_size(int new_size) { if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a template of type @GSM_RestOctets.EUTRAN_CellDescs."); 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 = (EUTRAN__CellDesc_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 EUTRAN__CellDesc_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 EUTRAN__CellDesc_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 = (EUTRAN__CellDesc_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size); single_value.n_elements = new_size; } } int EUTRAN__CellDescs_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 EUTRAN__CellDescs_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 @GSM_RestOctets.EUTRAN_CellDescs 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 @GSM_RestOctets.EUTRAN_CellDescs 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 @GSM_RestOctets.EUTRAN_CellDescs 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 @GSM_RestOctets.EUTRAN_CellDescs 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 @GSM_RestOctets.EUTRAN_CellDescs 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 @GSM_RestOctets.EUTRAN_CellDescs containing complemented list.", op_name); default: TTCN_error("Performing %sof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.EUTRAN_CellDescs.", op_name); } return check_section_is_single(min_size, has_any_or_none, op_name, "a", "template of type @GSM_RestOctets.EUTRAN_CellDescs"); } boolean EUTRAN__CellDescs_template::match(const EUTRAN__CellDescs& 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 @GSM_RestOctets.EUTRAN_CellDescs."); } return FALSE; } boolean EUTRAN__CellDescs_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; } EUTRAN__CellDescs EUTRAN__CellDescs_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @GSM_RestOctets.EUTRAN_CellDescs."); EUTRAN__CellDescs 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; } EUTRAN__CellDescs EUTRAN__CellDescs_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); } EUTRAN__CellDescs EUTRAN__CellDescs_template::replace(int index, int len, const EUTRAN__CellDescs_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()); } EUTRAN__CellDescs EUTRAN__CellDescs_template::replace(int index, int len, const EUTRAN__CellDescs& 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 EUTRAN__CellDescs_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 EUTRAN__CellDescs_template[list_length]; break; default: TTCN_error("Internal error: Setting an invalid type for a template of type @GSM_RestOctets.EUTRAN_CellDescs."); } set_selection(template_type); } EUTRAN__CellDescs_template& EUTRAN__CellDescs_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 @GSM_RestOctets.EUTRAN_CellDescs."); if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of type @GSM_RestOctets.EUTRAN_CellDescs."); return value_list.list_value[list_index]; } void EUTRAN__CellDescs_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 EUTRAN__CellDescs_template::log_match(const EUTRAN__CellDescs& 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 EUTRAN__CellDescs_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 @GSM_RestOctets.EUTRAN_CellDescs."); } } void EUTRAN__CellDescs_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 @GSM_RestOctets.EUTRAN_CellDescs."); single_value.value_elements = (EUTRAN__CellDesc_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 EUTRAN__CellDesc_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 EUTRAN__CellDescs_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 @GSM_RestOctets.EUTRAN_CellDescs."); } } boolean EUTRAN__CellDescs_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean EUTRAN__CellDescs_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iset_implicit_omit(); } } void EUTRAN__CellDescs_template::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_TEMPLATE|Module_Param::BC_LIST, "record of template"); switch (param.get_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { EUTRAN__CellDescs_template temp; temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size()); for (size_t p_i=0; p_iget_id()->get_index())].set_param(*param.get_elem(p_i)); } break; case Module_Param::MP_Value_List: { set_size(param.get_size()); int curr_idx = 0; for (size_t p_i=0; p_iget_type()) { case Module_Param::MP_NotUsed: curr_idx++; break; case Module_Param::MP_Permutation_Template: { int perm_start_idx = curr_idx; Module_Param* param_i = param.get_elem(p_i); for (size_t perm_i=0; perm_iget_size(); perm_i++) { (*this)[curr_idx].set_param(*(param_i->get_elem(perm_i))); curr_idx++; } int perm_end_idx = curr_idx - 1; add_permutation(perm_start_idx, perm_end_idx); } break; default: (*this)[curr_idx].set_param(*param.get_elem(p_i)); curr_idx++; } } } break; case Module_Param::MP_Implication_Template: { EUTRAN__CellDescs_template* precondition = new EUTRAN__CellDescs_template; precondition->set_param(*param.get_elem(0)); EUTRAN__CellDescs_template* implied_template = new EUTRAN__CellDescs_template; implied_template->set_param(*param.get_elem(1)); *this = EUTRAN__CellDescs_template(precondition, implied_template); } break; default: param.type_error("record of template", "@GSM_RestOctets.EUTRAN_CellDescs"); } is_ifpresent = param.get_ifpresent(); set_length_range(param); } void EUTRAN__CellDescs_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 : "@GSM_RestOctets.EUTRAN_CellDescs"); return; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@GSM_RestOctets.EUTRAN_CellDescs"); } boolean EUTRAN__CellDescs_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); } } EUTRAN__CellDesc::EUTRAN__CellDesc() { } EUTRAN__CellDesc::EUTRAN__CellDesc(const BITSTRING& par_item__ind, const INTEGER& par_e__arfcn, const BITSTRING& par_meas__bw__presence, const OPTIONAL< INTEGER >& par_meas__bw) : field_item__ind(par_item__ind), field_e__arfcn(par_e__arfcn), field_meas__bw__presence(par_meas__bw__presence), field_meas__bw(par_meas__bw) { } EUTRAN__CellDesc::EUTRAN__CellDesc(const EUTRAN__CellDesc& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.EUTRAN_CellDesc."); if (other_value.item__ind().is_bound()) field_item__ind = other_value.item__ind(); else field_item__ind.clean_up(); if (other_value.e__arfcn().is_bound()) field_e__arfcn = other_value.e__arfcn(); else field_e__arfcn.clean_up(); if (other_value.meas__bw__presence().is_bound()) field_meas__bw__presence = other_value.meas__bw__presence(); else field_meas__bw__presence.clean_up(); if (other_value.meas__bw().is_bound()) field_meas__bw = other_value.meas__bw(); else field_meas__bw.clean_up(); } void EUTRAN__CellDesc::clean_up() { field_item__ind.clean_up(); field_e__arfcn.clean_up(); field_meas__bw__presence.clean_up(); field_meas__bw.clean_up(); } const TTCN_Typedescriptor_t* EUTRAN__CellDesc::get_descriptor() const { return &EUTRAN__CellDesc_descr_; } EUTRAN__CellDesc& EUTRAN__CellDesc::operator=(const EUTRAN__CellDesc& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.EUTRAN_CellDesc."); if (other_value.item__ind().is_bound()) field_item__ind = other_value.item__ind(); else field_item__ind.clean_up(); if (other_value.e__arfcn().is_bound()) field_e__arfcn = other_value.e__arfcn(); else field_e__arfcn.clean_up(); if (other_value.meas__bw__presence().is_bound()) field_meas__bw__presence = other_value.meas__bw__presence(); else field_meas__bw__presence.clean_up(); if (other_value.meas__bw().is_bound()) field_meas__bw = other_value.meas__bw(); else field_meas__bw.clean_up(); } return *this; } boolean EUTRAN__CellDesc::operator==(const EUTRAN__CellDesc& other_value) const { return field_item__ind==other_value.field_item__ind && field_e__arfcn==other_value.field_e__arfcn && field_meas__bw__presence==other_value.field_meas__bw__presence && field_meas__bw==other_value.field_meas__bw; } boolean EUTRAN__CellDesc::is_bound() const { return (field_item__ind.is_bound()) || (field_e__arfcn.is_bound()) || (field_meas__bw__presence.is_bound()) || (OPTIONAL_OMIT == field_meas__bw.get_selection() || field_meas__bw.is_bound()); } boolean EUTRAN__CellDesc::is_value() const { return field_item__ind.is_value() && field_e__arfcn.is_value() && field_meas__bw__presence.is_value() && (OPTIONAL_OMIT == field_meas__bw.get_selection() || field_meas__bw.is_value()); } int EUTRAN__CellDesc::size_of() const { int ret_val = 3; if (field_meas__bw.ispresent()) ret_val++; return ret_val; } void EUTRAN__CellDesc::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ item_ind := "); field_item__ind.log(); TTCN_Logger::log_event_str(", e_arfcn := "); field_e__arfcn.log(); TTCN_Logger::log_event_str(", meas_bw_presence := "); field_meas__bw__presence.log(); TTCN_Logger::log_event_str(", meas_bw := "); field_meas__bw.log(); TTCN_Logger::log_event_str(" }"); } void EUTRAN__CellDesc::set_implicit_omit() { if (item__ind().is_bound()) item__ind().set_implicit_omit(); if (e__arfcn().is_bound()) e__arfcn().set_implicit_omit(); if (meas__bw__presence().is_bound()) meas__bw__presence().set_implicit_omit(); if (!meas__bw().is_bound()) meas__bw() = OMIT_VALUE; else meas__bw().set_implicit_omit(); } void EUTRAN__CellDesc::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) item__ind().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) e__arfcn().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) meas__bw__presence().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) meas__bw().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(), "item_ind")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { item__ind().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "e_arfcn")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { e__arfcn().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "meas_bw_presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { meas__bw__presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "meas_bw")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { meas__bw().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.EUTRAN_CellDesc: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.EUTRAN_CellDesc"); } } void EUTRAN__CellDesc::encode_text(Text_Buf& text_buf) const { field_item__ind.encode_text(text_buf); field_e__arfcn.encode_text(text_buf); field_meas__bw__presence.encode_text(text_buf); field_meas__bw.encode_text(text_buf); } void EUTRAN__CellDesc::decode_text(Text_Buf& text_buf) { field_item__ind.decode_text(text_buf); field_e__arfcn.decode_text(text_buf); field_meas__bw__presence.decode_text(text_buf); field_meas__bw.decode_text(text_buf); } void EUTRAN__CellDesc::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name); if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); PER_encode(p_td, p_buf, opt); break; } default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void EUTRAN__CellDesc::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name); if(!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); try { PER_decode(p_td, p_buf, opt); p_buf.PER_octet_align(FALSE); } catch (PER_Buffer_Exception) { } break; } default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int EUTRAN__CellDesc::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, EUTRAN__CellDesc_item__ind_descr_.raw->forceomit); decoded_field_length = field_item__ind.RAW_decode(EUTRAN__CellDesc_item__ind_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, EUTRAN__CellDesc_e__arfcn_descr_.raw->forceomit); decoded_field_length = field_e__arfcn.RAW_decode(EUTRAN__CellDesc_e__arfcn_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, EUTRAN__CellDesc_meas__bw__presence_descr_.raw->forceomit); decoded_field_length = field_meas__bw__presence.RAW_decode(EUTRAN__CellDesc_meas__bw__presence_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_2_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); if (limit > 0 && field_meas__bw__presence == bs_0){ if (force_omit != NULL && (*force_omit)(3)) { field_meas__bw = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_3_force_omit(3, force_omit, EUTRAN__CellDesc_meas__bw_descr_.raw->forceomit); decoded_field_length = field_meas__bw().RAW_decode(EUTRAN__CellDesc_meas__bw_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_3_force_omit); if (decoded_field_length < 1) { field_meas__bw = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } else field_meas__bw=OMIT_VALUE; if (field_item__ind != bs_0) return -1; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int EUTRAN__CellDesc::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, EUTRAN__CellDesc_item__ind_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, EUTRAN__CellDesc_e__arfcn_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, EUTRAN__CellDesc_meas__bw__presence_descr_.raw); if (field_meas__bw.ispresent()) { myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, EUTRAN__CellDesc_meas__bw_descr_.raw); } else myleaf.body.node.nodes[3] = NULL; encoded_length += field_item__ind.RAW_encode(EUTRAN__CellDesc_item__ind_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_e__arfcn.RAW_encode(EUTRAN__CellDesc_e__arfcn_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_meas__bw__presence.RAW_encode(EUTRAN__CellDesc_meas__bw__presence_descr_, *myleaf.body.node.nodes[2]); if (field_meas__bw.ispresent()) { encoded_length += field_meas__bw().RAW_encode(EUTRAN__CellDesc_meas__bw_descr_, *myleaf.body.node.nodes[3]); } if (field_meas__bw.ispresent() && (field_meas__bw__presence != bs_0)) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+1; int new_pos0[]={2}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,1,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ bs_0.RAW_encode(EUTRAN__CellDesc_meas__bw__presence_descr_,*temp_leaf); } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_OMITTED_TAG, "Encoding a tagged, but omitted value."); } free_tree_pos(pr_pos0.pos); } } if (field_item__ind != bs_0) { 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){ bs_0.RAW_encode(EUTRAN__CellDesc_item__ind_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 EUTRAN__CellDesc_template::single_value_struct { BITSTRING_template field_item__ind; INTEGER_template field_e__arfcn; BITSTRING_template field_meas__bw__presence; INTEGER_template field_meas__bw; }; void EUTRAN__CellDesc_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_item__ind = ANY_VALUE; single_value->field_e__arfcn = ANY_VALUE; single_value->field_meas__bw__presence = ANY_VALUE; single_value->field_meas__bw = ANY_OR_OMIT; } } } void EUTRAN__CellDesc_template::copy_value(const EUTRAN__CellDesc& other_value) { single_value = new single_value_struct; if (other_value.item__ind().is_bound()) { single_value->field_item__ind = other_value.item__ind(); } else { single_value->field_item__ind.clean_up(); } if (other_value.e__arfcn().is_bound()) { single_value->field_e__arfcn = other_value.e__arfcn(); } else { single_value->field_e__arfcn.clean_up(); } if (other_value.meas__bw__presence().is_bound()) { single_value->field_meas__bw__presence = other_value.meas__bw__presence(); } else { single_value->field_meas__bw__presence.clean_up(); } if (other_value.meas__bw().is_bound()) { if (other_value.meas__bw().ispresent()) single_value->field_meas__bw = other_value.meas__bw()(); else single_value->field_meas__bw = OMIT_VALUE; } else { single_value->field_meas__bw.clean_up(); } set_selection(SPECIFIC_VALUE); } void EUTRAN__CellDesc_template::copy_template(const EUTRAN__CellDesc_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.item__ind().get_selection()) { single_value->field_item__ind = other_value.item__ind(); } else { single_value->field_item__ind.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.e__arfcn().get_selection()) { single_value->field_e__arfcn = other_value.e__arfcn(); } else { single_value->field_e__arfcn.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.meas__bw__presence().get_selection()) { single_value->field_meas__bw__presence = other_value.meas__bw__presence(); } else { single_value->field_meas__bw__presence.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.meas__bw().get_selection()) { single_value->field_meas__bw = other_value.meas__bw(); } else { single_value->field_meas__bw.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 EUTRAN__CellDesc_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 EUTRAN__CellDesc_template(*other_value.implication_.precondition); implication_.implied_template = new EUTRAN__CellDesc_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of type @GSM_RestOctets.EUTRAN_CellDesc."); break; } set_selection(other_value); } EUTRAN__CellDesc_template::EUTRAN__CellDesc_template() { } EUTRAN__CellDesc_template::EUTRAN__CellDesc_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } EUTRAN__CellDesc_template::EUTRAN__CellDesc_template(const EUTRAN__CellDesc& other_value) { copy_value(other_value); } EUTRAN__CellDesc_template::EUTRAN__CellDesc_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const EUTRAN__CellDesc&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.EUTRAN_CellDesc from an unbound optional field."); } } EUTRAN__CellDesc_template::EUTRAN__CellDesc_template(EUTRAN__CellDesc_template* p_precondition, EUTRAN__CellDesc_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } EUTRAN__CellDesc_template::EUTRAN__CellDesc_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; } EUTRAN__CellDesc_template::EUTRAN__CellDesc_template(const EUTRAN__CellDesc_template& other_value) : Base_Template() { copy_template(other_value); } EUTRAN__CellDesc_template::~EUTRAN__CellDesc_template() { clean_up(); } EUTRAN__CellDesc_template& EUTRAN__CellDesc_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } EUTRAN__CellDesc_template& EUTRAN__CellDesc_template::operator=(const EUTRAN__CellDesc& other_value) { clean_up(); copy_value(other_value); return *this; } EUTRAN__CellDesc_template& EUTRAN__CellDesc_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const EUTRAN__CellDesc&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @GSM_RestOctets.EUTRAN_CellDesc."); } return *this; } EUTRAN__CellDesc_template& EUTRAN__CellDesc_template::operator=(const EUTRAN__CellDesc_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean EUTRAN__CellDesc_template::match(const EUTRAN__CellDesc& 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.item__ind().is_bound()) return FALSE; if(!single_value->field_item__ind.match(other_value.item__ind(), legacy))return FALSE; if(!other_value.e__arfcn().is_bound()) return FALSE; if(!single_value->field_e__arfcn.match(other_value.e__arfcn(), legacy))return FALSE; if(!other_value.meas__bw__presence().is_bound()) return FALSE; if(!single_value->field_meas__bw__presence.match(other_value.meas__bw__presence(), legacy))return FALSE; if(!other_value.meas__bw().is_bound()) return FALSE; if((other_value.meas__bw().ispresent() ? !single_value->field_meas__bw.match((const INTEGER&)other_value.meas__bw(), legacy) : !single_value->field_meas__bw.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 @GSM_RestOctets.EUTRAN_CellDesc."); } return FALSE; } boolean EUTRAN__CellDesc_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_item__ind.is_bound() || single_value->field_e__arfcn.is_bound() || single_value->field_meas__bw__presence.is_bound() || (single_value->field_meas__bw.is_omit() || single_value->field_meas__bw.is_bound()); } boolean EUTRAN__CellDesc_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_item__ind.is_value() && single_value->field_e__arfcn.is_value() && single_value->field_meas__bw__presence.is_value() && (single_value->field_meas__bw.is_omit() || single_value->field_meas__bw.is_value()); } void EUTRAN__CellDesc_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; } EUTRAN__CellDesc EUTRAN__CellDesc_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @GSM_RestOctets.EUTRAN_CellDesc."); EUTRAN__CellDesc ret_val; if (single_value->field_item__ind.is_bound()) { ret_val.item__ind() = single_value->field_item__ind.valueof(); } if (single_value->field_e__arfcn.is_bound()) { ret_val.e__arfcn() = single_value->field_e__arfcn.valueof(); } if (single_value->field_meas__bw__presence.is_bound()) { ret_val.meas__bw__presence() = single_value->field_meas__bw__presence.valueof(); } if (single_value->field_meas__bw.is_omit()) ret_val.meas__bw() = OMIT_VALUE; else if (single_value->field_meas__bw.is_bound()) { ret_val.meas__bw() = single_value->field_meas__bw.valueof(); } return ret_val; } void EUTRAN__CellDesc_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list for a template of type @GSM_RestOctets.EUTRAN_CellDesc."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new EUTRAN__CellDesc_template[list_length]; } EUTRAN__CellDesc_template& EUTRAN__CellDesc_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element of a non-list template of type @GSM_RestOctets.EUTRAN_CellDesc."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.EUTRAN_CellDesc."); return value_list.list_value[list_index]; } BITSTRING_template& EUTRAN__CellDesc_template::item__ind() { set_specific(); return single_value->field_item__ind; } const BITSTRING_template& EUTRAN__CellDesc_template::item__ind() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field item_ind of a non-specific template of type @GSM_RestOctets.EUTRAN_CellDesc."); return single_value->field_item__ind; } INTEGER_template& EUTRAN__CellDesc_template::e__arfcn() { set_specific(); return single_value->field_e__arfcn; } const INTEGER_template& EUTRAN__CellDesc_template::e__arfcn() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field e_arfcn of a non-specific template of type @GSM_RestOctets.EUTRAN_CellDesc."); return single_value->field_e__arfcn; } BITSTRING_template& EUTRAN__CellDesc_template::meas__bw__presence() { set_specific(); return single_value->field_meas__bw__presence; } const BITSTRING_template& EUTRAN__CellDesc_template::meas__bw__presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field meas_bw_presence of a non-specific template of type @GSM_RestOctets.EUTRAN_CellDesc."); return single_value->field_meas__bw__presence; } INTEGER_template& EUTRAN__CellDesc_template::meas__bw() { set_specific(); return single_value->field_meas__bw; } const INTEGER_template& EUTRAN__CellDesc_template::meas__bw() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field meas_bw of a non-specific template of type @GSM_RestOctets.EUTRAN_CellDesc."); return single_value->field_meas__bw; } int EUTRAN__CellDesc_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_CellDesc which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 3; if (single_value->field_meas__bw.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 @GSM_RestOctets.EUTRAN_CellDesc containing an empty list."); int item_size = value_list.list_value[0].size_of(); for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++) { if (value_list.list_value[l_idx].size_of()!=item_size) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_CellDesc containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_CellDesc containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_CellDesc containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_CellDesc containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_CellDesc containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_CellDesc containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_CellDesc containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.EUTRAN_CellDesc."); } return 0; } void EUTRAN__CellDesc_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ item_ind := "); single_value->field_item__ind.log(); TTCN_Logger::log_event_str(", e_arfcn := "); single_value->field_e__arfcn.log(); TTCN_Logger::log_event_str(", meas_bw_presence := "); single_value->field_meas__bw__presence.log(); TTCN_Logger::log_event_str(", meas_bw := "); single_value->field_meas__bw.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 EUTRAN__CellDesc_template::log_match(const EUTRAN__CellDesc& 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_item__ind.match(match_value.item__ind(), legacy)){ TTCN_Logger::log_logmatch_info(".item_ind"); single_value->field_item__ind.log_match(match_value.item__ind(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_e__arfcn.match(match_value.e__arfcn(), legacy)){ TTCN_Logger::log_logmatch_info(".e_arfcn"); single_value->field_e__arfcn.log_match(match_value.e__arfcn(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_meas__bw__presence.match(match_value.meas__bw__presence(), legacy)){ TTCN_Logger::log_logmatch_info(".meas_bw_presence"); single_value->field_meas__bw__presence.log_match(match_value.meas__bw__presence(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.meas__bw().ispresent()){ if(!single_value->field_meas__bw.match(match_value.meas__bw(), legacy)){ TTCN_Logger::log_logmatch_info(".meas_bw"); single_value->field_meas__bw.log_match(match_value.meas__bw(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_meas__bw.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".meas_bw := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_meas__bw.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("{ item_ind := "); single_value->field_item__ind.log_match(match_value.item__ind(), legacy); TTCN_Logger::log_event_str(", e_arfcn := "); single_value->field_e__arfcn.log_match(match_value.e__arfcn(), legacy); TTCN_Logger::log_event_str(", meas_bw_presence := "); single_value->field_meas__bw__presence.log_match(match_value.meas__bw__presence(), legacy); TTCN_Logger::log_event_str(", meas_bw := "); if (match_value.meas__bw().ispresent()) { single_value->field_meas__bw.log_match(match_value.meas__bw(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_meas__bw.log(); if (single_value->field_meas__bw.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 EUTRAN__CellDesc_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (item__ind().is_bound()) item__ind().set_implicit_omit(); if (e__arfcn().is_bound()) e__arfcn().set_implicit_omit(); if (meas__bw__presence().is_bound()) meas__bw__presence().set_implicit_omit(); if (!meas__bw().is_bound()) meas__bw() = OMIT_VALUE; else meas__bw().set_implicit_omit(); } void EUTRAN__CellDesc_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_item__ind.encode_text(text_buf); single_value->field_e__arfcn.encode_text(text_buf); single_value->field_meas__bw__presence.encode_text(text_buf); single_value->field_meas__bw.encode_text(text_buf); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @GSM_RestOctets.EUTRAN_CellDesc."); } } void EUTRAN__CellDesc_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_item__ind.decode_text(text_buf); single_value->field_e__arfcn.decode_text(text_buf); single_value->field_meas__bw__presence.decode_text(text_buf); single_value->field_meas__bw.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 EUTRAN__CellDesc_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @GSM_RestOctets.EUTRAN_CellDesc."); } } void EUTRAN__CellDesc_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: { EUTRAN__CellDesc_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) item__ind().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) e__arfcn().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) meas__bw__presence().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) meas__bw().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(), "item_ind")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { item__ind().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "e_arfcn")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { e__arfcn().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "meas_bw_presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { meas__bw__presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "meas_bw")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { meas__bw().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.EUTRAN_CellDesc: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { EUTRAN__CellDesc_template* precondition = new EUTRAN__CellDesc_template; precondition->set_param(*param.get_elem(0)); EUTRAN__CellDesc_template* implied_template = new EUTRAN__CellDesc_template; implied_template->set_param(*param.get_elem(1)); *this = EUTRAN__CellDesc_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.EUTRAN_CellDesc"); } is_ifpresent = param.get_ifpresent(); } void EUTRAN__CellDesc_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_item__ind.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.EUTRAN_CellDesc"); single_value->field_e__arfcn.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.EUTRAN_CellDesc"); single_value->field_meas__bw__presence.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.EUTRAN_CellDesc"); single_value->field_meas__bw.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.EUTRAN_CellDesc"); return; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@GSM_RestOctets.EUTRAN_CellDesc"); } boolean EUTRAN__CellDesc_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean EUTRAN__CellDesc_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; } EUTRAN__RepeatedNotAllowedCells::EUTRAN__RepeatedNotAllowedCells(const EUTRAN__RepeatedNotAllowedCells& other_value) { if (!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells."); val_ptr = other_value.val_ptr; val_ptr->ref_count++; } EUTRAN__RepeatedNotAllowedCells::~EUTRAN__RepeatedNotAllowedCells() { clean_up(); if (val_ptr != NULL) val_ptr = NULL; } void EUTRAN__RepeatedNotAllowedCells::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."); } } EUTRAN__RepeatedNotAllowedCells& EUTRAN__RepeatedNotAllowedCells::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; } EUTRAN__RepeatedNotAllowedCells& EUTRAN__RepeatedNotAllowedCells::operator=(const EUTRAN__RepeatedNotAllowedCells& other_value) { if (other_value.val_ptr == NULL) TTCN_error("Assigning an unbound value of type @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells."); if (this != &other_value) { clean_up(); val_ptr = other_value.val_ptr; val_ptr->ref_count++; } return *this; } boolean EUTRAN__RepeatedNotAllowedCells::operator==(null_type) const { if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells."); return val_ptr->n_elements == 0 ; } boolean EUTRAN__RepeatedNotAllowedCells::operator==(const EUTRAN__RepeatedNotAllowedCells& other_value) const { if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells."); if (other_value.val_ptr == NULL) TTCN_error("The right operand of comparison is an unbound value of type @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells."); 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; } EUTRAN__NotAllowedCells& EUTRAN__RepeatedNotAllowedCells::operator[](int index_value) { if (index_value < 0) TTCN_error("Accessing an element of type @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells 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 = (EUTRAN__NotAllowedCells**)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 EUTRAN__NotAllowedCells(*(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 EUTRAN__NotAllowedCells; } return *val_ptr->value_elements[index_value]; } EUTRAN__NotAllowedCells& EUTRAN__RepeatedNotAllowedCells::operator[](const INTEGER& index_value) { index_value.must_bound("Using an unbound integer value for indexing a value of type @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells."); return (*this)[(int)index_value]; } const EUTRAN__NotAllowedCells& EUTRAN__RepeatedNotAllowedCells::operator[](int index_value) const { if (val_ptr == NULL) TTCN_error("Accessing an element in an unbound value of type @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells."); if (index_value < 0) TTCN_error("Accessing an element of type @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells using a negative index: %d.", index_value); if (index_value >= val_ptr->n_elements) TTCN_error("Index overflow in a value of type @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells: 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 EUTRAN__NotAllowedCells& EUTRAN__RepeatedNotAllowedCells::operator[](const INTEGER& index_value) const { index_value.must_bound("Using an unbound integer value for indexing a value of type @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells."); return (*this)[(int)index_value]; } EUTRAN__RepeatedNotAllowedCells EUTRAN__RepeatedNotAllowedCells::operator<<=(int rotate_count) const { return *this >>= (-rotate_count); } EUTRAN__RepeatedNotAllowedCells EUTRAN__RepeatedNotAllowedCells::operator<<=(const INTEGER& rotate_count) const { rotate_count.must_bound("Unbound integer operand of rotate left operator."); return *this >>= (int)(-rotate_count); } EUTRAN__RepeatedNotAllowedCells EUTRAN__RepeatedNotAllowedCells::operator>>=(const INTEGER& rotate_count) const { rotate_count.must_bound("Unbound integer operand of rotate right operator."); return *this >>= (int)rotate_count; } EUTRAN__RepeatedNotAllowedCells EUTRAN__RepeatedNotAllowedCells::operator>>=(int rotate_count) const { if (val_ptr == NULL) TTCN_error("Performing rotation operation on an unbound value of type @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells."); 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; EUTRAN__RepeatedNotAllowedCells 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 EUTRAN__NotAllowedCells(*val_ptr->value_elements[i]); } } return ret_val; } EUTRAN__RepeatedNotAllowedCells EUTRAN__RepeatedNotAllowedCells::operator+(const EUTRAN__RepeatedNotAllowedCells& other_value) const { if (val_ptr == NULL || other_value.val_ptr == NULL) TTCN_error("Unbound operand of @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells concatenation."); if (val_ptr->n_elements == 0) return other_value; if (other_value.val_ptr->n_elements == 0) return *this; EUTRAN__RepeatedNotAllowedCells 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 EUTRAN__NotAllowedCells(*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 EUTRAN__NotAllowedCells(*other_value.val_ptr->value_elements[i]); } } return ret_val; } EUTRAN__RepeatedNotAllowedCells EUTRAN__RepeatedNotAllowedCells::substr(int index, int returncount) const { if (val_ptr == NULL) TTCN_error("The first argument of substr() is an unbound value of type @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells."); check_substr_arguments(val_ptr->n_elements, index, returncount, "@GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells","element"); EUTRAN__RepeatedNotAllowedCells ret_val; ret_val.set_size(returncount); for (int i=0; ivalue_elements[i+index] != NULL) { ret_val.val_ptr->value_elements[i] = new EUTRAN__NotAllowedCells(*val_ptr->value_elements[i+index]); } } return ret_val; } EUTRAN__RepeatedNotAllowedCells EUTRAN__RepeatedNotAllowedCells::replace(int index, int len, const EUTRAN__RepeatedNotAllowedCells& repl) const { if (val_ptr == NULL) TTCN_error("The first argument of replace() is an unbound value of type @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells."); if (repl.val_ptr == NULL) TTCN_error("The fourth argument of replace() is an unbound value of type @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells."); check_replace_arguments(val_ptr->n_elements, index, len, "@GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells","element"); EUTRAN__RepeatedNotAllowedCells 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 EUTRAN__NotAllowedCells(*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 EUTRAN__NotAllowedCells(*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 EUTRAN__NotAllowedCells(*val_ptr->value_elements[index+i+len]); } } return ret_val; } EUTRAN__RepeatedNotAllowedCells EUTRAN__RepeatedNotAllowedCells::replace(int index, int len, const EUTRAN__RepeatedNotAllowedCells_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 EUTRAN__RepeatedNotAllowedCells::set_size(int new_size) { if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a value of type @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells."); 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 = (EUTRAN__NotAllowedCells**)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 EUTRAN__NotAllowedCells(*(val_ptr->value_elements[elem_count])); } } clean_up(); val_ptr = new_val_ptr; } if (new_size > val_ptr->n_elements) { val_ptr->value_elements = (EUTRAN__NotAllowedCells**)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 @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells: %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 = (EUTRAN__NotAllowedCells**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size); val_ptr->n_elements = new_size; } } boolean EUTRAN__RepeatedNotAllowedCells::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 EUTRAN__RepeatedNotAllowedCells::size_of() const { if (val_ptr == NULL) TTCN_error("Performing sizeof operation on an unbound value of type @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells."); return val_ptr->n_elements; } int EUTRAN__RepeatedNotAllowedCells::lengthof() const { if (val_ptr == NULL) TTCN_error("Performing lengthof operation on an unbound value of type @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells."); 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 EUTRAN__RepeatedNotAllowedCells::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 EUTRAN__RepeatedNotAllowedCells::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 EUTRAN__RepeatedNotAllowedCells::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", "@GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells"); } 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", "@GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells"); } break; default: TTCN_error("Internal error: Unknown operation type."); } } void EUTRAN__RepeatedNotAllowedCells::encode_text(Text_Buf& text_buf) const { if (val_ptr == NULL) TTCN_error("Text encoder: Encoding an unbound value of type @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells."); 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 EUTRAN__RepeatedNotAllowedCells::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 @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells."); val_ptr->value_elements = (EUTRAN__NotAllowedCells**)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 EUTRAN__NotAllowedCells; val_ptr->value_elements[elem_count]->decode_text(text_buf); } } void EUTRAN__RepeatedNotAllowedCells::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name); if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); PER_encode(p_td, p_buf, opt); break; } default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void EUTRAN__RepeatedNotAllowedCells::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name); if(!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); try { PER_decode(p_td, p_buf, opt); p_buf.PER_octet_align(FALSE); } catch (PER_Buffer_Exception) { } break; } default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int EUTRAN__RepeatedNotAllowedCells::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 EUTRAN__RepeatedNotAllowedCells::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 EUTRAN__RepeatedNotAllowedCells_template::copy_value(const EUTRAN__RepeatedNotAllowedCells& other_value) { if (!other_value.is_bound()) TTCN_error("Initialization of a template of type @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells with an unbound value."); single_value.n_elements = other_value.size_of(); single_value.value_elements = (EUTRAN__NotAllowedCells_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 EUTRAN__NotAllowedCells_template(other_value[elem_count]); } else { single_value.value_elements[elem_count] = new EUTRAN__NotAllowedCells_template; } } set_selection(SPECIFIC_VALUE); } void EUTRAN__RepeatedNotAllowedCells_template::copy_template(const EUTRAN__RepeatedNotAllowedCells_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 = (EUTRAN__NotAllowedCells_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 EUTRAN__NotAllowedCells_template(*other_value.single_value.value_elements[elem_count]); } else { single_value.value_elements[elem_count] = new EUTRAN__NotAllowedCells_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 EUTRAN__RepeatedNotAllowedCells_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 EUTRAN__RepeatedNotAllowedCells_template(*other_value.implication_.precondition); implication_.implied_template = new EUTRAN__RepeatedNotAllowedCells_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of type @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells."); break; } set_selection(other_value); } boolean EUTRAN__RepeatedNotAllowedCells_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 EUTRAN__RepeatedNotAllowedCells_template*)template_ptr)->single_value.value_elements[template_index]->match((*(const EUTRAN__RepeatedNotAllowedCells*)value_ptr)[value_index], legacy); else return ((const EUTRAN__RepeatedNotAllowedCells_template*)template_ptr)->single_value.value_elements[template_index]->is_any_or_omit(); } EUTRAN__RepeatedNotAllowedCells_template::EUTRAN__RepeatedNotAllowedCells_template() { } EUTRAN__RepeatedNotAllowedCells_template::EUTRAN__RepeatedNotAllowedCells_template(template_sel other_value) : Base_Record_Of_Template(other_value) { check_single_selection(other_value); } EUTRAN__RepeatedNotAllowedCells_template::EUTRAN__RepeatedNotAllowedCells_template(null_type) : Base_Record_Of_Template(SPECIFIC_VALUE) { single_value.n_elements = 0; single_value.value_elements = NULL; } EUTRAN__RepeatedNotAllowedCells_template::EUTRAN__RepeatedNotAllowedCells_template(const EUTRAN__RepeatedNotAllowedCells& other_value) { copy_value(other_value); } EUTRAN__RepeatedNotAllowedCells_template::EUTRAN__RepeatedNotAllowedCells_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const EUTRAN__RepeatedNotAllowedCells&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells from an unbound optional field."); } } EUTRAN__RepeatedNotAllowedCells_template::EUTRAN__RepeatedNotAllowedCells_template(EUTRAN__RepeatedNotAllowedCells_template* p_precondition, EUTRAN__RepeatedNotAllowedCells_template* p_implied_template) : Base_Record_Of_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } EUTRAN__RepeatedNotAllowedCells_template::EUTRAN__RepeatedNotAllowedCells_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; } EUTRAN__RepeatedNotAllowedCells_template::EUTRAN__RepeatedNotAllowedCells_template(const EUTRAN__RepeatedNotAllowedCells_template& other_value) : Base_Record_Of_Template() { copy_template(other_value); } EUTRAN__RepeatedNotAllowedCells_template::~EUTRAN__RepeatedNotAllowedCells_template() { clean_up(); } void EUTRAN__RepeatedNotAllowedCells_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; } EUTRAN__RepeatedNotAllowedCells_template& EUTRAN__RepeatedNotAllowedCells_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } EUTRAN__RepeatedNotAllowedCells_template& EUTRAN__RepeatedNotAllowedCells_template::operator=(null_type) { clean_up(); set_selection(SPECIFIC_VALUE); single_value.n_elements = 0; single_value.value_elements = NULL; return *this; } EUTRAN__RepeatedNotAllowedCells_template& EUTRAN__RepeatedNotAllowedCells_template::operator=(const EUTRAN__RepeatedNotAllowedCells& other_value) { clean_up(); copy_value(other_value); return *this; } EUTRAN__RepeatedNotAllowedCells_template& EUTRAN__RepeatedNotAllowedCells_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const EUTRAN__RepeatedNotAllowedCells&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells."); } return *this; } EUTRAN__RepeatedNotAllowedCells_template& EUTRAN__RepeatedNotAllowedCells_template::operator=(const EUTRAN__RepeatedNotAllowedCells_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } EUTRAN__NotAllowedCells_template& EUTRAN__RepeatedNotAllowedCells_template::operator[](int index_value) { if (index_value < 0) TTCN_error("Accessing an element of a template for type @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells 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 @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells."); break; } return *single_value.value_elements[index_value]; } EUTRAN__NotAllowedCells_template& EUTRAN__RepeatedNotAllowedCells_template::operator[](const INTEGER& index_value) { index_value.must_bound("Using an unbound integer value for indexing a template of type @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells."); return (*this)[(int)index_value]; } const EUTRAN__NotAllowedCells_template& EUTRAN__RepeatedNotAllowedCells_template::operator[](int index_value) const { if (index_value < 0) TTCN_error("Accessing an element of a template for type @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells using a negative index: %d.", index_value); if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing an element of a non-specific template for type @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells."); if (index_value >= single_value.n_elements) TTCN_error("Index overflow in a template of type @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells: 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 EUTRAN__NotAllowedCells_template& EUTRAN__RepeatedNotAllowedCells_template::operator[](const INTEGER& index_value) const { index_value.must_bound("Using an unbound integer value for indexing a template of type @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells."); return (*this)[(int)index_value]; } void EUTRAN__RepeatedNotAllowedCells_template::set_size(int new_size) { if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a template of type @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells."); 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 = (EUTRAN__NotAllowedCells_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 EUTRAN__NotAllowedCells_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 EUTRAN__NotAllowedCells_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 = (EUTRAN__NotAllowedCells_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size); single_value.n_elements = new_size; } } int EUTRAN__RepeatedNotAllowedCells_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 EUTRAN__RepeatedNotAllowedCells_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 @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells 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 @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells 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 @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells 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 @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells 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 @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells 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 @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells containing complemented list.", op_name); default: TTCN_error("Performing %sof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells.", op_name); } return check_section_is_single(min_size, has_any_or_none, op_name, "a", "template of type @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells"); } boolean EUTRAN__RepeatedNotAllowedCells_template::match(const EUTRAN__RepeatedNotAllowedCells& 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 @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells."); } return FALSE; } boolean EUTRAN__RepeatedNotAllowedCells_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; } EUTRAN__RepeatedNotAllowedCells EUTRAN__RepeatedNotAllowedCells_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells."); EUTRAN__RepeatedNotAllowedCells 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; } EUTRAN__RepeatedNotAllowedCells EUTRAN__RepeatedNotAllowedCells_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); } EUTRAN__RepeatedNotAllowedCells EUTRAN__RepeatedNotAllowedCells_template::replace(int index, int len, const EUTRAN__RepeatedNotAllowedCells_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()); } EUTRAN__RepeatedNotAllowedCells EUTRAN__RepeatedNotAllowedCells_template::replace(int index, int len, const EUTRAN__RepeatedNotAllowedCells& 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 EUTRAN__RepeatedNotAllowedCells_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 EUTRAN__RepeatedNotAllowedCells_template[list_length]; break; default: TTCN_error("Internal error: Setting an invalid type for a template of type @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells."); } set_selection(template_type); } EUTRAN__RepeatedNotAllowedCells_template& EUTRAN__RepeatedNotAllowedCells_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 @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells."); if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of type @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells."); return value_list.list_value[list_index]; } void EUTRAN__RepeatedNotAllowedCells_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 EUTRAN__RepeatedNotAllowedCells_template::log_match(const EUTRAN__RepeatedNotAllowedCells& 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 EUTRAN__RepeatedNotAllowedCells_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 @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells."); } } void EUTRAN__RepeatedNotAllowedCells_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 @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells."); single_value.value_elements = (EUTRAN__NotAllowedCells_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 EUTRAN__NotAllowedCells_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 EUTRAN__RepeatedNotAllowedCells_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 @GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells."); } } boolean EUTRAN__RepeatedNotAllowedCells_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean EUTRAN__RepeatedNotAllowedCells_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iset_implicit_omit(); } } void EUTRAN__RepeatedNotAllowedCells_template::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_TEMPLATE|Module_Param::BC_LIST, "record of template"); switch (param.get_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { EUTRAN__RepeatedNotAllowedCells_template temp; temp.set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (param.get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), param.get_size()); for (size_t p_i=0; p_iget_id()->get_index())].set_param(*param.get_elem(p_i)); } break; case Module_Param::MP_Value_List: { set_size(param.get_size()); int curr_idx = 0; for (size_t p_i=0; p_iget_type()) { case Module_Param::MP_NotUsed: curr_idx++; break; case Module_Param::MP_Permutation_Template: { int perm_start_idx = curr_idx; Module_Param* param_i = param.get_elem(p_i); for (size_t perm_i=0; perm_iget_size(); perm_i++) { (*this)[curr_idx].set_param(*(param_i->get_elem(perm_i))); curr_idx++; } int perm_end_idx = curr_idx - 1; add_permutation(perm_start_idx, perm_end_idx); } break; default: (*this)[curr_idx].set_param(*param.get_elem(p_i)); curr_idx++; } } } break; case Module_Param::MP_Implication_Template: { EUTRAN__RepeatedNotAllowedCells_template* precondition = new EUTRAN__RepeatedNotAllowedCells_template; precondition->set_param(*param.get_elem(0)); EUTRAN__RepeatedNotAllowedCells_template* implied_template = new EUTRAN__RepeatedNotAllowedCells_template; implied_template->set_param(*param.get_elem(1)); *this = EUTRAN__RepeatedNotAllowedCells_template(precondition, implied_template); } break; default: param.type_error("record of template", "@GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells"); } is_ifpresent = param.get_ifpresent(); set_length_range(param); } void EUTRAN__RepeatedNotAllowedCells_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 : "@GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells"); return; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@GSM_RestOctets.EUTRAN_RepeatedNotAllowedCells"); } boolean EUTRAN__RepeatedNotAllowedCells_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); } } EUTRAN__NotAllowedCells::EUTRAN__NotAllowedCells() { } EUTRAN__NotAllowedCells::EUTRAN__NotAllowedCells(const BITSTRING& par_item__ind, const BITSTRING& par_pcid__group__presence, const OPTIONAL< EUTRAN__FreqIndexes >& par_freq__idx__list, const BITSTRING& par_freq__idx__list__term) : field_item__ind(par_item__ind), field_pcid__group__presence(par_pcid__group__presence), field_freq__idx__list(par_freq__idx__list), field_freq__idx__list__term(par_freq__idx__list__term) { } EUTRAN__NotAllowedCells::EUTRAN__NotAllowedCells(const EUTRAN__NotAllowedCells& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.EUTRAN_NotAllowedCells."); if (other_value.item__ind().is_bound()) field_item__ind = other_value.item__ind(); else field_item__ind.clean_up(); if (other_value.pcid__group__presence().is_bound()) field_pcid__group__presence = other_value.pcid__group__presence(); else field_pcid__group__presence.clean_up(); if (other_value.freq__idx__list().is_bound()) field_freq__idx__list = other_value.freq__idx__list(); else field_freq__idx__list.clean_up(); if (other_value.freq__idx__list__term().is_bound()) field_freq__idx__list__term = other_value.freq__idx__list__term(); else field_freq__idx__list__term.clean_up(); } void EUTRAN__NotAllowedCells::clean_up() { field_item__ind.clean_up(); field_pcid__group__presence.clean_up(); field_freq__idx__list.clean_up(); field_freq__idx__list__term.clean_up(); } const TTCN_Typedescriptor_t* EUTRAN__NotAllowedCells::get_descriptor() const { return &EUTRAN__NotAllowedCells_descr_; } EUTRAN__NotAllowedCells& EUTRAN__NotAllowedCells::operator=(const EUTRAN__NotAllowedCells& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.EUTRAN_NotAllowedCells."); if (other_value.item__ind().is_bound()) field_item__ind = other_value.item__ind(); else field_item__ind.clean_up(); if (other_value.pcid__group__presence().is_bound()) field_pcid__group__presence = other_value.pcid__group__presence(); else field_pcid__group__presence.clean_up(); if (other_value.freq__idx__list().is_bound()) field_freq__idx__list = other_value.freq__idx__list(); else field_freq__idx__list.clean_up(); if (other_value.freq__idx__list__term().is_bound()) field_freq__idx__list__term = other_value.freq__idx__list__term(); else field_freq__idx__list__term.clean_up(); } return *this; } boolean EUTRAN__NotAllowedCells::operator==(const EUTRAN__NotAllowedCells& other_value) const { return field_item__ind==other_value.field_item__ind && field_pcid__group__presence==other_value.field_pcid__group__presence && field_freq__idx__list==other_value.field_freq__idx__list && field_freq__idx__list__term==other_value.field_freq__idx__list__term; } boolean EUTRAN__NotAllowedCells::is_bound() const { return (field_item__ind.is_bound()) || (field_pcid__group__presence.is_bound()) || (OPTIONAL_OMIT == field_freq__idx__list.get_selection() || field_freq__idx__list.is_bound()) || (field_freq__idx__list__term.is_bound()); } boolean EUTRAN__NotAllowedCells::is_value() const { return field_item__ind.is_value() && field_pcid__group__presence.is_value() && (OPTIONAL_OMIT == field_freq__idx__list.get_selection() || field_freq__idx__list.is_value()) && field_freq__idx__list__term.is_value(); } int EUTRAN__NotAllowedCells::size_of() const { int ret_val = 3; if (field_freq__idx__list.ispresent()) ret_val++; return ret_val; } void EUTRAN__NotAllowedCells::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ item_ind := "); field_item__ind.log(); TTCN_Logger::log_event_str(", pcid_group_presence := "); field_pcid__group__presence.log(); TTCN_Logger::log_event_str(", freq_idx_list := "); field_freq__idx__list.log(); TTCN_Logger::log_event_str(", freq_idx_list_term := "); field_freq__idx__list__term.log(); TTCN_Logger::log_event_str(" }"); } void EUTRAN__NotAllowedCells::set_implicit_omit() { if (item__ind().is_bound()) item__ind().set_implicit_omit(); if (pcid__group__presence().is_bound()) pcid__group__presence().set_implicit_omit(); if (!freq__idx__list().is_bound()) freq__idx__list() = OMIT_VALUE; else freq__idx__list().set_implicit_omit(); if (freq__idx__list__term().is_bound()) freq__idx__list__term().set_implicit_omit(); } void EUTRAN__NotAllowedCells::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) item__ind().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) pcid__group__presence().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) freq__idx__list().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) freq__idx__list__term().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(), "item_ind")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { item__ind().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "pcid_group_presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { pcid__group__presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "freq_idx_list")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { freq__idx__list().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "freq_idx_list_term")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { freq__idx__list__term().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.EUTRAN_NotAllowedCells: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.EUTRAN_NotAllowedCells"); } } void EUTRAN__NotAllowedCells::encode_text(Text_Buf& text_buf) const { field_item__ind.encode_text(text_buf); field_pcid__group__presence.encode_text(text_buf); field_freq__idx__list.encode_text(text_buf); field_freq__idx__list__term.encode_text(text_buf); } void EUTRAN__NotAllowedCells::decode_text(Text_Buf& text_buf) { field_item__ind.decode_text(text_buf); field_pcid__group__presence.decode_text(text_buf); field_freq__idx__list.decode_text(text_buf); field_freq__idx__list__term.decode_text(text_buf); } void EUTRAN__NotAllowedCells::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(FALSE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-encoding type '%s': ", p_td.name); if (!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); PER_encode(p_td, p_buf, opt); break; } default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void EUTRAN__NotAllowedCells::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} case TTCN_EncDec::CT_PER: { TTCN_EncDec_ErrorContext ec("While PER-decoding type '%s': ", p_td.name); if(!p_td.per) TTCN_EncDec_ErrorContext::error_internal( "No PER descriptor available for type '%s'.", p_td.name); int opt = va_arg(pvar, int); try { PER_decode(p_td, p_buf, opt); p_buf.PER_octet_align(FALSE); } catch (PER_Buffer_Exception) { } break; } default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int EUTRAN__NotAllowedCells::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, EUTRAN__NotAllowedCells_item__ind_descr_.raw->forceomit); decoded_field_length = field_item__ind.RAW_decode(EUTRAN__NotAllowedCells_item__ind_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, EUTRAN__NotAllowedCells_pcid__group__presence_descr_.raw->forceomit); decoded_field_length = field_pcid__group__presence.RAW_decode(EUTRAN__NotAllowedCells_pcid__group__presence_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); if (limit > 0){ if (force_omit != NULL && (*force_omit)(2)) { field_freq__idx__list = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_2_force_omit(2, force_omit, EUTRAN__NotAllowedCells_freq__idx__list_descr_.raw->forceomit); decoded_field_length = field_freq__idx__list().RAW_decode(EUTRAN__NotAllowedCells_freq__idx__list_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_2_force_omit); if (decoded_field_length < 1) { field_freq__idx__list = OMIT_VALUE; p_buf.set_pos_bit(fl_start_pos); } else { decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); } } } else field_freq__idx__list=OMIT_VALUE; RAW_Force_Omit field_3_force_omit(3, force_omit, EUTRAN__NotAllowedCells_freq__idx__list__term_descr_.raw->forceomit); decoded_field_length = field_freq__idx__list__term.RAW_decode(EUTRAN__NotAllowedCells_freq__idx__list__term_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_3_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); if (field_item__ind != bs_0) return -1; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int EUTRAN__NotAllowedCells::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, EUTRAN__NotAllowedCells_item__ind_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, EUTRAN__NotAllowedCells_pcid__group__presence_descr_.raw); if (field_freq__idx__list.ispresent()) { myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, EUTRAN__NotAllowedCells_freq__idx__list_descr_.raw); } else myleaf.body.node.nodes[2] = NULL; myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, EUTRAN__NotAllowedCells_freq__idx__list__term_descr_.raw); encoded_length += field_item__ind.RAW_encode(EUTRAN__NotAllowedCells_item__ind_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_pcid__group__presence.RAW_encode(EUTRAN__NotAllowedCells_pcid__group__presence_descr_, *myleaf.body.node.nodes[1]); if (field_freq__idx__list.ispresent()) { encoded_length += field_freq__idx__list().RAW_encode(EUTRAN__NotAllowedCells_freq__idx__list_descr_, *myleaf.body.node.nodes[2]); } encoded_length += field_freq__idx__list__term.RAW_encode(EUTRAN__NotAllowedCells_freq__idx__list__term_descr_, *myleaf.body.node.nodes[3]); if (field_item__ind != bs_0) { 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){ bs_0.RAW_encode(EUTRAN__NotAllowedCells_item__ind_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 EUTRAN__NotAllowedCells_template::single_value_struct { BITSTRING_template field_item__ind; BITSTRING_template field_pcid__group__presence; EUTRAN__FreqIndexes_template field_freq__idx__list; BITSTRING_template field_freq__idx__list__term; }; void EUTRAN__NotAllowedCells_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_item__ind = ANY_VALUE; single_value->field_pcid__group__presence = ANY_VALUE; single_value->field_freq__idx__list = ANY_OR_OMIT; single_value->field_freq__idx__list__term = ANY_VALUE; } } } void EUTRAN__NotAllowedCells_template::copy_value(const EUTRAN__NotAllowedCells& other_value) { single_value = new single_value_struct; if (other_value.item__ind().is_bound()) { single_value->field_item__ind = other_value.item__ind(); } else { single_value->field_item__ind.clean_up(); } if (other_value.pcid__group__presence().is_bound()) { single_value->field_pcid__group__presence = other_value.pcid__group__presence(); } else { single_value->field_pcid__group__presence.clean_up(); } if (other_value.freq__idx__list().is_bound()) { if (other_value.freq__idx__list().ispresent()) single_value->field_freq__idx__list = other_value.freq__idx__list()(); else single_value->field_freq__idx__list = OMIT_VALUE; } else { single_value->field_freq__idx__list.clean_up(); } if (other_value.freq__idx__list__term().is_bound()) { single_value->field_freq__idx__list__term = other_value.freq__idx__list__term(); } else { single_value->field_freq__idx__list__term.clean_up(); } set_selection(SPECIFIC_VALUE); } void EUTRAN__NotAllowedCells_template::copy_template(const EUTRAN__NotAllowedCells_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.item__ind().get_selection()) { single_value->field_item__ind = other_value.item__ind(); } else { single_value->field_item__ind.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.pcid__group__presence().get_selection()) { single_value->field_pcid__group__presence = other_value.pcid__group__presence(); } else { single_value->field_pcid__group__presence.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.freq__idx__list().get_selection()) { single_value->field_freq__idx__list = other_value.freq__idx__list(); } else { single_value->field_freq__idx__list.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.freq__idx__list__term().get_selection()) { single_value->field_freq__idx__list__term = other_value.freq__idx__list__term(); } else { single_value->field_freq__idx__list__term.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 EUTRAN__NotAllowedCells_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 EUTRAN__NotAllowedCells_template(*other_value.implication_.precondition); implication_.implied_template = new EUTRAN__NotAllowedCells_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of type @GSM_RestOctets.EUTRAN_NotAllowedCells."); break; } set_selection(other_value); } EUTRAN__NotAllowedCells_template::EUTRAN__NotAllowedCells_template() { } EUTRAN__NotAllowedCells_template::EUTRAN__NotAllowedCells_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } EUTRAN__NotAllowedCells_template::EUTRAN__NotAllowedCells_template(const EUTRAN__NotAllowedCells& other_value) { copy_value(other_value); } EUTRAN__NotAllowedCells_template::EUTRAN__NotAllowedCells_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const EUTRAN__NotAllowedCells&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.EUTRAN_NotAllowedCells from an unbound optional field."); } } EUTRAN__NotAllowedCells_template::EUTRAN__NotAllowedCells_template(EUTRAN__NotAllowedCells_template* p_precondition, EUTRAN__NotAllowedCells_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } EUTRAN__NotAllowedCells_template::EUTRAN__NotAllowedCells_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; } EUTRAN__NotAllowedCells_template::EUTRAN__NotAllowedCells_template(const EUTRAN__NotAllowedCells_template& other_value) : Base_Template() { copy_template(other_value); } EUTRAN__NotAllowedCells_template::~EUTRAN__NotAllowedCells_template() { clean_up(); } EUTRAN__NotAllowedCells_template& EUTRAN__NotAllowedCells_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } EUTRAN__NotAllowedCells_template& EUTRAN__NotAllowedCells_template::operator=(const EUTRAN__NotAllowedCells& other_value) { clean_up(); copy_value(other_value); return *this; } EUTRAN__NotAllowedCells_template& EUTRAN__NotAllowedCells_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const EUTRAN__NotAllowedCells&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of type @GSM_RestOctets.EUTRAN_NotAllowedCells."); } return *this; } EUTRAN__NotAllowedCells_template& EUTRAN__NotAllowedCells_template::operator=(const EUTRAN__NotAllowedCells_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean EUTRAN__NotAllowedCells_template::match(const EUTRAN__NotAllowedCells& 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.item__ind().is_bound()) return FALSE; if(!single_value->field_item__ind.match(other_value.item__ind(), legacy))return FALSE; if(!other_value.pcid__group__presence().is_bound()) return FALSE; if(!single_value->field_pcid__group__presence.match(other_value.pcid__group__presence(), legacy))return FALSE; if(!other_value.freq__idx__list().is_bound()) return FALSE; if((other_value.freq__idx__list().ispresent() ? !single_value->field_freq__idx__list.match((const EUTRAN__FreqIndexes&)other_value.freq__idx__list(), legacy) : !single_value->field_freq__idx__list.match_omit(legacy)))return FALSE; if(!other_value.freq__idx__list__term().is_bound()) return FALSE; if(!single_value->field_freq__idx__list__term.match(other_value.freq__idx__list__term(), legacy))return FALSE; return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of type @GSM_RestOctets.EUTRAN_NotAllowedCells."); } return FALSE; } boolean EUTRAN__NotAllowedCells_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_item__ind.is_bound() || single_value->field_pcid__group__presence.is_bound() || (single_value->field_freq__idx__list.is_omit() || single_value->field_freq__idx__list.is_bound()) || single_value->field_freq__idx__list__term.is_bound(); } boolean EUTRAN__NotAllowedCells_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_item__ind.is_value() && single_value->field_pcid__group__presence.is_value() && (single_value->field_freq__idx__list.is_omit() || single_value->field_freq__idx__list.is_value()) && single_value->field_freq__idx__list__term.is_value(); } void EUTRAN__NotAllowedCells_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; } EUTRAN__NotAllowedCells EUTRAN__NotAllowedCells_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of type @GSM_RestOctets.EUTRAN_NotAllowedCells."); EUTRAN__NotAllowedCells ret_val; if (single_value->field_item__ind.is_bound()) { ret_val.item__ind() = single_value->field_item__ind.valueof(); } if (single_value->field_pcid__group__presence.is_bound()) { ret_val.pcid__group__presence() = single_value->field_pcid__group__presence.valueof(); } if (single_value->field_freq__idx__list.is_omit()) ret_val.freq__idx__list() = OMIT_VALUE; else if (single_value->field_freq__idx__list.is_bound()) { ret_val.freq__idx__list() = single_value->field_freq__idx__list.valueof(); } if (single_value->field_freq__idx__list__term.is_bound()) { ret_val.freq__idx__list__term() = single_value->field_freq__idx__list__term.valueof(); } return ret_val; } void EUTRAN__NotAllowedCells_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST&& template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list for a template of type @GSM_RestOctets.EUTRAN_NotAllowedCells."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new EUTRAN__NotAllowedCells_template[list_length]; } EUTRAN__NotAllowedCells_template& EUTRAN__NotAllowedCells_template::list_item(unsigned int list_index) const { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST&& template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element of a non-list template of type @GSM_RestOctets.EUTRAN_NotAllowedCells."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.EUTRAN_NotAllowedCells."); return value_list.list_value[list_index]; } BITSTRING_template& EUTRAN__NotAllowedCells_template::item__ind() { set_specific(); return single_value->field_item__ind; } const BITSTRING_template& EUTRAN__NotAllowedCells_template::item__ind() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field item_ind of a non-specific template of type @GSM_RestOctets.EUTRAN_NotAllowedCells."); return single_value->field_item__ind; } BITSTRING_template& EUTRAN__NotAllowedCells_template::pcid__group__presence() { set_specific(); return single_value->field_pcid__group__presence; } const BITSTRING_template& EUTRAN__NotAllowedCells_template::pcid__group__presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field pcid_group_presence of a non-specific template of type @GSM_RestOctets.EUTRAN_NotAllowedCells."); return single_value->field_pcid__group__presence; } EUTRAN__FreqIndexes_template& EUTRAN__NotAllowedCells_template::freq__idx__list() { set_specific(); return single_value->field_freq__idx__list; } const EUTRAN__FreqIndexes_template& EUTRAN__NotAllowedCells_template::freq__idx__list() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field freq_idx_list of a non-specific template of type @GSM_RestOctets.EUTRAN_NotAllowedCells."); return single_value->field_freq__idx__list; } BITSTRING_template& EUTRAN__NotAllowedCells_template::freq__idx__list__term() { set_specific(); return single_value->field_freq__idx__list__term; } const BITSTRING_template& EUTRAN__NotAllowedCells_template::freq__idx__list__term() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field freq_idx_list_term of a non-specific template of type @GSM_RestOctets.EUTRAN_NotAllowedCells."); return single_value->field_freq__idx__list__term; } int EUTRAN__NotAllowedCells_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_NotAllowedCells which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 3; if (single_value->field_freq__idx__list.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 @GSM_RestOctets.EUTRAN_NotAllowedCells containing an empty list."); int item_size = value_list.list_value[0].size_of(); for (unsigned int l_idx = 1; l_idx < value_list.n_values; l_idx++) { if (value_list.list_value[l_idx].size_of()!=item_size) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_NotAllowedCells containing a value list with different sizes."); } return item_size; } case OMIT_VALUE: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_NotAllowedCells containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_NotAllowedCells containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_NotAllowedCells containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_NotAllowedCells containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_NotAllowedCells containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_NotAllowedCells containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.EUTRAN_NotAllowedCells."); } return 0; } void EUTRAN__NotAllowedCells_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ item_ind := "); single_value->field_item__ind.log(); TTCN_Logger::log_event_str(", pcid_group_presence := "); single_value->field_pcid__group__presence.log(); TTCN_Logger::log_event_str(", freq_idx_list := "); single_value->field_freq__idx__list.log(); TTCN_Logger::log_event_str(", freq_idx_list_term := "); single_value->field_freq__idx__list__term.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 EUTRAN__NotAllowedCells_template::log_match(const EUTRAN__NotAllowedCells& 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_item__ind.match(match_value.item__ind(), legacy)){ TTCN_Logger::log_logmatch_info(".item_ind"); single_value->field_item__ind.log_match(match_value.item__ind(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_pcid__group__presence.match(match_value.pcid__group__presence(), legacy)){ TTCN_Logger::log_logmatch_info(".pcid_group_presence"); single_value->field_pcid__group__presence.log_match(match_value.pcid__group__presence(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.freq__idx__list().ispresent()){ if(!single_value->field_freq__idx__list.match(match_value.freq__idx__list(), legacy)){ TTCN_Logger::log_logmatch_info(".freq_idx_list"); single_value->field_freq__idx__list.log_match(match_value.freq__idx__list(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_freq__idx__list.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".freq_idx_list := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_freq__idx__list.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if(!single_value->field_freq__idx__list__term.match(match_value.freq__idx__list__term(), legacy)){ TTCN_Logger::log_logmatch_info(".freq_idx_list_term"); single_value->field_freq__idx__list__term.log_match(match_value.freq__idx__list__term(), 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("{ item_ind := "); single_value->field_item__ind.log_match(match_value.item__ind(), legacy); TTCN_Logger::log_event_str(", pcid_group_presence := "); single_value->field_pcid__group__presence.log_match(match_value.pcid__group__presence(), legacy); TTCN_Logger::log_event_str(", freq_idx_list := "); if (match_value.freq__idx__list().ispresent()) { single_value->field_freq__idx__list.log_match(match_value.freq__idx__list(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_freq__idx__list.log(); if (single_value->field_freq__idx__list.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", freq_idx_list_term := "); single_value->field_freq__idx__list__term.log_match(match_value.freq__idx__list__term(), 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 EUTRAN__NotAllowedCells_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (item__ind().is_bound()) item__ind().set_implicit_omit(); if (pcid__group__presence().is_bound()) pcid__group__presence().set_implicit_omit(); if (!freq__idx__list().is_bound()) freq__idx__list() = OMIT_VALUE; else freq__idx__list().set_implicit_omit(); if (freq__idx__list__term().is_bound()) freq__idx__list__term().set_implicit_omit(); } void EUTRAN__NotAllowedCells_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_item__ind.encode_text(text_buf); single_value->field_pcid__group__presence.encode_text(text_buf); single_value->field_freq__idx__list.encode_text(text_buf); single_value->field_freq__idx__list__term.encode_text(text_buf); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of type @GSM_RestOctets.EUTRAN_NotAllowedCells."); } } void EUTRAN__NotAllowedCells_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_item__ind.decode_text(text_buf); single_value->field_pcid__group__presence.decode_text(text_buf); single_value->field_freq__idx__list.decode_text(text_buf); single_value->field_freq__idx__list__term.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 EUTRAN__NotAllowedCells_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received in a template of type @GSM_RestOctets.EUTRAN_NotAllowedCells."); } } void EUTRAN__NotAllowedCells_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: { EUTRAN__NotAllowedCells_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) item__ind().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) pcid__group__presence().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) freq__idx__list().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) freq__idx__list__term().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(), "item_ind")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { item__ind().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "pcid_group_presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { pcid__group__presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "freq_idx_list")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { freq__idx__list().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "freq_idx_list_term")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { freq__idx__list__term().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxerror("Non existent field name in type @GSM_RestOctets.EUTRAN_NotAllowedCells: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { EUTRAN__NotAllowedCells_template* precondition = new EUTRAN__NotAllowedCells_template; precondition->set_param(*param.get_elem(0)); EUTRAN__NotAllowedCells_template* implied_template = new EUTRAN__NotAllowedCells_template; implied_template->set_param(*param.get_elem(1)); *this = EUTRAN__NotAllowedCells_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.EUTRAN_NotAllowedCells"); } is_ifpresent = param.get_ifpresent(); } void EUTRAN__NotAllowedCells_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_item__ind.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.EUTRAN_NotAllowedCells"); single_value->field_pcid__group__presence.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.EUTRAN_NotAllowedCells"); single_value->field_freq__idx__list.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.EUTRAN_NotAllowedCells"); single_value->field_freq__idx__list__term.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.EUTRAN_NotAllowedCells"); return; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@GSM_RestOctets.EUTRAN_NotAllowedCells"); } boolean EUTRAN__NotAllowedCells_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean EUTRAN__NotAllowedCells_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