// 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 */ const EUTRAN__FreqIndex EUTRAN__FreqIndexes::UNBOUND_ELEM; EUTRAN__FreqIndexes::EUTRAN__FreqIndexes() { val_ptr = NULL; } EUTRAN__FreqIndexes::EUTRAN__FreqIndexes(null_type) { val_ptr = new recordof_setof_struct; val_ptr->ref_count = 1; val_ptr->n_elements = 0; val_ptr->value_elements = NULL; } EUTRAN__FreqIndexes::EUTRAN__FreqIndexes(const EUTRAN__FreqIndexes& other_value) { if (!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.EUTRAN_FreqIndexes."); val_ptr = other_value.val_ptr; val_ptr->ref_count++; } EUTRAN__FreqIndexes::~EUTRAN__FreqIndexes() { clean_up(); if (val_ptr != NULL) val_ptr = NULL; } void EUTRAN__FreqIndexes::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__FreqIndexes& EUTRAN__FreqIndexes::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__FreqIndexes& EUTRAN__FreqIndexes::operator=(const EUTRAN__FreqIndexes& other_value) { if (other_value.val_ptr == NULL) TTCN_error("Assigning an unbound value of type @GSM_RestOctets.EUTRAN_FreqIndexes."); if (this != &other_value) { clean_up(); val_ptr = other_value.val_ptr; val_ptr->ref_count++; } return *this; } boolean EUTRAN__FreqIndexes::operator==(null_type) const { if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @GSM_RestOctets.EUTRAN_FreqIndexes."); return val_ptr->n_elements == 0 ; } boolean EUTRAN__FreqIndexes::operator==(const EUTRAN__FreqIndexes& other_value) const { if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @GSM_RestOctets.EUTRAN_FreqIndexes."); if (other_value.val_ptr == NULL) TTCN_error("The right operand of comparison is an unbound value of type @GSM_RestOctets.EUTRAN_FreqIndexes."); 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__FreqIndex& EUTRAN__FreqIndexes::operator[](int index_value) { if (index_value < 0) TTCN_error("Accessing an element of type @GSM_RestOctets.EUTRAN_FreqIndexes 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__FreqIndex**)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__FreqIndex(*(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__FreqIndex; } return *val_ptr->value_elements[index_value]; } EUTRAN__FreqIndex& EUTRAN__FreqIndexes::operator[](const INTEGER& index_value) { index_value.must_bound("Using an unbound integer value for indexing a value of type @GSM_RestOctets.EUTRAN_FreqIndexes."); return (*this)[(int)index_value]; } const EUTRAN__FreqIndex& EUTRAN__FreqIndexes::operator[](int index_value) const { if (val_ptr == NULL) TTCN_error("Accessing an element in an unbound value of type @GSM_RestOctets.EUTRAN_FreqIndexes."); if (index_value < 0) TTCN_error("Accessing an element of type @GSM_RestOctets.EUTRAN_FreqIndexes 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_FreqIndexes: 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__FreqIndex& EUTRAN__FreqIndexes::operator[](const INTEGER& index_value) const { index_value.must_bound("Using an unbound integer value for indexing a value of type @GSM_RestOctets.EUTRAN_FreqIndexes."); return (*this)[(int)index_value]; } EUTRAN__FreqIndexes EUTRAN__FreqIndexes::operator<<=(int rotate_count) const { return *this >>= (-rotate_count); } EUTRAN__FreqIndexes EUTRAN__FreqIndexes::operator<<=(const INTEGER& rotate_count) const { rotate_count.must_bound("Unbound integer operand of rotate left operator."); return *this >>= (int)(-rotate_count); } EUTRAN__FreqIndexes EUTRAN__FreqIndexes::operator>>=(const INTEGER& rotate_count) const { rotate_count.must_bound("Unbound integer operand of rotate right operator."); return *this >>= (int)rotate_count; } EUTRAN__FreqIndexes EUTRAN__FreqIndexes::operator>>=(int rotate_count) const { if (val_ptr == NULL) TTCN_error("Performing rotation operation on an unbound value of type @GSM_RestOctets.EUTRAN_FreqIndexes."); 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__FreqIndexes 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__FreqIndex(*val_ptr->value_elements[i]); } } return ret_val; } EUTRAN__FreqIndexes EUTRAN__FreqIndexes::operator+(const EUTRAN__FreqIndexes& other_value) const { if (val_ptr == NULL || other_value.val_ptr == NULL) TTCN_error("Unbound operand of @GSM_RestOctets.EUTRAN_FreqIndexes concatenation."); if (val_ptr->n_elements == 0) return other_value; if (other_value.val_ptr->n_elements == 0) return *this; EUTRAN__FreqIndexes 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__FreqIndex(*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__FreqIndex(*other_value.val_ptr->value_elements[i]); } } return ret_val; } EUTRAN__FreqIndexes EUTRAN__FreqIndexes::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_FreqIndexes."); check_substr_arguments(val_ptr->n_elements, index, returncount, "@GSM_RestOctets.EUTRAN_FreqIndexes","element"); EUTRAN__FreqIndexes 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__FreqIndex(*val_ptr->value_elements[i+index]); } } return ret_val; } EUTRAN__FreqIndexes EUTRAN__FreqIndexes::replace(int index, int len, const EUTRAN__FreqIndexes& repl) const { if (val_ptr == NULL) TTCN_error("The first argument of replace() is an unbound value of type @GSM_RestOctets.EUTRAN_FreqIndexes."); if (repl.val_ptr == NULL) TTCN_error("The fourth argument of replace() is an unbound value of type @GSM_RestOctets.EUTRAN_FreqIndexes."); check_replace_arguments(val_ptr->n_elements, index, len, "@GSM_RestOctets.EUTRAN_FreqIndexes","element"); EUTRAN__FreqIndexes 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__FreqIndex(*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__FreqIndex(*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__FreqIndex(*val_ptr->value_elements[index+i+len]); } } return ret_val; } EUTRAN__FreqIndexes EUTRAN__FreqIndexes::replace(int index, int len, const EUTRAN__FreqIndexes_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__FreqIndexes::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_FreqIndexes."); 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__FreqIndex**)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__FreqIndex(*(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__FreqIndex**)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_FreqIndexes: %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__FreqIndex**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size); val_ptr->n_elements = new_size; } } boolean EUTRAN__FreqIndexes::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__FreqIndexes::size_of() const { if (val_ptr == NULL) TTCN_error("Performing sizeof operation on an unbound value of type @GSM_RestOctets.EUTRAN_FreqIndexes."); return val_ptr->n_elements; } int EUTRAN__FreqIndexes::lengthof() const { if (val_ptr == NULL) TTCN_error("Performing lengthof operation on an unbound value of type @GSM_RestOctets.EUTRAN_FreqIndexes."); 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__FreqIndexes::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__FreqIndexes::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__FreqIndexes::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_FreqIndexes"); } 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_FreqIndexes"); } break; default: TTCN_error("Internal error: Unknown operation type."); } } void EUTRAN__FreqIndexes::encode_text(Text_Buf& text_buf) const { if (val_ptr == NULL) TTCN_error("Text encoder: Encoding an unbound value of type @GSM_RestOctets.EUTRAN_FreqIndexes."); 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__FreqIndexes::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_FreqIndexes."); val_ptr->value_elements = (EUTRAN__FreqIndex**)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__FreqIndex; val_ptr->value_elements[elem_count]->decode_text(text_buf); } } void EUTRAN__FreqIndexes::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__FreqIndexes::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__FreqIndexes::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__FreqIndexes::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__FreqIndexes_template::copy_value(const EUTRAN__FreqIndexes& other_value) { if (!other_value.is_bound()) TTCN_error("Initialization of a template of type @GSM_RestOctets.EUTRAN_FreqIndexes with an unbound value."); single_value.n_elements = other_value.size_of(); single_value.value_elements = (EUTRAN__FreqIndex_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__FreqIndex_template(other_value[elem_count]); } else { single_value.value_elements[elem_count] = new EUTRAN__FreqIndex_template; } } set_selection(SPECIFIC_VALUE); } void EUTRAN__FreqIndexes_template::copy_template(const EUTRAN__FreqIndexes_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__FreqIndex_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__FreqIndex_template(*other_value.single_value.value_elements[elem_count]); } else { single_value.value_elements[elem_count] = new EUTRAN__FreqIndex_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__FreqIndexes_template[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__FreqIndexes_template(*other_value.implication_.precondition); implication_.implied_template = new EUTRAN__FreqIndexes_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_FreqIndexes."); break; } set_selection(other_value); } boolean EUTRAN__FreqIndexes_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__FreqIndexes_template*)template_ptr)->single_value.value_elements[template_index]->match((*(const EUTRAN__FreqIndexes*)value_ptr)[value_index], legacy); else return ((const EUTRAN__FreqIndexes_template*)template_ptr)->single_value.value_elements[template_index]->is_any_or_omit(); } EUTRAN__FreqIndexes_template::EUTRAN__FreqIndexes_template() { } EUTRAN__FreqIndexes_template::EUTRAN__FreqIndexes_template(template_sel other_value) : Base_Record_Of_Template(other_value) { check_single_selection(other_value); } EUTRAN__FreqIndexes_template::EUTRAN__FreqIndexes_template(null_type) : Base_Record_Of_Template(SPECIFIC_VALUE) { single_value.n_elements = 0; single_value.value_elements = NULL; } EUTRAN__FreqIndexes_template::EUTRAN__FreqIndexes_template(const EUTRAN__FreqIndexes& other_value) { copy_value(other_value); } EUTRAN__FreqIndexes_template::EUTRAN__FreqIndexes_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const EUTRAN__FreqIndexes&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.EUTRAN_FreqIndexes from an unbound optional field."); } } EUTRAN__FreqIndexes_template::EUTRAN__FreqIndexes_template(EUTRAN__FreqIndexes_template* p_precondition, EUTRAN__FreqIndexes_template* p_implied_template) : Base_Record_Of_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } EUTRAN__FreqIndexes_template::EUTRAN__FreqIndexes_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__FreqIndexes_template::EUTRAN__FreqIndexes_template(const EUTRAN__FreqIndexes_template& other_value) : Base_Record_Of_Template() { copy_template(other_value); } EUTRAN__FreqIndexes_template::~EUTRAN__FreqIndexes_template() { clean_up(); } void EUTRAN__FreqIndexes_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__FreqIndexes_template& EUTRAN__FreqIndexes_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } EUTRAN__FreqIndexes_template& EUTRAN__FreqIndexes_template::operator=(null_type) { clean_up(); set_selection(SPECIFIC_VALUE); single_value.n_elements = 0; single_value.value_elements = NULL; return *this; } EUTRAN__FreqIndexes_template& EUTRAN__FreqIndexes_template::operator=(const EUTRAN__FreqIndexes& other_value) { clean_up(); copy_value(other_value); return *this; } EUTRAN__FreqIndexes_template& EUTRAN__FreqIndexes_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const EUTRAN__FreqIndexes&)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_FreqIndexes."); } return *this; } EUTRAN__FreqIndexes_template& EUTRAN__FreqIndexes_template::operator=(const EUTRAN__FreqIndexes_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } EUTRAN__FreqIndex_template& EUTRAN__FreqIndexes_template::operator[](int index_value) { if (index_value < 0) TTCN_error("Accessing an element of a template for type @GSM_RestOctets.EUTRAN_FreqIndexes 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_FreqIndexes."); break; } return *single_value.value_elements[index_value]; } EUTRAN__FreqIndex_template& EUTRAN__FreqIndexes_template::operator[](const INTEGER& index_value) { index_value.must_bound("Using an unbound integer value for indexing a template of type @GSM_RestOctets.EUTRAN_FreqIndexes."); return (*this)[(int)index_value]; } const EUTRAN__FreqIndex_template& EUTRAN__FreqIndexes_template::operator[](int index_value) const { if (index_value < 0) TTCN_error("Accessing an element of a template for type @GSM_RestOctets.EUTRAN_FreqIndexes 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_FreqIndexes."); if (index_value >= single_value.n_elements) TTCN_error("Index overflow in a template of type @GSM_RestOctets.EUTRAN_FreqIndexes: 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__FreqIndex_template& EUTRAN__FreqIndexes_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_FreqIndexes."); return (*this)[(int)index_value]; } void EUTRAN__FreqIndexes_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_FreqIndexes."); 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__FreqIndex_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__FreqIndex_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__FreqIndex_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__FreqIndex_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size); single_value.n_elements = new_size; } } int EUTRAN__FreqIndexes_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__FreqIndexes_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_FreqIndexes 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_FreqIndexes 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_FreqIndexes 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_FreqIndexes 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_FreqIndexes 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_FreqIndexes containing complemented list.", op_name); default: TTCN_error("Performing %sof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.EUTRAN_FreqIndexes.", op_name); } return check_section_is_single(min_size, has_any_or_none, op_name, "a", "template of type @GSM_RestOctets.EUTRAN_FreqIndexes"); } boolean EUTRAN__FreqIndexes_template::match(const EUTRAN__FreqIndexes& 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_FreqIndexes."); } return FALSE; } boolean EUTRAN__FreqIndexes_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__FreqIndexes EUTRAN__FreqIndexes_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_FreqIndexes."); EUTRAN__FreqIndexes 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__FreqIndexes EUTRAN__FreqIndexes_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__FreqIndexes EUTRAN__FreqIndexes_template::replace(int index, int len, const EUTRAN__FreqIndexes_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__FreqIndexes EUTRAN__FreqIndexes_template::replace(int index, int len, const EUTRAN__FreqIndexes& 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__FreqIndexes_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__FreqIndexes_template[list_length]; break; default: TTCN_error("Internal error: Setting an invalid type for a template of type @GSM_RestOctets.EUTRAN_FreqIndexes."); } set_selection(template_type); } EUTRAN__FreqIndexes_template& EUTRAN__FreqIndexes_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_FreqIndexes."); if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of type @GSM_RestOctets.EUTRAN_FreqIndexes."); return value_list.list_value[list_index]; } void EUTRAN__FreqIndexes_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__FreqIndexes_template::log_match(const EUTRAN__FreqIndexes& 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__FreqIndexes_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_FreqIndexes."); } } void EUTRAN__FreqIndexes_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_FreqIndexes."); single_value.value_elements = (EUTRAN__FreqIndex_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__FreqIndex_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__FreqIndexes_template[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_FreqIndexes."); } } boolean EUTRAN__FreqIndexes_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean EUTRAN__FreqIndexes_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__FreqIndexes_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__FreqIndexes_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__FreqIndexes_template* precondition = new EUTRAN__FreqIndexes_template; precondition->set_param(*param.get_elem(0)); EUTRAN__FreqIndexes_template* implied_template = new EUTRAN__FreqIndexes_template; implied_template->set_param(*param.get_elem(1)); *this = EUTRAN__FreqIndexes_template(precondition, implied_template); } break; default: param.type_error("record of template", "@GSM_RestOctets.EUTRAN_FreqIndexes"); } is_ifpresent = param.get_ifpresent(); set_length_range(param); } void EUTRAN__FreqIndexes_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_FreqIndexes"); 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_FreqIndexes"); } boolean EUTRAN__FreqIndexes_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__FreqIndex::EUTRAN__FreqIndex() { } EUTRAN__FreqIndex::EUTRAN__FreqIndex(const BITSTRING& par_item__ind, const INTEGER& par_idx) : field_item__ind(par_item__ind), field_idx(par_idx) { } EUTRAN__FreqIndex::EUTRAN__FreqIndex(const EUTRAN__FreqIndex& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.EUTRAN_FreqIndex."); if (other_value.item__ind().is_bound()) field_item__ind = other_value.item__ind(); else field_item__ind.clean_up(); if (other_value.idx().is_bound()) field_idx = other_value.idx(); else field_idx.clean_up(); } void EUTRAN__FreqIndex::clean_up() { field_item__ind.clean_up(); field_idx.clean_up(); } const TTCN_Typedescriptor_t* EUTRAN__FreqIndex::get_descriptor() const { return &EUTRAN__FreqIndex_descr_; } EUTRAN__FreqIndex& EUTRAN__FreqIndex::operator=(const EUTRAN__FreqIndex& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.EUTRAN_FreqIndex."); if (other_value.item__ind().is_bound()) field_item__ind = other_value.item__ind(); else field_item__ind.clean_up(); if (other_value.idx().is_bound()) field_idx = other_value.idx(); else field_idx.clean_up(); } return *this; } boolean EUTRAN__FreqIndex::operator==(const EUTRAN__FreqIndex& other_value) const { return field_item__ind==other_value.field_item__ind && field_idx==other_value.field_idx; } boolean EUTRAN__FreqIndex::is_bound() const { return (field_item__ind.is_bound()) || (field_idx.is_bound()); } boolean EUTRAN__FreqIndex::is_value() const { return field_item__ind.is_value() && field_idx.is_value(); } void EUTRAN__FreqIndex::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(", idx := "); field_idx.log(); TTCN_Logger::log_event_str(" }"); } void EUTRAN__FreqIndex::set_implicit_omit() { if (item__ind().is_bound()) item__ind().set_implicit_omit(); if (idx().is_bound()) idx().set_implicit_omit(); } void EUTRAN__FreqIndex::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) item__ind().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) idx().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(), "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(), "idx")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { idx().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_FreqIndex: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.EUTRAN_FreqIndex"); } } void EUTRAN__FreqIndex::encode_text(Text_Buf& text_buf) const { field_item__ind.encode_text(text_buf); field_idx.encode_text(text_buf); } void EUTRAN__FreqIndex::decode_text(Text_Buf& text_buf) { field_item__ind.decode_text(text_buf); field_idx.decode_text(text_buf); } void EUTRAN__FreqIndex::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__FreqIndex::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__FreqIndex::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__FreqIndex_item__ind_descr_.raw->forceomit); decoded_field_length = field_item__ind.RAW_decode(EUTRAN__FreqIndex_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__FreqIndex_idx_descr_.raw->forceomit); decoded_field_length = field_idx.RAW_decode(EUTRAN__FreqIndex_idx_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); if (field_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__FreqIndex::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__FreqIndex_item__ind_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, EUTRAN__FreqIndex_idx_descr_.raw); encoded_length += field_item__ind.RAW_encode(EUTRAN__FreqIndex_item__ind_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_idx.RAW_encode(EUTRAN__FreqIndex_idx_descr_, *myleaf.body.node.nodes[1]); 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__FreqIndex_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__FreqIndex_template::single_value_struct { BITSTRING_template field_item__ind; INTEGER_template field_idx; }; void EUTRAN__FreqIndex_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_idx = ANY_VALUE; } } } void EUTRAN__FreqIndex_template::copy_value(const EUTRAN__FreqIndex& 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.idx().is_bound()) { single_value->field_idx = other_value.idx(); } else { single_value->field_idx.clean_up(); } set_selection(SPECIFIC_VALUE); } void EUTRAN__FreqIndex_template::copy_template(const EUTRAN__FreqIndex_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.idx().get_selection()) { single_value->field_idx = other_value.idx(); } else { single_value->field_idx.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__FreqIndex_template[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__FreqIndex_template(*other_value.implication_.precondition); implication_.implied_template = new EUTRAN__FreqIndex_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_FreqIndex."); break; } set_selection(other_value); } EUTRAN__FreqIndex_template::EUTRAN__FreqIndex_template() { } EUTRAN__FreqIndex_template::EUTRAN__FreqIndex_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } EUTRAN__FreqIndex_template::EUTRAN__FreqIndex_template(const EUTRAN__FreqIndex& other_value) { copy_value(other_value); } EUTRAN__FreqIndex_template::EUTRAN__FreqIndex_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const EUTRAN__FreqIndex&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.EUTRAN_FreqIndex from an unbound optional field."); } } EUTRAN__FreqIndex_template::EUTRAN__FreqIndex_template(EUTRAN__FreqIndex_template* p_precondition, EUTRAN__FreqIndex_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } EUTRAN__FreqIndex_template::EUTRAN__FreqIndex_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__FreqIndex_template::EUTRAN__FreqIndex_template(const EUTRAN__FreqIndex_template& other_value) : Base_Template() { copy_template(other_value); } EUTRAN__FreqIndex_template::~EUTRAN__FreqIndex_template() { clean_up(); } EUTRAN__FreqIndex_template& EUTRAN__FreqIndex_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } EUTRAN__FreqIndex_template& EUTRAN__FreqIndex_template::operator=(const EUTRAN__FreqIndex& other_value) { clean_up(); copy_value(other_value); return *this; } EUTRAN__FreqIndex_template& EUTRAN__FreqIndex_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const EUTRAN__FreqIndex&)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_FreqIndex."); } return *this; } EUTRAN__FreqIndex_template& EUTRAN__FreqIndex_template::operator=(const EUTRAN__FreqIndex_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean EUTRAN__FreqIndex_template::match(const EUTRAN__FreqIndex& 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.idx().is_bound()) return FALSE; if(!single_value->field_idx.match(other_value.idx(), 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_FreqIndex."); } return FALSE; } boolean EUTRAN__FreqIndex_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_idx.is_bound(); } boolean EUTRAN__FreqIndex_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_item__ind.is_value() && single_value->field_idx.is_value(); } void EUTRAN__FreqIndex_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__FreqIndex EUTRAN__FreqIndex_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_FreqIndex."); EUTRAN__FreqIndex ret_val; if (single_value->field_item__ind.is_bound()) { ret_val.item__ind() = single_value->field_item__ind.valueof(); } if (single_value->field_idx.is_bound()) { ret_val.idx() = single_value->field_idx.valueof(); } return ret_val; } void EUTRAN__FreqIndex_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_FreqIndex."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new EUTRAN__FreqIndex_template[list_length]; } EUTRAN__FreqIndex_template& EUTRAN__FreqIndex_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_FreqIndex."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.EUTRAN_FreqIndex."); return value_list.list_value[list_index]; } BITSTRING_template& EUTRAN__FreqIndex_template::item__ind() { set_specific(); return single_value->field_item__ind; } const BITSTRING_template& EUTRAN__FreqIndex_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_FreqIndex."); return single_value->field_item__ind; } INTEGER_template& EUTRAN__FreqIndex_template::idx() { set_specific(); return single_value->field_idx; } const INTEGER_template& EUTRAN__FreqIndex_template::idx() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field idx of a non-specific template of type @GSM_RestOctets.EUTRAN_FreqIndex."); return single_value->field_idx; } int EUTRAN__FreqIndex_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_FreqIndex 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.EUTRAN_FreqIndex 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_FreqIndex 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_FreqIndex containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_FreqIndex containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_FreqIndex containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_FreqIndex containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_FreqIndex containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_FreqIndex containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.EUTRAN_FreqIndex."); } return 0; } void EUTRAN__FreqIndex_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(", idx := "); single_value->field_idx.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__FreqIndex_template::log_match(const EUTRAN__FreqIndex& 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_idx.match(match_value.idx(), legacy)){ TTCN_Logger::log_logmatch_info(".idx"); single_value->field_idx.log_match(match_value.idx(), 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(", idx := "); single_value->field_idx.log_match(match_value.idx(), 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__FreqIndex_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (item__ind().is_bound()) item__ind().set_implicit_omit(); if (idx().is_bound()) idx().set_implicit_omit(); } void EUTRAN__FreqIndex_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_idx.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_FreqIndex."); } } void EUTRAN__FreqIndex_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_idx.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__FreqIndex_template[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_FreqIndex."); } } void EUTRAN__FreqIndex_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__FreqIndex_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) idx().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(), "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(), "idx")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { idx().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_FreqIndex: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { EUTRAN__FreqIndex_template* precondition = new EUTRAN__FreqIndex_template; precondition->set_param(*param.get_elem(0)); EUTRAN__FreqIndex_template* implied_template = new EUTRAN__FreqIndex_template; implied_template->set_param(*param.get_elem(1)); *this = EUTRAN__FreqIndex_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.EUTRAN_FreqIndex"); } is_ifpresent = param.get_ifpresent(); } void EUTRAN__FreqIndex_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_FreqIndex"); single_value->field_idx.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.EUTRAN_FreqIndex"); 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_FreqIndex"); } boolean EUTRAN__FreqIndex_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean EUTRAN__FreqIndex_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__PCID2TAMaps::EUTRAN__PCID2TAMaps(const EUTRAN__PCID2TAMaps& other_value) { if (!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.EUTRAN_PCID2TAMaps."); val_ptr = other_value.val_ptr; val_ptr->ref_count++; } EUTRAN__PCID2TAMaps::~EUTRAN__PCID2TAMaps() { clean_up(); if (val_ptr != NULL) val_ptr = NULL; } void EUTRAN__PCID2TAMaps::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__PCID2TAMaps& EUTRAN__PCID2TAMaps::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__PCID2TAMaps& EUTRAN__PCID2TAMaps::operator=(const EUTRAN__PCID2TAMaps& other_value) { if (other_value.val_ptr == NULL) TTCN_error("Assigning an unbound value of type @GSM_RestOctets.EUTRAN_PCID2TAMaps."); if (this != &other_value) { clean_up(); val_ptr = other_value.val_ptr; val_ptr->ref_count++; } return *this; } boolean EUTRAN__PCID2TAMaps::operator==(null_type) const { if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @GSM_RestOctets.EUTRAN_PCID2TAMaps."); return val_ptr->n_elements == 0 ; } boolean EUTRAN__PCID2TAMaps::operator==(const EUTRAN__PCID2TAMaps& other_value) const { if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @GSM_RestOctets.EUTRAN_PCID2TAMaps."); if (other_value.val_ptr == NULL) TTCN_error("The right operand of comparison is an unbound value of type @GSM_RestOctets.EUTRAN_PCID2TAMaps."); 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__PCID2TAMap& EUTRAN__PCID2TAMaps::operator[](int index_value) { if (index_value < 0) TTCN_error("Accessing an element of type @GSM_RestOctets.EUTRAN_PCID2TAMaps 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__PCID2TAMap**)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__PCID2TAMap(*(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__PCID2TAMap; } return *val_ptr->value_elements[index_value]; } EUTRAN__PCID2TAMap& EUTRAN__PCID2TAMaps::operator[](const INTEGER& index_value) { index_value.must_bound("Using an unbound integer value for indexing a value of type @GSM_RestOctets.EUTRAN_PCID2TAMaps."); return (*this)[(int)index_value]; } const EUTRAN__PCID2TAMap& EUTRAN__PCID2TAMaps::operator[](int index_value) const { if (val_ptr == NULL) TTCN_error("Accessing an element in an unbound value of type @GSM_RestOctets.EUTRAN_PCID2TAMaps."); if (index_value < 0) TTCN_error("Accessing an element of type @GSM_RestOctets.EUTRAN_PCID2TAMaps 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_PCID2TAMaps: 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__PCID2TAMap& EUTRAN__PCID2TAMaps::operator[](const INTEGER& index_value) const { index_value.must_bound("Using an unbound integer value for indexing a value of type @GSM_RestOctets.EUTRAN_PCID2TAMaps."); return (*this)[(int)index_value]; } EUTRAN__PCID2TAMaps EUTRAN__PCID2TAMaps::operator<<=(int rotate_count) const { return *this >>= (-rotate_count); } EUTRAN__PCID2TAMaps EUTRAN__PCID2TAMaps::operator<<=(const INTEGER& rotate_count) const { rotate_count.must_bound("Unbound integer operand of rotate left operator."); return *this >>= (int)(-rotate_count); } EUTRAN__PCID2TAMaps EUTRAN__PCID2TAMaps::operator>>=(const INTEGER& rotate_count) const { rotate_count.must_bound("Unbound integer operand of rotate right operator."); return *this >>= (int)rotate_count; } EUTRAN__PCID2TAMaps EUTRAN__PCID2TAMaps::operator>>=(int rotate_count) const { if (val_ptr == NULL) TTCN_error("Performing rotation operation on an unbound value of type @GSM_RestOctets.EUTRAN_PCID2TAMaps."); 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__PCID2TAMaps 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__PCID2TAMap(*val_ptr->value_elements[i]); } } return ret_val; } EUTRAN__PCID2TAMaps EUTRAN__PCID2TAMaps::operator+(const EUTRAN__PCID2TAMaps& other_value) const { if (val_ptr == NULL || other_value.val_ptr == NULL) TTCN_error("Unbound operand of @GSM_RestOctets.EUTRAN_PCID2TAMaps concatenation."); if (val_ptr->n_elements == 0) return other_value; if (other_value.val_ptr->n_elements == 0) return *this; EUTRAN__PCID2TAMaps 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__PCID2TAMap(*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__PCID2TAMap(*other_value.val_ptr->value_elements[i]); } } return ret_val; } EUTRAN__PCID2TAMaps EUTRAN__PCID2TAMaps::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_PCID2TAMaps."); check_substr_arguments(val_ptr->n_elements, index, returncount, "@GSM_RestOctets.EUTRAN_PCID2TAMaps","element"); EUTRAN__PCID2TAMaps 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__PCID2TAMap(*val_ptr->value_elements[i+index]); } } return ret_val; } EUTRAN__PCID2TAMaps EUTRAN__PCID2TAMaps::replace(int index, int len, const EUTRAN__PCID2TAMaps& repl) const { if (val_ptr == NULL) TTCN_error("The first argument of replace() is an unbound value of type @GSM_RestOctets.EUTRAN_PCID2TAMaps."); if (repl.val_ptr == NULL) TTCN_error("The fourth argument of replace() is an unbound value of type @GSM_RestOctets.EUTRAN_PCID2TAMaps."); check_replace_arguments(val_ptr->n_elements, index, len, "@GSM_RestOctets.EUTRAN_PCID2TAMaps","element"); EUTRAN__PCID2TAMaps 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__PCID2TAMap(*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__PCID2TAMap(*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__PCID2TAMap(*val_ptr->value_elements[index+i+len]); } } return ret_val; } EUTRAN__PCID2TAMaps EUTRAN__PCID2TAMaps::replace(int index, int len, const EUTRAN__PCID2TAMaps_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__PCID2TAMaps::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_PCID2TAMaps."); 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__PCID2TAMap**)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__PCID2TAMap(*(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__PCID2TAMap**)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_PCID2TAMaps: %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__PCID2TAMap**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size); val_ptr->n_elements = new_size; } } boolean EUTRAN__PCID2TAMaps::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__PCID2TAMaps::size_of() const { if (val_ptr == NULL) TTCN_error("Performing sizeof operation on an unbound value of type @GSM_RestOctets.EUTRAN_PCID2TAMaps."); return val_ptr->n_elements; } int EUTRAN__PCID2TAMaps::lengthof() const { if (val_ptr == NULL) TTCN_error("Performing lengthof operation on an unbound value of type @GSM_RestOctets.EUTRAN_PCID2TAMaps."); 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__PCID2TAMaps::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__PCID2TAMaps::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__PCID2TAMaps::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_PCID2TAMaps"); } 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_PCID2TAMaps"); } break; default: TTCN_error("Internal error: Unknown operation type."); } } void EUTRAN__PCID2TAMaps::encode_text(Text_Buf& text_buf) const { if (val_ptr == NULL) TTCN_error("Text encoder: Encoding an unbound value of type @GSM_RestOctets.EUTRAN_PCID2TAMaps."); 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__PCID2TAMaps::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_PCID2TAMaps."); val_ptr->value_elements = (EUTRAN__PCID2TAMap**)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__PCID2TAMap; val_ptr->value_elements[elem_count]->decode_text(text_buf); } } void EUTRAN__PCID2TAMaps::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__PCID2TAMaps::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__PCID2TAMaps::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__PCID2TAMaps::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__PCID2TAMaps_template::copy_value(const EUTRAN__PCID2TAMaps& other_value) { if (!other_value.is_bound()) TTCN_error("Initialization of a template of type @GSM_RestOctets.EUTRAN_PCID2TAMaps with an unbound value."); single_value.n_elements = other_value.size_of(); single_value.value_elements = (EUTRAN__PCID2TAMap_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__PCID2TAMap_template(other_value[elem_count]); } else { single_value.value_elements[elem_count] = new EUTRAN__PCID2TAMap_template; } } set_selection(SPECIFIC_VALUE); } void EUTRAN__PCID2TAMaps_template::copy_template(const EUTRAN__PCID2TAMaps_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__PCID2TAMap_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__PCID2TAMap_template(*other_value.single_value.value_elements[elem_count]); } else { single_value.value_elements[elem_count] = new EUTRAN__PCID2TAMap_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__PCID2TAMaps_template[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__PCID2TAMaps_template(*other_value.implication_.precondition); implication_.implied_template = new EUTRAN__PCID2TAMaps_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_PCID2TAMaps."); break; } set_selection(other_value); } boolean EUTRAN__PCID2TAMaps_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__PCID2TAMaps_template*)template_ptr)->single_value.value_elements[template_index]->match((*(const EUTRAN__PCID2TAMaps*)value_ptr)[value_index], legacy); else return ((const EUTRAN__PCID2TAMaps_template*)template_ptr)->single_value.value_elements[template_index]->is_any_or_omit(); } EUTRAN__PCID2TAMaps_template::EUTRAN__PCID2TAMaps_template() { } EUTRAN__PCID2TAMaps_template::EUTRAN__PCID2TAMaps_template(template_sel other_value) : Base_Record_Of_Template(other_value) { check_single_selection(other_value); } EUTRAN__PCID2TAMaps_template::EUTRAN__PCID2TAMaps_template(null_type) : Base_Record_Of_Template(SPECIFIC_VALUE) { single_value.n_elements = 0; single_value.value_elements = NULL; } EUTRAN__PCID2TAMaps_template::EUTRAN__PCID2TAMaps_template(const EUTRAN__PCID2TAMaps& other_value) { copy_value(other_value); } EUTRAN__PCID2TAMaps_template::EUTRAN__PCID2TAMaps_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const EUTRAN__PCID2TAMaps&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.EUTRAN_PCID2TAMaps from an unbound optional field."); } } EUTRAN__PCID2TAMaps_template::EUTRAN__PCID2TAMaps_template(EUTRAN__PCID2TAMaps_template* p_precondition, EUTRAN__PCID2TAMaps_template* p_implied_template) : Base_Record_Of_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } EUTRAN__PCID2TAMaps_template::EUTRAN__PCID2TAMaps_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__PCID2TAMaps_template::EUTRAN__PCID2TAMaps_template(const EUTRAN__PCID2TAMaps_template& other_value) : Base_Record_Of_Template() { copy_template(other_value); } EUTRAN__PCID2TAMaps_template::~EUTRAN__PCID2TAMaps_template() { clean_up(); } void EUTRAN__PCID2TAMaps_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__PCID2TAMaps_template& EUTRAN__PCID2TAMaps_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } EUTRAN__PCID2TAMaps_template& EUTRAN__PCID2TAMaps_template::operator=(null_type) { clean_up(); set_selection(SPECIFIC_VALUE); single_value.n_elements = 0; single_value.value_elements = NULL; return *this; } EUTRAN__PCID2TAMaps_template& EUTRAN__PCID2TAMaps_template::operator=(const EUTRAN__PCID2TAMaps& other_value) { clean_up(); copy_value(other_value); return *this; } EUTRAN__PCID2TAMaps_template& EUTRAN__PCID2TAMaps_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const EUTRAN__PCID2TAMaps&)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_PCID2TAMaps."); } return *this; } EUTRAN__PCID2TAMaps_template& EUTRAN__PCID2TAMaps_template::operator=(const EUTRAN__PCID2TAMaps_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } EUTRAN__PCID2TAMap_template& EUTRAN__PCID2TAMaps_template::operator[](int index_value) { if (index_value < 0) TTCN_error("Accessing an element of a template for type @GSM_RestOctets.EUTRAN_PCID2TAMaps 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_PCID2TAMaps."); break; } return *single_value.value_elements[index_value]; } EUTRAN__PCID2TAMap_template& EUTRAN__PCID2TAMaps_template::operator[](const INTEGER& index_value) { index_value.must_bound("Using an unbound integer value for indexing a template of type @GSM_RestOctets.EUTRAN_PCID2TAMaps."); return (*this)[(int)index_value]; } const EUTRAN__PCID2TAMap_template& EUTRAN__PCID2TAMaps_template::operator[](int index_value) const { if (index_value < 0) TTCN_error("Accessing an element of a template for type @GSM_RestOctets.EUTRAN_PCID2TAMaps 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_PCID2TAMaps."); if (index_value >= single_value.n_elements) TTCN_error("Index overflow in a template of type @GSM_RestOctets.EUTRAN_PCID2TAMaps: 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__PCID2TAMap_template& EUTRAN__PCID2TAMaps_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_PCID2TAMaps."); return (*this)[(int)index_value]; } void EUTRAN__PCID2TAMaps_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_PCID2TAMaps."); 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__PCID2TAMap_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__PCID2TAMap_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__PCID2TAMap_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__PCID2TAMap_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size); single_value.n_elements = new_size; } } int EUTRAN__PCID2TAMaps_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__PCID2TAMaps_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_PCID2TAMaps 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_PCID2TAMaps 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_PCID2TAMaps 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_PCID2TAMaps 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_PCID2TAMaps 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_PCID2TAMaps containing complemented list.", op_name); default: TTCN_error("Performing %sof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.EUTRAN_PCID2TAMaps.", op_name); } return check_section_is_single(min_size, has_any_or_none, op_name, "a", "template of type @GSM_RestOctets.EUTRAN_PCID2TAMaps"); } boolean EUTRAN__PCID2TAMaps_template::match(const EUTRAN__PCID2TAMaps& 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_PCID2TAMaps."); } return FALSE; } boolean EUTRAN__PCID2TAMaps_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__PCID2TAMaps EUTRAN__PCID2TAMaps_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_PCID2TAMaps."); EUTRAN__PCID2TAMaps 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__PCID2TAMaps EUTRAN__PCID2TAMaps_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__PCID2TAMaps EUTRAN__PCID2TAMaps_template::replace(int index, int len, const EUTRAN__PCID2TAMaps_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__PCID2TAMaps EUTRAN__PCID2TAMaps_template::replace(int index, int len, const EUTRAN__PCID2TAMaps& 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__PCID2TAMaps_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__PCID2TAMaps_template[list_length]; break; default: TTCN_error("Internal error: Setting an invalid type for a template of type @GSM_RestOctets.EUTRAN_PCID2TAMaps."); } set_selection(template_type); } EUTRAN__PCID2TAMaps_template& EUTRAN__PCID2TAMaps_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_PCID2TAMaps."); if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of type @GSM_RestOctets.EUTRAN_PCID2TAMaps."); return value_list.list_value[list_index]; } void EUTRAN__PCID2TAMaps_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__PCID2TAMaps_template::log_match(const EUTRAN__PCID2TAMaps& 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__PCID2TAMaps_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_PCID2TAMaps."); } } void EUTRAN__PCID2TAMaps_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_PCID2TAMaps."); single_value.value_elements = (EUTRAN__PCID2TAMap_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__PCID2TAMap_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__PCID2TAMaps_template[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_PCID2TAMaps."); } } boolean EUTRAN__PCID2TAMaps_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean EUTRAN__PCID2TAMaps_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__PCID2TAMaps_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__PCID2TAMaps_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__PCID2TAMaps_template* precondition = new EUTRAN__PCID2TAMaps_template; precondition->set_param(*param.get_elem(0)); EUTRAN__PCID2TAMaps_template* implied_template = new EUTRAN__PCID2TAMaps_template; implied_template->set_param(*param.get_elem(1)); *this = EUTRAN__PCID2TAMaps_template(precondition, implied_template); } break; default: param.type_error("record of template", "@GSM_RestOctets.EUTRAN_PCID2TAMaps"); } is_ifpresent = param.get_ifpresent(); set_length_range(param); } void EUTRAN__PCID2TAMaps_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_PCID2TAMaps"); 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_PCID2TAMaps"); } boolean EUTRAN__PCID2TAMaps_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__PCID2TAMap::EUTRAN__PCID2TAMap() { } EUTRAN__PCID2TAMap::EUTRAN__PCID2TAMap(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__PCID2TAMap::EUTRAN__PCID2TAMap(const EUTRAN__PCID2TAMap& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.EUTRAN_PCID2TAMap."); 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__PCID2TAMap::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__PCID2TAMap::get_descriptor() const { return &EUTRAN__PCID2TAMap_descr_; } EUTRAN__PCID2TAMap& EUTRAN__PCID2TAMap::operator=(const EUTRAN__PCID2TAMap& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.EUTRAN_PCID2TAMap."); 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__PCID2TAMap::operator==(const EUTRAN__PCID2TAMap& 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__PCID2TAMap::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__PCID2TAMap::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__PCID2TAMap::size_of() const { int ret_val = 3; if (field_freq__idx__list.ispresent()) ret_val++; return ret_val; } void EUTRAN__PCID2TAMap::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__PCID2TAMap::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__PCID2TAMap::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_PCID2TAMap: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.EUTRAN_PCID2TAMap"); } } void EUTRAN__PCID2TAMap::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__PCID2TAMap::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__PCID2TAMap::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__PCID2TAMap::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__PCID2TAMap::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__PCID2TAMap_item__ind_descr_.raw->forceomit); decoded_field_length = field_item__ind.RAW_decode(EUTRAN__PCID2TAMap_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__PCID2TAMap_pcid__group__presence_descr_.raw->forceomit); decoded_field_length = field_pcid__group__presence.RAW_decode(EUTRAN__PCID2TAMap_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__PCID2TAMap_freq__idx__list_descr_.raw->forceomit); decoded_field_length = field_freq__idx__list().RAW_decode(EUTRAN__PCID2TAMap_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__PCID2TAMap_freq__idx__list__term_descr_.raw->forceomit); decoded_field_length = field_freq__idx__list__term.RAW_decode(EUTRAN__PCID2TAMap_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__PCID2TAMap::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__PCID2TAMap_item__ind_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, EUTRAN__PCID2TAMap_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__PCID2TAMap_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__PCID2TAMap_freq__idx__list__term_descr_.raw); encoded_length += field_item__ind.RAW_encode(EUTRAN__PCID2TAMap_item__ind_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_pcid__group__presence.RAW_encode(EUTRAN__PCID2TAMap_pcid__group__presence_descr_, *myleaf.body.node.nodes[1]); if (field_freq__idx__list.ispresent()) { encoded_length += field_freq__idx__list().RAW_encode(EUTRAN__PCID2TAMap_freq__idx__list_descr_, *myleaf.body.node.nodes[2]); } encoded_length += field_freq__idx__list__term.RAW_encode(EUTRAN__PCID2TAMap_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__PCID2TAMap_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__PCID2TAMap_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__PCID2TAMap_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__PCID2TAMap_template::copy_value(const EUTRAN__PCID2TAMap& 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__PCID2TAMap_template::copy_template(const EUTRAN__PCID2TAMap_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__PCID2TAMap_template[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__PCID2TAMap_template(*other_value.implication_.precondition); implication_.implied_template = new EUTRAN__PCID2TAMap_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_PCID2TAMap."); break; } set_selection(other_value); } EUTRAN__PCID2TAMap_template::EUTRAN__PCID2TAMap_template() { } EUTRAN__PCID2TAMap_template::EUTRAN__PCID2TAMap_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } EUTRAN__PCID2TAMap_template::EUTRAN__PCID2TAMap_template(const EUTRAN__PCID2TAMap& other_value) { copy_value(other_value); } EUTRAN__PCID2TAMap_template::EUTRAN__PCID2TAMap_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const EUTRAN__PCID2TAMap&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.EUTRAN_PCID2TAMap from an unbound optional field."); } } EUTRAN__PCID2TAMap_template::EUTRAN__PCID2TAMap_template(EUTRAN__PCID2TAMap_template* p_precondition, EUTRAN__PCID2TAMap_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } EUTRAN__PCID2TAMap_template::EUTRAN__PCID2TAMap_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__PCID2TAMap_template::EUTRAN__PCID2TAMap_template(const EUTRAN__PCID2TAMap_template& other_value) : Base_Template() { copy_template(other_value); } EUTRAN__PCID2TAMap_template::~EUTRAN__PCID2TAMap_template() { clean_up(); } EUTRAN__PCID2TAMap_template& EUTRAN__PCID2TAMap_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } EUTRAN__PCID2TAMap_template& EUTRAN__PCID2TAMap_template::operator=(const EUTRAN__PCID2TAMap& other_value) { clean_up(); copy_value(other_value); return *this; } EUTRAN__PCID2TAMap_template& EUTRAN__PCID2TAMap_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const EUTRAN__PCID2TAMap&)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_PCID2TAMap."); } return *this; } EUTRAN__PCID2TAMap_template& EUTRAN__PCID2TAMap_template::operator=(const EUTRAN__PCID2TAMap_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean EUTRAN__PCID2TAMap_template::match(const EUTRAN__PCID2TAMap& 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_PCID2TAMap."); } return FALSE; } boolean EUTRAN__PCID2TAMap_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__PCID2TAMap_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__PCID2TAMap_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__PCID2TAMap EUTRAN__PCID2TAMap_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_PCID2TAMap."); EUTRAN__PCID2TAMap 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__PCID2TAMap_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_PCID2TAMap."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new EUTRAN__PCID2TAMap_template[list_length]; } EUTRAN__PCID2TAMap_template& EUTRAN__PCID2TAMap_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_PCID2TAMap."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.EUTRAN_PCID2TAMap."); return value_list.list_value[list_index]; } BITSTRING_template& EUTRAN__PCID2TAMap_template::item__ind() { set_specific(); return single_value->field_item__ind; } const BITSTRING_template& EUTRAN__PCID2TAMap_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_PCID2TAMap."); return single_value->field_item__ind; } BITSTRING_template& EUTRAN__PCID2TAMap_template::pcid__group__presence() { set_specific(); return single_value->field_pcid__group__presence; } const BITSTRING_template& EUTRAN__PCID2TAMap_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_PCID2TAMap."); return single_value->field_pcid__group__presence; } EUTRAN__FreqIndexes_template& EUTRAN__PCID2TAMap_template::freq__idx__list() { set_specific(); return single_value->field_freq__idx__list; } const EUTRAN__FreqIndexes_template& EUTRAN__PCID2TAMap_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_PCID2TAMap."); return single_value->field_freq__idx__list; } BITSTRING_template& EUTRAN__PCID2TAMap_template::freq__idx__list__term() { set_specific(); return single_value->field_freq__idx__list__term; } const BITSTRING_template& EUTRAN__PCID2TAMap_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_PCID2TAMap."); return single_value->field_freq__idx__list__term; } int EUTRAN__PCID2TAMap_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_PCID2TAMap 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_PCID2TAMap 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_PCID2TAMap 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_PCID2TAMap containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_PCID2TAMap containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_PCID2TAMap containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_PCID2TAMap containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_PCID2TAMap containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.EUTRAN_PCID2TAMap containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.EUTRAN_PCID2TAMap."); } return 0; } void EUTRAN__PCID2TAMap_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__PCID2TAMap_template::log_match(const EUTRAN__PCID2TAMap& 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__PCID2TAMap_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__PCID2TAMap_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_PCID2TAMap."); } } void EUTRAN__PCID2TAMap_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__PCID2TAMap_template[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_PCID2TAMap."); } } void EUTRAN__PCID2TAMap_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__PCID2TAMap_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_PCID2TAMap: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { EUTRAN__PCID2TAMap_template* precondition = new EUTRAN__PCID2TAMap_template; precondition->set_param(*param.get_elem(0)); EUTRAN__PCID2TAMap_template* implied_template = new EUTRAN__PCID2TAMap_template; implied_template->set_param(*param.get_elem(1)); *this = EUTRAN__PCID2TAMap_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.EUTRAN_PCID2TAMap"); } is_ifpresent = param.get_ifpresent(); } void EUTRAN__PCID2TAMap_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_PCID2TAMap"); single_value->field_pcid__group__presence.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.EUTRAN_PCID2TAMap"); single_value->field_freq__idx__list.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.EUTRAN_PCID2TAMap"); single_value->field_freq__idx__list__term.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.EUTRAN_PCID2TAMap"); 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_PCID2TAMap"); } boolean EUTRAN__PCID2TAMap_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean EUTRAN__PCID2TAMap_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) sc__prio__params__desc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) utran__prio__params__desc().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) eutran__params__desc().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(), "sc_prio_params_desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { sc__prio__params__desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "utran_prio_params_desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { utran__prio__params__desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "eutran_params_desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { eutran__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.Rel8PrioEUTRANParamsDesc: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.Rel8PrioEUTRANParamsDesc"); } } void Rel8PrioEUTRANParamsDesc::encode_text(Text_Buf& text_buf) const { field_sc__prio__params__desc.encode_text(text_buf); field_utran__prio__params__desc.encode_text(text_buf); field_eutran__params__desc.encode_text(text_buf); } void Rel8PrioEUTRANParamsDesc::decode_text(Text_Buf& text_buf) { field_sc__prio__params__desc.decode_text(text_buf); field_utran__prio__params__desc.decode_text(text_buf); field_eutran__params__desc.decode_text(text_buf); } void Rel8PrioEUTRANParamsDesc::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 Rel8PrioEUTRANParamsDesc::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 Rel8PrioEUTRANParamsDesc::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, Rel8PrioEUTRANParamsDesc_sc__prio__params__desc_descr_.raw->forceomit); decoded_field_length = field_sc__prio__params__desc.RAW_decode(Rel8PrioEUTRANParamsDesc_sc__prio__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, Rel8PrioEUTRANParamsDesc_utran__prio__params__desc_descr_.raw->forceomit); decoded_field_length = field_utran__prio__params__desc.RAW_decode(Rel8PrioEUTRANParamsDesc_utran__prio__params__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, Rel8PrioEUTRANParamsDesc_eutran__params__desc_descr_.raw->forceomit); decoded_field_length = field_eutran__params__desc.RAW_decode(Rel8PrioEUTRANParamsDesc_eutran__params__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()); p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int Rel8PrioEUTRANParamsDesc::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, Rel8PrioEUTRANParamsDesc_sc__prio__params__desc_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, Rel8PrioEUTRANParamsDesc_utran__prio__params__desc_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, Rel8PrioEUTRANParamsDesc_eutran__params__desc_descr_.raw); encoded_length += field_sc__prio__params__desc.RAW_encode(Rel8PrioEUTRANParamsDesc_sc__prio__params__desc_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_utran__prio__params__desc.RAW_encode(Rel8PrioEUTRANParamsDesc_utran__prio__params__desc_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_eutran__params__desc.RAW_encode(Rel8PrioEUTRANParamsDesc_eutran__params__desc_descr_, *myleaf.body.node.nodes[2]); return myleaf.length = encoded_length; } struct Rel8PrioEUTRANParamsDesc_template::single_value_struct { ServingCellPrioParamsDescOpt_template field_sc__prio__params__desc; UTRAN__PrioParamsDescOpt_template field_utran__prio__params__desc; EUTRAN__ParamsDescOpt_template field_eutran__params__desc; }; void Rel8PrioEUTRANParamsDesc_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_sc__prio__params__desc = ANY_VALUE; single_value->field_utran__prio__params__desc = ANY_VALUE; single_value->field_eutran__params__desc = ANY_VALUE; } } } void Rel8PrioEUTRANParamsDesc_template::copy_value(const Rel8PrioEUTRANParamsDesc& other_value) { single_value = new single_value_struct; if (other_value.sc__prio__params__desc().is_bound()) { single_value->field_sc__prio__params__desc = other_value.sc__prio__params__desc(); } else { single_value->field_sc__prio__params__desc.clean_up(); } if (other_value.utran__prio__params__desc().is_bound()) { single_value->field_utran__prio__params__desc = other_value.utran__prio__params__desc(); } else { single_value->field_utran__prio__params__desc.clean_up(); } if (other_value.eutran__params__desc().is_bound()) { single_value->field_eutran__params__desc = other_value.eutran__params__desc(); } else { single_value->field_eutran__params__desc.clean_up(); } set_selection(SPECIFIC_VALUE); } void Rel8PrioEUTRANParamsDesc_template::copy_template(const Rel8PrioEUTRANParamsDesc_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.sc__prio__params__desc().get_selection()) { single_value->field_sc__prio__params__desc = other_value.sc__prio__params__desc(); } else { single_value->field_sc__prio__params__desc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.utran__prio__params__desc().get_selection()) { single_value->field_utran__prio__params__desc = other_value.utran__prio__params__desc(); } else { single_value->field_utran__prio__params__desc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.eutran__params__desc().get_selection()) { single_value->field_eutran__params__desc = other_value.eutran__params__desc(); } else { single_value->field_eutran__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 Rel8PrioEUTRANParamsDesc_template[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 Rel8PrioEUTRANParamsDesc_template(*other_value.implication_.precondition); implication_.implied_template = new Rel8PrioEUTRANParamsDesc_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.Rel8PrioEUTRANParamsDesc."); break; } set_selection(other_value); } Rel8PrioEUTRANParamsDesc_template::Rel8PrioEUTRANParamsDesc_template() { } Rel8PrioEUTRANParamsDesc_template::Rel8PrioEUTRANParamsDesc_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } Rel8PrioEUTRANParamsDesc_template::Rel8PrioEUTRANParamsDesc_template(const Rel8PrioEUTRANParamsDesc& other_value) { copy_value(other_value); } Rel8PrioEUTRANParamsDesc_template::Rel8PrioEUTRANParamsDesc_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const Rel8PrioEUTRANParamsDesc&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.Rel8PrioEUTRANParamsDesc from an unbound optional field."); } } Rel8PrioEUTRANParamsDesc_template::Rel8PrioEUTRANParamsDesc_template(Rel8PrioEUTRANParamsDesc_template* p_precondition, Rel8PrioEUTRANParamsDesc_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } Rel8PrioEUTRANParamsDesc_template::Rel8PrioEUTRANParamsDesc_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; } Rel8PrioEUTRANParamsDesc_template::Rel8PrioEUTRANParamsDesc_template(const Rel8PrioEUTRANParamsDesc_template& other_value) : Base_Template() { copy_template(other_value); } Rel8PrioEUTRANParamsDesc_template::~Rel8PrioEUTRANParamsDesc_template() { clean_up(); } Rel8PrioEUTRANParamsDesc_template& Rel8PrioEUTRANParamsDesc_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } Rel8PrioEUTRANParamsDesc_template& Rel8PrioEUTRANParamsDesc_template::operator=(const Rel8PrioEUTRANParamsDesc& other_value) { clean_up(); copy_value(other_value); return *this; } Rel8PrioEUTRANParamsDesc_template& Rel8PrioEUTRANParamsDesc_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const Rel8PrioEUTRANParamsDesc&)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.Rel8PrioEUTRANParamsDesc."); } return *this; } Rel8PrioEUTRANParamsDesc_template& Rel8PrioEUTRANParamsDesc_template::operator=(const Rel8PrioEUTRANParamsDesc_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean Rel8PrioEUTRANParamsDesc_template::match(const Rel8PrioEUTRANParamsDesc& 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.sc__prio__params__desc().is_bound()) return FALSE; if(!single_value->field_sc__prio__params__desc.match(other_value.sc__prio__params__desc(), legacy))return FALSE; if(!other_value.utran__prio__params__desc().is_bound()) return FALSE; if(!single_value->field_utran__prio__params__desc.match(other_value.utran__prio__params__desc(), legacy))return FALSE; if(!other_value.eutran__params__desc().is_bound()) return FALSE; if(!single_value->field_eutran__params__desc.match(other_value.eutran__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.Rel8PrioEUTRANParamsDesc."); } return FALSE; } boolean Rel8PrioEUTRANParamsDesc_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_sc__prio__params__desc.is_bound() || single_value->field_utran__prio__params__desc.is_bound() || single_value->field_eutran__params__desc.is_bound(); } boolean Rel8PrioEUTRANParamsDesc_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_sc__prio__params__desc.is_value() && single_value->field_utran__prio__params__desc.is_value() && single_value->field_eutran__params__desc.is_value(); } void Rel8PrioEUTRANParamsDesc_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; } Rel8PrioEUTRANParamsDesc Rel8PrioEUTRANParamsDesc_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.Rel8PrioEUTRANParamsDesc."); Rel8PrioEUTRANParamsDesc ret_val; if (single_value->field_sc__prio__params__desc.is_bound()) { ret_val.sc__prio__params__desc() = single_value->field_sc__prio__params__desc.valueof(); } if (single_value->field_utran__prio__params__desc.is_bound()) { ret_val.utran__prio__params__desc() = single_value->field_utran__prio__params__desc.valueof(); } if (single_value->field_eutran__params__desc.is_bound()) { ret_val.eutran__params__desc() = single_value->field_eutran__params__desc.valueof(); } return ret_val; } void Rel8PrioEUTRANParamsDesc_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.Rel8PrioEUTRANParamsDesc."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new Rel8PrioEUTRANParamsDesc_template[list_length]; } Rel8PrioEUTRANParamsDesc_template& Rel8PrioEUTRANParamsDesc_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.Rel8PrioEUTRANParamsDesc."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.Rel8PrioEUTRANParamsDesc."); return value_list.list_value[list_index]; } ServingCellPrioParamsDescOpt_template& Rel8PrioEUTRANParamsDesc_template::sc__prio__params__desc() { set_specific(); return single_value->field_sc__prio__params__desc; } const ServingCellPrioParamsDescOpt_template& Rel8PrioEUTRANParamsDesc_template::sc__prio__params__desc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field sc_prio_params_desc of a non-specific template of type @GSM_RestOctets.Rel8PrioEUTRANParamsDesc."); return single_value->field_sc__prio__params__desc; } UTRAN__PrioParamsDescOpt_template& Rel8PrioEUTRANParamsDesc_template::utran__prio__params__desc() { set_specific(); return single_value->field_utran__prio__params__desc; } const UTRAN__PrioParamsDescOpt_template& Rel8PrioEUTRANParamsDesc_template::utran__prio__params__desc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field utran_prio_params_desc of a non-specific template of type @GSM_RestOctets.Rel8PrioEUTRANParamsDesc."); return single_value->field_utran__prio__params__desc; } EUTRAN__ParamsDescOpt_template& Rel8PrioEUTRANParamsDesc_template::eutran__params__desc() { set_specific(); return single_value->field_eutran__params__desc; } const EUTRAN__ParamsDescOpt_template& Rel8PrioEUTRANParamsDesc_template::eutran__params__desc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field eutran_params_desc of a non-specific template of type @GSM_RestOctets.Rel8PrioEUTRANParamsDesc."); return single_value->field_eutran__params__desc; } int Rel8PrioEUTRANParamsDesc_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.Rel8PrioEUTRANParamsDesc 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.Rel8PrioEUTRANParamsDesc 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.Rel8PrioEUTRANParamsDesc 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.Rel8PrioEUTRANParamsDesc containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.Rel8PrioEUTRANParamsDesc containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.Rel8PrioEUTRANParamsDesc containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.Rel8PrioEUTRANParamsDesc containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.Rel8PrioEUTRANParamsDesc containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.Rel8PrioEUTRANParamsDesc containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.Rel8PrioEUTRANParamsDesc."); } return 0; } void Rel8PrioEUTRANParamsDesc_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ sc_prio_params_desc := "); single_value->field_sc__prio__params__desc.log(); TTCN_Logger::log_event_str(", utran_prio_params_desc := "); single_value->field_utran__prio__params__desc.log(); TTCN_Logger::log_event_str(", eutran_params_desc := "); single_value->field_eutran__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 Rel8PrioEUTRANParamsDesc_template::log_match(const Rel8PrioEUTRANParamsDesc& 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_sc__prio__params__desc.match(match_value.sc__prio__params__desc(), legacy)){ TTCN_Logger::log_logmatch_info(".sc_prio_params_desc"); single_value->field_sc__prio__params__desc.log_match(match_value.sc__prio__params__desc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_utran__prio__params__desc.match(match_value.utran__prio__params__desc(), legacy)){ TTCN_Logger::log_logmatch_info(".utran_prio_params_desc"); single_value->field_utran__prio__params__desc.log_match(match_value.utran__prio__params__desc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_eutran__params__desc.match(match_value.eutran__params__desc(), legacy)){ TTCN_Logger::log_logmatch_info(".eutran_params_desc"); single_value->field_eutran__params__desc.log_match(match_value.eutran__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("{ sc_prio_params_desc := "); single_value->field_sc__prio__params__desc.log_match(match_value.sc__prio__params__desc(), legacy); TTCN_Logger::log_event_str(", utran_prio_params_desc := "); single_value->field_utran__prio__params__desc.log_match(match_value.utran__prio__params__desc(), legacy); TTCN_Logger::log_event_str(", eutran_params_desc := "); single_value->field_eutran__params__desc.log_match(match_value.eutran__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 Rel8PrioEUTRANParamsDesc_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (sc__prio__params__desc().is_bound()) sc__prio__params__desc().set_implicit_omit(); if (utran__prio__params__desc().is_bound()) utran__prio__params__desc().set_implicit_omit(); if (eutran__params__desc().is_bound()) eutran__params__desc().set_implicit_omit(); } void Rel8PrioEUTRANParamsDesc_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_sc__prio__params__desc.encode_text(text_buf); single_value->field_utran__prio__params__desc.encode_text(text_buf); single_value->field_eutran__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.Rel8PrioEUTRANParamsDesc."); } } void Rel8PrioEUTRANParamsDesc_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_sc__prio__params__desc.decode_text(text_buf); single_value->field_utran__prio__params__desc.decode_text(text_buf); single_value->field_eutran__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 Rel8PrioEUTRANParamsDesc_template[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.Rel8PrioEUTRANParamsDesc."); } } void Rel8PrioEUTRANParamsDesc_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: { Rel8PrioEUTRANParamsDesc_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) sc__prio__params__desc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) utran__prio__params__desc().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) eutran__params__desc().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(), "sc_prio_params_desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { sc__prio__params__desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "utran_prio_params_desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { utran__prio__params__desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "eutran_params_desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { eutran__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.Rel8PrioEUTRANParamsDesc: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { Rel8PrioEUTRANParamsDesc_template* precondition = new Rel8PrioEUTRANParamsDesc_template; precondition->set_param(*param.get_elem(0)); Rel8PrioEUTRANParamsDesc_template* implied_template = new Rel8PrioEUTRANParamsDesc_template; implied_template->set_param(*param.get_elem(1)); *this = Rel8PrioEUTRANParamsDesc_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.Rel8PrioEUTRANParamsDesc"); } is_ifpresent = param.get_ifpresent(); } void Rel8PrioEUTRANParamsDesc_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_sc__prio__params__desc.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.Rel8PrioEUTRANParamsDesc"); single_value->field_utran__prio__params__desc.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.Rel8PrioEUTRANParamsDesc"); single_value->field_eutran__params__desc.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.Rel8PrioEUTRANParamsDesc"); 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.Rel8PrioEUTRANParamsDesc"); } boolean Rel8PrioEUTRANParamsDesc_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean Rel8PrioEUTRANParamsDesc_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) { } Rel8UTRANCSGDescOpt::Rel8UTRANCSGDescOpt(const Rel8UTRANCSGDescOpt& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.Rel8UTRANCSGDescOpt."); 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 Rel8UTRANCSGDescOpt::clean_up() { field_presence.clean_up(); field_desc.clean_up(); } const TTCN_Typedescriptor_t* Rel8UTRANCSGDescOpt::get_descriptor() const { return &Rel8UTRANCSGDescOpt_descr_; } Rel8UTRANCSGDescOpt& Rel8UTRANCSGDescOpt::operator=(const Rel8UTRANCSGDescOpt& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.Rel8UTRANCSGDescOpt."); 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 Rel8UTRANCSGDescOpt::operator==(const Rel8UTRANCSGDescOpt& other_value) const { return field_presence==other_value.field_presence && field_desc==other_value.field_desc; } boolean Rel8UTRANCSGDescOpt::is_bound() const { return (field_presence.is_bound()) || (OPTIONAL_OMIT == field_desc.get_selection() || field_desc.is_bound()); } boolean Rel8UTRANCSGDescOpt::is_value() const { return field_presence.is_value() && (OPTIONAL_OMIT == field_desc.get_selection() || field_desc.is_value()); } int Rel8UTRANCSGDescOpt::size_of() const { int ret_val = 1; if (field_desc.ispresent()) ret_val++; return ret_val; } void Rel8UTRANCSGDescOpt::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 Rel8UTRANCSGDescOpt::set_implicit_omit() { if (presence().is_bound()) presence().set_implicit_omit(); if (!desc().is_bound()) desc() = OMIT_VALUE; else desc().set_implicit_omit(); } void Rel8UTRANCSGDescOpt::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.Rel8UTRANCSGDescOpt: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.Rel8UTRANCSGDescOpt"); } } void Rel8UTRANCSGDescOpt::encode_text(Text_Buf& text_buf) const { field_presence.encode_text(text_buf); field_desc.encode_text(text_buf); } void Rel8UTRANCSGDescOpt::decode_text(Text_Buf& text_buf) { field_presence.decode_text(text_buf); field_desc.decode_text(text_buf); } void Rel8UTRANCSGDescOpt::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 Rel8UTRANCSGDescOpt::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 Rel8UTRANCSGDescOpt::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, Rel8UTRANCSGDescOpt_presence_descr_.raw->forceomit); decoded_field_length = field_presence.RAW_decode(Rel8UTRANCSGDescOpt_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, Rel8UTRANCSGDescOpt_desc_descr_.raw->forceomit); decoded_field_length = field_desc().RAW_decode(Rel8UTRANCSGDescOpt_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 Rel8UTRANCSGDescOpt::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, Rel8UTRANCSGDescOpt_presence_descr_.raw); if (field_desc.ispresent()) { myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, Rel8UTRANCSGDescOpt_desc_descr_.raw); } else myleaf.body.node.nodes[1] = NULL; encoded_length += field_presence.RAW_encode(Rel8UTRANCSGDescOpt_presence_descr_, *myleaf.body.node.nodes[0]); if (field_desc.ispresent()) { encoded_length += field_desc().RAW_encode(Rel8UTRANCSGDescOpt_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(Rel8UTRANCSGDescOpt_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 Rel8UTRANCSGDescOpt_template::single_value_struct { BITSTRING_template field_presence; BITSTRING_template field_desc; }; void Rel8UTRANCSGDescOpt_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 Rel8UTRANCSGDescOpt_template::copy_value(const Rel8UTRANCSGDescOpt& 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 Rel8UTRANCSGDescOpt_template::copy_template(const Rel8UTRANCSGDescOpt_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 Rel8UTRANCSGDescOpt_template[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 Rel8UTRANCSGDescOpt_template(*other_value.implication_.precondition); implication_.implied_template = new Rel8UTRANCSGDescOpt_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.Rel8UTRANCSGDescOpt."); break; } set_selection(other_value); } Rel8UTRANCSGDescOpt_template::Rel8UTRANCSGDescOpt_template() { } Rel8UTRANCSGDescOpt_template::Rel8UTRANCSGDescOpt_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } Rel8UTRANCSGDescOpt_template::Rel8UTRANCSGDescOpt_template(const Rel8UTRANCSGDescOpt& other_value) { copy_value(other_value); } Rel8UTRANCSGDescOpt_template::Rel8UTRANCSGDescOpt_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const Rel8UTRANCSGDescOpt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.Rel8UTRANCSGDescOpt from an unbound optional field."); } } Rel8UTRANCSGDescOpt_template::Rel8UTRANCSGDescOpt_template(Rel8UTRANCSGDescOpt_template* p_precondition, Rel8UTRANCSGDescOpt_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } Rel8UTRANCSGDescOpt_template::Rel8UTRANCSGDescOpt_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; } Rel8UTRANCSGDescOpt_template::Rel8UTRANCSGDescOpt_template(const Rel8UTRANCSGDescOpt_template& other_value) : Base_Template() { copy_template(other_value); } Rel8UTRANCSGDescOpt_template::~Rel8UTRANCSGDescOpt_template() { clean_up(); } Rel8UTRANCSGDescOpt_template& Rel8UTRANCSGDescOpt_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } Rel8UTRANCSGDescOpt_template& Rel8UTRANCSGDescOpt_template::operator=(const Rel8UTRANCSGDescOpt& other_value) { clean_up(); copy_value(other_value); return *this; } Rel8UTRANCSGDescOpt_template& Rel8UTRANCSGDescOpt_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const Rel8UTRANCSGDescOpt&)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.Rel8UTRANCSGDescOpt."); } return *this; } Rel8UTRANCSGDescOpt_template& Rel8UTRANCSGDescOpt_template::operator=(const Rel8UTRANCSGDescOpt_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean Rel8UTRANCSGDescOpt_template::match(const Rel8UTRANCSGDescOpt& 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.Rel8UTRANCSGDescOpt."); } return FALSE; } boolean Rel8UTRANCSGDescOpt_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 Rel8UTRANCSGDescOpt_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 Rel8UTRANCSGDescOpt_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; } Rel8UTRANCSGDescOpt Rel8UTRANCSGDescOpt_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.Rel8UTRANCSGDescOpt."); Rel8UTRANCSGDescOpt 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 Rel8UTRANCSGDescOpt_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.Rel8UTRANCSGDescOpt."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new Rel8UTRANCSGDescOpt_template[list_length]; } Rel8UTRANCSGDescOpt_template& Rel8UTRANCSGDescOpt_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.Rel8UTRANCSGDescOpt."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.Rel8UTRANCSGDescOpt."); return value_list.list_value[list_index]; } BITSTRING_template& Rel8UTRANCSGDescOpt_template::presence() { set_specific(); return single_value->field_presence; } const BITSTRING_template& Rel8UTRANCSGDescOpt_template::presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field presence of a non-specific template of type @GSM_RestOctets.Rel8UTRANCSGDescOpt."); return single_value->field_presence; } BITSTRING_template& Rel8UTRANCSGDescOpt_template::desc() { set_specific(); return single_value->field_desc; } const BITSTRING_template& Rel8UTRANCSGDescOpt_template::desc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field desc of a non-specific template of type @GSM_RestOctets.Rel8UTRANCSGDescOpt."); return single_value->field_desc; } int Rel8UTRANCSGDescOpt_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.Rel8UTRANCSGDescOpt 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.Rel8UTRANCSGDescOpt 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.Rel8UTRANCSGDescOpt 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.Rel8UTRANCSGDescOpt containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.Rel8UTRANCSGDescOpt containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.Rel8UTRANCSGDescOpt containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.Rel8UTRANCSGDescOpt containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.Rel8UTRANCSGDescOpt containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.Rel8UTRANCSGDescOpt containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.Rel8UTRANCSGDescOpt."); } return 0; } void Rel8UTRANCSGDescOpt_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 Rel8UTRANCSGDescOpt_template::log_match(const Rel8UTRANCSGDescOpt& 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 Rel8UTRANCSGDescOpt_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 Rel8UTRANCSGDescOpt_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.Rel8UTRANCSGDescOpt."); } } void Rel8UTRANCSGDescOpt_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 Rel8UTRANCSGDescOpt_template[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.Rel8UTRANCSGDescOpt."); } } void Rel8UTRANCSGDescOpt_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: { Rel8UTRANCSGDescOpt_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.Rel8UTRANCSGDescOpt: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { Rel8UTRANCSGDescOpt_template* precondition = new Rel8UTRANCSGDescOpt_template; precondition->set_param(*param.get_elem(0)); Rel8UTRANCSGDescOpt_template* implied_template = new Rel8UTRANCSGDescOpt_template; implied_template->set_param(*param.get_elem(1)); *this = Rel8UTRANCSGDescOpt_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.Rel8UTRANCSGDescOpt"); } is_ifpresent = param.get_ifpresent(); } void Rel8UTRANCSGDescOpt_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.Rel8UTRANCSGDescOpt"); single_value->field_desc.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.Rel8UTRANCSGDescOpt"); 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.Rel8UTRANCSGDescOpt"); } boolean Rel8UTRANCSGDescOpt_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean Rel8UTRANCSGDescOpt_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) { } Rel8EUTRANCSGDescOpt::Rel8EUTRANCSGDescOpt(const Rel8EUTRANCSGDescOpt& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.Rel8EUTRANCSGDescOpt."); 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 Rel8EUTRANCSGDescOpt::clean_up() { field_presence.clean_up(); field_desc.clean_up(); } const TTCN_Typedescriptor_t* Rel8EUTRANCSGDescOpt::get_descriptor() const { return &Rel8EUTRANCSGDescOpt_descr_; } Rel8EUTRANCSGDescOpt& Rel8EUTRANCSGDescOpt::operator=(const Rel8EUTRANCSGDescOpt& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.Rel8EUTRANCSGDescOpt."); 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 Rel8EUTRANCSGDescOpt::operator==(const Rel8EUTRANCSGDescOpt& other_value) const { return field_presence==other_value.field_presence && field_desc==other_value.field_desc; } boolean Rel8EUTRANCSGDescOpt::is_bound() const { return (field_presence.is_bound()) || (OPTIONAL_OMIT == field_desc.get_selection() || field_desc.is_bound()); } boolean Rel8EUTRANCSGDescOpt::is_value() const { return field_presence.is_value() && (OPTIONAL_OMIT == field_desc.get_selection() || field_desc.is_value()); } int Rel8EUTRANCSGDescOpt::size_of() const { int ret_val = 1; if (field_desc.ispresent()) ret_val++; return ret_val; } void Rel8EUTRANCSGDescOpt::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 Rel8EUTRANCSGDescOpt::set_implicit_omit() { if (presence().is_bound()) presence().set_implicit_omit(); if (!desc().is_bound()) desc() = OMIT_VALUE; else desc().set_implicit_omit(); } void Rel8EUTRANCSGDescOpt::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.Rel8EUTRANCSGDescOpt: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.Rel8EUTRANCSGDescOpt"); } } void Rel8EUTRANCSGDescOpt::encode_text(Text_Buf& text_buf) const { field_presence.encode_text(text_buf); field_desc.encode_text(text_buf); } void Rel8EUTRANCSGDescOpt::decode_text(Text_Buf& text_buf) { field_presence.decode_text(text_buf); field_desc.decode_text(text_buf); } void Rel8EUTRANCSGDescOpt::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 Rel8EUTRANCSGDescOpt::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 Rel8EUTRANCSGDescOpt::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, Rel8EUTRANCSGDescOpt_presence_descr_.raw->forceomit); decoded_field_length = field_presence.RAW_decode(Rel8EUTRANCSGDescOpt_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, Rel8EUTRANCSGDescOpt_desc_descr_.raw->forceomit); decoded_field_length = field_desc().RAW_decode(Rel8EUTRANCSGDescOpt_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 Rel8EUTRANCSGDescOpt::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, Rel8EUTRANCSGDescOpt_presence_descr_.raw); if (field_desc.ispresent()) { myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, Rel8EUTRANCSGDescOpt_desc_descr_.raw); } else myleaf.body.node.nodes[1] = NULL; encoded_length += field_presence.RAW_encode(Rel8EUTRANCSGDescOpt_presence_descr_, *myleaf.body.node.nodes[0]); if (field_desc.ispresent()) { encoded_length += field_desc().RAW_encode(Rel8EUTRANCSGDescOpt_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(Rel8EUTRANCSGDescOpt_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 Rel8EUTRANCSGDescOpt_template::single_value_struct { BITSTRING_template field_presence; BITSTRING_template field_desc; }; void Rel8EUTRANCSGDescOpt_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 Rel8EUTRANCSGDescOpt_template::copy_value(const Rel8EUTRANCSGDescOpt& 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 Rel8EUTRANCSGDescOpt_template::copy_template(const Rel8EUTRANCSGDescOpt_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 Rel8EUTRANCSGDescOpt_template[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 Rel8EUTRANCSGDescOpt_template(*other_value.implication_.precondition); implication_.implied_template = new Rel8EUTRANCSGDescOpt_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.Rel8EUTRANCSGDescOpt."); break; } set_selection(other_value); } Rel8EUTRANCSGDescOpt_template::Rel8EUTRANCSGDescOpt_template() { } Rel8EUTRANCSGDescOpt_template::Rel8EUTRANCSGDescOpt_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } Rel8EUTRANCSGDescOpt_template::Rel8EUTRANCSGDescOpt_template(const Rel8EUTRANCSGDescOpt& other_value) { copy_value(other_value); } Rel8EUTRANCSGDescOpt_template::Rel8EUTRANCSGDescOpt_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const Rel8EUTRANCSGDescOpt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.Rel8EUTRANCSGDescOpt from an unbound optional field."); } } Rel8EUTRANCSGDescOpt_template::Rel8EUTRANCSGDescOpt_template(Rel8EUTRANCSGDescOpt_template* p_precondition, Rel8EUTRANCSGDescOpt_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } Rel8EUTRANCSGDescOpt_template::Rel8EUTRANCSGDescOpt_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; } Rel8EUTRANCSGDescOpt_template::Rel8EUTRANCSGDescOpt_template(const Rel8EUTRANCSGDescOpt_template& other_value) : Base_Template() { copy_template(other_value); } Rel8EUTRANCSGDescOpt_template::~Rel8EUTRANCSGDescOpt_template() { clean_up(); } Rel8EUTRANCSGDescOpt_template& Rel8EUTRANCSGDescOpt_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } Rel8EUTRANCSGDescOpt_template& Rel8EUTRANCSGDescOpt_template::operator=(const Rel8EUTRANCSGDescOpt& other_value) { clean_up(); copy_value(other_value); return *this; } Rel8EUTRANCSGDescOpt_template& Rel8EUTRANCSGDescOpt_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const Rel8EUTRANCSGDescOpt&)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.Rel8EUTRANCSGDescOpt."); } return *this; } Rel8EUTRANCSGDescOpt_template& Rel8EUTRANCSGDescOpt_template::operator=(const Rel8EUTRANCSGDescOpt_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean Rel8EUTRANCSGDescOpt_template::match(const Rel8EUTRANCSGDescOpt& 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.Rel8EUTRANCSGDescOpt."); } return FALSE; } boolean Rel8EUTRANCSGDescOpt_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 Rel8EUTRANCSGDescOpt_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 Rel8EUTRANCSGDescOpt_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; } Rel8EUTRANCSGDescOpt Rel8EUTRANCSGDescOpt_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.Rel8EUTRANCSGDescOpt."); Rel8EUTRANCSGDescOpt 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 Rel8EUTRANCSGDescOpt_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.Rel8EUTRANCSGDescOpt."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new Rel8EUTRANCSGDescOpt_template[list_length]; } Rel8EUTRANCSGDescOpt_template& Rel8EUTRANCSGDescOpt_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.Rel8EUTRANCSGDescOpt."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.Rel8EUTRANCSGDescOpt."); return value_list.list_value[list_index]; } BITSTRING_template& Rel8EUTRANCSGDescOpt_template::presence() { set_specific(); return single_value->field_presence; } const BITSTRING_template& Rel8EUTRANCSGDescOpt_template::presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field presence of a non-specific template of type @GSM_RestOctets.Rel8EUTRANCSGDescOpt."); return single_value->field_presence; } BITSTRING_template& Rel8EUTRANCSGDescOpt_template::desc() { set_specific(); return single_value->field_desc; } const BITSTRING_template& Rel8EUTRANCSGDescOpt_template::desc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field desc of a non-specific template of type @GSM_RestOctets.Rel8EUTRANCSGDescOpt."); return single_value->field_desc; } int Rel8EUTRANCSGDescOpt_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.Rel8EUTRANCSGDescOpt 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.Rel8EUTRANCSGDescOpt 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.Rel8EUTRANCSGDescOpt 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.Rel8EUTRANCSGDescOpt containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.Rel8EUTRANCSGDescOpt containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.Rel8EUTRANCSGDescOpt containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.Rel8EUTRANCSGDescOpt containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.Rel8EUTRANCSGDescOpt containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.Rel8EUTRANCSGDescOpt containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.Rel8EUTRANCSGDescOpt."); } return 0; } void Rel8EUTRANCSGDescOpt_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 Rel8EUTRANCSGDescOpt_template::log_match(const Rel8EUTRANCSGDescOpt& 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 Rel8EUTRANCSGDescOpt_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 Rel8EUTRANCSGDescOpt_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.Rel8EUTRANCSGDescOpt."); } } void Rel8EUTRANCSGDescOpt_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 Rel8EUTRANCSGDescOpt_template[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.Rel8EUTRANCSGDescOpt."); } } void Rel8EUTRANCSGDescOpt_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: { Rel8EUTRANCSGDescOpt_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.Rel8EUTRANCSGDescOpt: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { Rel8EUTRANCSGDescOpt_template* precondition = new Rel8EUTRANCSGDescOpt_template; precondition->set_param(*param.get_elem(0)); Rel8EUTRANCSGDescOpt_template* implied_template = new Rel8EUTRANCSGDescOpt_template; implied_template->set_param(*param.get_elem(1)); *this = Rel8EUTRANCSGDescOpt_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.Rel8EUTRANCSGDescOpt"); } is_ifpresent = param.get_ifpresent(); } void Rel8EUTRANCSGDescOpt_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.Rel8EUTRANCSGDescOpt"); single_value->field_desc.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.Rel8EUTRANCSGDescOpt"); 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.Rel8EUTRANCSGDescOpt"); } boolean Rel8EUTRANCSGDescOpt_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean Rel8EUTRANCSGDescOpt_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) prio__eutran__params__desc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) utran__csg__desc().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) eutran__csg__desc().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(), "prio_eutran_params_desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { prio__eutran__params__desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "utran_csg_desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { utran__csg__desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "eutran_csg_desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { eutran__csg__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.SI2quaterR8Additions: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.SI2quaterR8Additions"); } } void SI2quaterR8Additions::encode_text(Text_Buf& text_buf) const { field_prio__eutran__params__desc.encode_text(text_buf); field_utran__csg__desc.encode_text(text_buf); field_eutran__csg__desc.encode_text(text_buf); } void SI2quaterR8Additions::decode_text(Text_Buf& text_buf) { field_prio__eutran__params__desc.decode_text(text_buf); field_utran__csg__desc.decode_text(text_buf); field_eutran__csg__desc.decode_text(text_buf); } void SI2quaterR8Additions::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 SI2quaterR8Additions::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 SI2quaterR8Additions::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, SI2quaterR8Additions_prio__eutran__params__desc_descr_.raw->forceomit); decoded_field_length = field_prio__eutran__params__desc.RAW_decode(SI2quaterR8Additions_prio__eutran__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, SI2quaterR8Additions_utran__csg__desc_descr_.raw->forceomit); decoded_field_length = field_utran__csg__desc.RAW_decode(SI2quaterR8Additions_utran__csg__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, SI2quaterR8Additions_eutran__csg__desc_descr_.raw->forceomit); decoded_field_length = field_eutran__csg__desc.RAW_decode(SI2quaterR8Additions_eutran__csg__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()); p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int SI2quaterR8Additions::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, SI2quaterR8Additions_prio__eutran__params__desc_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, SI2quaterR8Additions_utran__csg__desc_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, SI2quaterR8Additions_eutran__csg__desc_descr_.raw); encoded_length += field_prio__eutran__params__desc.RAW_encode(SI2quaterR8Additions_prio__eutran__params__desc_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_utran__csg__desc.RAW_encode(SI2quaterR8Additions_utran__csg__desc_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_eutran__csg__desc.RAW_encode(SI2quaterR8Additions_eutran__csg__desc_descr_, *myleaf.body.node.nodes[2]); return myleaf.length = encoded_length; } struct SI2quaterR8Additions_template::single_value_struct { Rel8PrioEUTRANParamsDescOpt_template field_prio__eutran__params__desc; Rel8UTRANCSGDescOpt_template field_utran__csg__desc; Rel8EUTRANCSGDescOpt_template field_eutran__csg__desc; }; void SI2quaterR8Additions_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_prio__eutran__params__desc = ANY_VALUE; single_value->field_utran__csg__desc = ANY_VALUE; single_value->field_eutran__csg__desc = ANY_VALUE; } } } void SI2quaterR8Additions_template::copy_value(const SI2quaterR8Additions& other_value) { single_value = new single_value_struct; if (other_value.prio__eutran__params__desc().is_bound()) { single_value->field_prio__eutran__params__desc = other_value.prio__eutran__params__desc(); } else { single_value->field_prio__eutran__params__desc.clean_up(); } if (other_value.utran__csg__desc().is_bound()) { single_value->field_utran__csg__desc = other_value.utran__csg__desc(); } else { single_value->field_utran__csg__desc.clean_up(); } if (other_value.eutran__csg__desc().is_bound()) { single_value->field_eutran__csg__desc = other_value.eutran__csg__desc(); } else { single_value->field_eutran__csg__desc.clean_up(); } set_selection(SPECIFIC_VALUE); } void SI2quaterR8Additions_template::copy_template(const SI2quaterR8Additions_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.prio__eutran__params__desc().get_selection()) { single_value->field_prio__eutran__params__desc = other_value.prio__eutran__params__desc(); } else { single_value->field_prio__eutran__params__desc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.utran__csg__desc().get_selection()) { single_value->field_utran__csg__desc = other_value.utran__csg__desc(); } else { single_value->field_utran__csg__desc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.eutran__csg__desc().get_selection()) { single_value->field_eutran__csg__desc = other_value.eutran__csg__desc(); } else { single_value->field_eutran__csg__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 SI2quaterR8Additions_template[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 SI2quaterR8Additions_template(*other_value.implication_.precondition); implication_.implied_template = new SI2quaterR8Additions_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.SI2quaterR8Additions."); break; } set_selection(other_value); } SI2quaterR8Additions_template::SI2quaterR8Additions_template() { } SI2quaterR8Additions_template::SI2quaterR8Additions_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } SI2quaterR8Additions_template::SI2quaterR8Additions_template(const SI2quaterR8Additions& other_value) { copy_value(other_value); } SI2quaterR8Additions_template::SI2quaterR8Additions_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI2quaterR8Additions&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.SI2quaterR8Additions from an unbound optional field."); } } SI2quaterR8Additions_template::SI2quaterR8Additions_template(SI2quaterR8Additions_template* p_precondition, SI2quaterR8Additions_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } SI2quaterR8Additions_template::SI2quaterR8Additions_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; } SI2quaterR8Additions_template::SI2quaterR8Additions_template(const SI2quaterR8Additions_template& other_value) : Base_Template() { copy_template(other_value); } SI2quaterR8Additions_template::~SI2quaterR8Additions_template() { clean_up(); } SI2quaterR8Additions_template& SI2quaterR8Additions_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } SI2quaterR8Additions_template& SI2quaterR8Additions_template::operator=(const SI2quaterR8Additions& other_value) { clean_up(); copy_value(other_value); return *this; } SI2quaterR8Additions_template& SI2quaterR8Additions_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI2quaterR8Additions&)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.SI2quaterR8Additions."); } return *this; } SI2quaterR8Additions_template& SI2quaterR8Additions_template::operator=(const SI2quaterR8Additions_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean SI2quaterR8Additions_template::match(const SI2quaterR8Additions& 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.prio__eutran__params__desc().is_bound()) return FALSE; if(!single_value->field_prio__eutran__params__desc.match(other_value.prio__eutran__params__desc(), legacy))return FALSE; if(!other_value.utran__csg__desc().is_bound()) return FALSE; if(!single_value->field_utran__csg__desc.match(other_value.utran__csg__desc(), legacy))return FALSE; if(!other_value.eutran__csg__desc().is_bound()) return FALSE; if(!single_value->field_eutran__csg__desc.match(other_value.eutran__csg__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.SI2quaterR8Additions."); } return FALSE; } boolean SI2quaterR8Additions_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_prio__eutran__params__desc.is_bound() || single_value->field_utran__csg__desc.is_bound() || single_value->field_eutran__csg__desc.is_bound(); } boolean SI2quaterR8Additions_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_prio__eutran__params__desc.is_value() && single_value->field_utran__csg__desc.is_value() && single_value->field_eutran__csg__desc.is_value(); } void SI2quaterR8Additions_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; } SI2quaterR8Additions SI2quaterR8Additions_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.SI2quaterR8Additions."); SI2quaterR8Additions ret_val; if (single_value->field_prio__eutran__params__desc.is_bound()) { ret_val.prio__eutran__params__desc() = single_value->field_prio__eutran__params__desc.valueof(); } if (single_value->field_utran__csg__desc.is_bound()) { ret_val.utran__csg__desc() = single_value->field_utran__csg__desc.valueof(); } if (single_value->field_eutran__csg__desc.is_bound()) { ret_val.eutran__csg__desc() = single_value->field_eutran__csg__desc.valueof(); } return ret_val; } void SI2quaterR8Additions_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.SI2quaterR8Additions."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new SI2quaterR8Additions_template[list_length]; } SI2quaterR8Additions_template& SI2quaterR8Additions_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.SI2quaterR8Additions."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.SI2quaterR8Additions."); return value_list.list_value[list_index]; } Rel8PrioEUTRANParamsDescOpt_template& SI2quaterR8Additions_template::prio__eutran__params__desc() { set_specific(); return single_value->field_prio__eutran__params__desc; } const Rel8PrioEUTRANParamsDescOpt_template& SI2quaterR8Additions_template::prio__eutran__params__desc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field prio_eutran_params_desc of a non-specific template of type @GSM_RestOctets.SI2quaterR8Additions."); return single_value->field_prio__eutran__params__desc; } Rel8UTRANCSGDescOpt_template& SI2quaterR8Additions_template::utran__csg__desc() { set_specific(); return single_value->field_utran__csg__desc; } const Rel8UTRANCSGDescOpt_template& SI2quaterR8Additions_template::utran__csg__desc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field utran_csg_desc of a non-specific template of type @GSM_RestOctets.SI2quaterR8Additions."); return single_value->field_utran__csg__desc; } Rel8EUTRANCSGDescOpt_template& SI2quaterR8Additions_template::eutran__csg__desc() { set_specific(); return single_value->field_eutran__csg__desc; } const Rel8EUTRANCSGDescOpt_template& SI2quaterR8Additions_template::eutran__csg__desc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field eutran_csg_desc of a non-specific template of type @GSM_RestOctets.SI2quaterR8Additions."); return single_value->field_eutran__csg__desc; } int SI2quaterR8Additions_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterR8Additions 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.SI2quaterR8Additions 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.SI2quaterR8Additions 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.SI2quaterR8Additions containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterR8Additions containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterR8Additions containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterR8Additions containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterR8Additions containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterR8Additions containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.SI2quaterR8Additions."); } return 0; } void SI2quaterR8Additions_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ prio_eutran_params_desc := "); single_value->field_prio__eutran__params__desc.log(); TTCN_Logger::log_event_str(", utran_csg_desc := "); single_value->field_utran__csg__desc.log(); TTCN_Logger::log_event_str(", eutran_csg_desc := "); single_value->field_eutran__csg__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 SI2quaterR8Additions_template::log_match(const SI2quaterR8Additions& 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_prio__eutran__params__desc.match(match_value.prio__eutran__params__desc(), legacy)){ TTCN_Logger::log_logmatch_info(".prio_eutran_params_desc"); single_value->field_prio__eutran__params__desc.log_match(match_value.prio__eutran__params__desc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_utran__csg__desc.match(match_value.utran__csg__desc(), legacy)){ TTCN_Logger::log_logmatch_info(".utran_csg_desc"); single_value->field_utran__csg__desc.log_match(match_value.utran__csg__desc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_eutran__csg__desc.match(match_value.eutran__csg__desc(), legacy)){ TTCN_Logger::log_logmatch_info(".eutran_csg_desc"); single_value->field_eutran__csg__desc.log_match(match_value.eutran__csg__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("{ prio_eutran_params_desc := "); single_value->field_prio__eutran__params__desc.log_match(match_value.prio__eutran__params__desc(), legacy); TTCN_Logger::log_event_str(", utran_csg_desc := "); single_value->field_utran__csg__desc.log_match(match_value.utran__csg__desc(), legacy); TTCN_Logger::log_event_str(", eutran_csg_desc := "); single_value->field_eutran__csg__desc.log_match(match_value.eutran__csg__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 SI2quaterR8Additions_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (prio__eutran__params__desc().is_bound()) prio__eutran__params__desc().set_implicit_omit(); if (utran__csg__desc().is_bound()) utran__csg__desc().set_implicit_omit(); if (eutran__csg__desc().is_bound()) eutran__csg__desc().set_implicit_omit(); } void SI2quaterR8Additions_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_prio__eutran__params__desc.encode_text(text_buf); single_value->field_utran__csg__desc.encode_text(text_buf); single_value->field_eutran__csg__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.SI2quaterR8Additions."); } } void SI2quaterR8Additions_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_prio__eutran__params__desc.decode_text(text_buf); single_value->field_utran__csg__desc.decode_text(text_buf); single_value->field_eutran__csg__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 SI2quaterR8Additions_template[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.SI2quaterR8Additions."); } } void SI2quaterR8Additions_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: { SI2quaterR8Additions_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) prio__eutran__params__desc().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) utran__csg__desc().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) eutran__csg__desc().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(), "prio_eutran_params_desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { prio__eutran__params__desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "utran_csg_desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { utran__csg__desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "eutran_csg_desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { eutran__csg__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.SI2quaterR8Additions: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { SI2quaterR8Additions_template* precondition = new SI2quaterR8Additions_template; precondition->set_param(*param.get_elem(0)); SI2quaterR8Additions_template* implied_template = new SI2quaterR8Additions_template; implied_template->set_param(*param.get_elem(1)); *this = SI2quaterR8Additions_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.SI2quaterR8Additions"); } is_ifpresent = param.get_ifpresent(); } void SI2quaterR8Additions_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_prio__eutran__params__desc.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI2quaterR8Additions"); single_value->field_utran__csg__desc.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI2quaterR8Additions"); single_value->field_eutran__csg__desc.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI2quaterR8Additions"); 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.SI2quaterR8Additions"); } boolean SI2quaterR8Additions_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean SI2quaterR8Additions_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) ba__ind().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ba__3g__ind().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) mp__change__mark().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) si2quater__index().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) si2quater__count().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) meas__params__desc().set_param(*param.get_elem(5)); if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) gprs().set_param(*param.get_elem(6)); if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) nc__meas__params().set_param(*param.get_elem(7)); if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) ext__info().set_param(*param.get_elem(8)); if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) utran__neigh__desc().set_param(*param.get_elem(9)); if (param.get_size()>10 && param.get_elem(10)->get_type()!=Module_Param::MP_NotUsed) utran__meas__params__desc().set_param(*param.get_elem(10)); if (param.get_size()>11 && param.get_elem(11)->get_type()!=Module_Param::MP_NotUsed) utran__gprs__meas__params__desc().set_param(*param.get_elem(11)); if (param.get_size()>12 && param.get_elem(12)->get_type()!=Module_Param::MP_NotUsed) rel__additions().set_param(*param.get_elem(12)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "ba_ind")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ba__ind().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ba_3g_ind")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ba__3g__ind().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mp_change_mark")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mp__change__mark().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "si2quater_index")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { si2quater__index().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "si2quater_count")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { si2quater__count().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")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { gprs().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nc_meas_params")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nc__meas__params().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ext_info")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ext__info().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "utran_neigh_desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { utran__neigh__desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "utran_meas_params_desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { utran__meas__params__desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "utran_gprs_meas_params_desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { utran__gprs__meas__params__desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "rel_additions")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rel__additions().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: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.SI2quaterRestOctets"); } } void SI2quaterRestOctets::encode_text(Text_Buf& text_buf) const { field_ba__ind.encode_text(text_buf); field_ba__3g__ind.encode_text(text_buf); field_mp__change__mark.encode_text(text_buf); field_si2quater__index.encode_text(text_buf); field_si2quater__count.encode_text(text_buf); field_meas__params__desc.encode_text(text_buf); field_gprs.encode_text(text_buf); field_nc__meas__params.encode_text(text_buf); field_ext__info.encode_text(text_buf); field_utran__neigh__desc.encode_text(text_buf); field_utran__meas__params__desc.encode_text(text_buf); field_utran__gprs__meas__params__desc.encode_text(text_buf); field_rel__additions.encode_text(text_buf); } void SI2quaterRestOctets::decode_text(Text_Buf& text_buf) { field_ba__ind.decode_text(text_buf); field_ba__3g__ind.decode_text(text_buf); field_mp__change__mark.decode_text(text_buf); field_si2quater__index.decode_text(text_buf); field_si2quater__count.decode_text(text_buf); field_meas__params__desc.decode_text(text_buf); field_gprs.decode_text(text_buf); field_nc__meas__params.decode_text(text_buf); field_ext__info.decode_text(text_buf); field_utran__neigh__desc.decode_text(text_buf); field_utran__meas__params__desc.decode_text(text_buf); field_utran__gprs__meas__params__desc.decode_text(text_buf); field_rel__additions.decode_text(text_buf); } void SI2quaterRestOctets::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::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::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_ba__ind_descr_.raw->forceomit); decoded_field_length = field_ba__ind.RAW_decode(SI2quaterRestOctets_ba__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, SI2quaterRestOctets_ba__3g__ind_descr_.raw->forceomit); decoded_field_length = field_ba__3g__ind.RAW_decode(SI2quaterRestOctets_ba__3g__ind_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_mp__change__mark_descr_.raw->forceomit); decoded_field_length = field_mp__change__mark.RAW_decode(SI2quaterRestOctets_mp__change__mark_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_si2quater__index_descr_.raw->forceomit); decoded_field_length = field_si2quater__index.RAW_decode(SI2quaterRestOctets_si2quater__index_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, SI2quaterRestOctets_si2quater__count_descr_.raw->forceomit); decoded_field_length = field_si2quater__count.RAW_decode(SI2quaterRestOctets_si2quater__count_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, SI2quaterRestOctets_meas__params__desc_descr_.raw->forceomit); decoded_field_length = field_meas__params__desc.RAW_decode(SI2quaterRestOctets_meas__params__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()); RAW_Force_Omit field_6_force_omit(6, force_omit, SI2quaterRestOctets_gprs_descr_.raw->forceomit); decoded_field_length = field_gprs.RAW_decode(SI2quaterRestOctets_gprs_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_6_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); RAW_Force_Omit field_7_force_omit(7, force_omit, SI2quaterRestOctets_nc__meas__params_descr_.raw->forceomit); decoded_field_length = field_nc__meas__params.RAW_decode(SI2quaterRestOctets_nc__meas__params_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_7_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); RAW_Force_Omit field_8_force_omit(8, force_omit, SI2quaterRestOctets_ext__info_descr_.raw->forceomit); decoded_field_length = field_ext__info.RAW_decode(SI2quaterRestOctets_ext__info_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()); RAW_Force_Omit field_9_force_omit(9, force_omit, SI2quaterRestOctets_utran__neigh__desc_descr_.raw->forceomit); decoded_field_length = field_utran__neigh__desc.RAW_decode(SI2quaterRestOctets_utran__neigh__desc_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_9_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); RAW_Force_Omit field_10_force_omit(10, force_omit, SI2quaterRestOctets_utran__meas__params__desc_descr_.raw->forceomit); decoded_field_length = field_utran__meas__params__desc.RAW_decode(SI2quaterRestOctets_utran__meas__params__desc_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()); RAW_Force_Omit field_11_force_omit(11, force_omit, SI2quaterRestOctets_utran__gprs__meas__params__desc_descr_.raw->forceomit); decoded_field_length = field_utran__gprs__meas__params__desc.RAW_decode(SI2quaterRestOctets_utran__gprs__meas__params__desc_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_11_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); RAW_Force_Omit field_12_force_omit(12, force_omit, SI2quaterRestOctets_rel__additions_descr_.raw->forceomit); decoded_field_length = field_rel__additions.RAW_decode(SI2quaterRestOctets_rel__additions_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_12_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int SI2quaterRestOctets::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const { if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value."); int encoded_length = 0; myleaf.isleaf = FALSE; myleaf.body.node.num_of_nodes = 13; myleaf.body.node.nodes = init_nodes_of_enc_tree(13); myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, SI2quaterRestOctets_ba__ind_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, SI2quaterRestOctets_ba__3g__ind_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, SI2quaterRestOctets_mp__change__mark_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, SI2quaterRestOctets_si2quater__index_descr_.raw); myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, SI2quaterRestOctets_si2quater__count_descr_.raw); myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, SI2quaterRestOctets_meas__params__desc_descr_.raw); myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, SI2quaterRestOctets_gprs_descr_.raw); myleaf.body.node.nodes[7] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 7, SI2quaterRestOctets_nc__meas__params_descr_.raw); myleaf.body.node.nodes[8] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 8, SI2quaterRestOctets_ext__info_descr_.raw); myleaf.body.node.nodes[9] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 9, SI2quaterRestOctets_utran__neigh__desc_descr_.raw); myleaf.body.node.nodes[10] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 10, SI2quaterRestOctets_utran__meas__params__desc_descr_.raw); myleaf.body.node.nodes[11] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 11, SI2quaterRestOctets_utran__gprs__meas__params__desc_descr_.raw); myleaf.body.node.nodes[12] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 12, SI2quaterRestOctets_rel__additions_descr_.raw); encoded_length += field_ba__ind.RAW_encode(SI2quaterRestOctets_ba__ind_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_ba__3g__ind.RAW_encode(SI2quaterRestOctets_ba__3g__ind_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_mp__change__mark.RAW_encode(SI2quaterRestOctets_mp__change__mark_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_si2quater__index.RAW_encode(SI2quaterRestOctets_si2quater__index_descr_, *myleaf.body.node.nodes[3]); encoded_length += field_si2quater__count.RAW_encode(SI2quaterRestOctets_si2quater__count_descr_, *myleaf.body.node.nodes[4]); encoded_length += field_meas__params__desc.RAW_encode(SI2quaterRestOctets_meas__params__desc_descr_, *myleaf.body.node.nodes[5]); encoded_length += field_gprs.RAW_encode(SI2quaterRestOctets_gprs_descr_, *myleaf.body.node.nodes[6]); encoded_length += field_nc__meas__params.RAW_encode(SI2quaterRestOctets_nc__meas__params_descr_, *myleaf.body.node.nodes[7]); encoded_length += field_ext__info.RAW_encode(SI2quaterRestOctets_ext__info_descr_, *myleaf.body.node.nodes[8]); encoded_length += field_utran__neigh__desc.RAW_encode(SI2quaterRestOctets_utran__neigh__desc_descr_, *myleaf.body.node.nodes[9]); encoded_length += field_utran__meas__params__desc.RAW_encode(SI2quaterRestOctets_utran__meas__params__desc_descr_, *myleaf.body.node.nodes[10]); encoded_length += field_utran__gprs__meas__params__desc.RAW_encode(SI2quaterRestOctets_utran__gprs__meas__params__desc_descr_, *myleaf.body.node.nodes[11]); encoded_length += field_rel__additions.RAW_encode(SI2quaterRestOctets_rel__additions_descr_, *myleaf.body.node.nodes[12]); return myleaf.length = encoded_length; } struct SI2quaterRestOctets_template::single_value_struct { BITSTRING_template field_ba__ind; BITSTRING_template field_ba__3g__ind; BITSTRING_template field_mp__change__mark; INTEGER_template field_si2quater__index; INTEGER_template field_si2quater__count; MeasParamsDescOpt_template field_meas__params__desc; SI2quaterRestOctets_gprs_template field_gprs; NCMeasParamsOpt_template field_nc__meas__params; SI2quaterExtInfoOpt_template field_ext__info; UTRAN__NeighDescOpt_template field_utran__neigh__desc; UTRAN__MeasParamsDescOpt_template field_utran__meas__params__desc; UTRAN__GPRSMeasParamsDescOpt_template field_utran__gprs__meas__params__desc; SI2quaterAdditions_template field_rel__additions; }; void SI2quaterRestOctets_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_ba__ind = ANY_VALUE; single_value->field_ba__3g__ind = ANY_VALUE; single_value->field_mp__change__mark = ANY_VALUE; single_value->field_si2quater__index = ANY_VALUE; single_value->field_si2quater__count = ANY_VALUE; single_value->field_meas__params__desc = ANY_VALUE; single_value->field_gprs = ANY_VALUE; single_value->field_nc__meas__params = ANY_VALUE; single_value->field_ext__info = ANY_VALUE; single_value->field_utran__neigh__desc = ANY_VALUE; single_value->field_utran__meas__params__desc = ANY_VALUE; single_value->field_utran__gprs__meas__params__desc = ANY_VALUE; single_value->field_rel__additions = ANY_VALUE; } } } void SI2quaterRestOctets_template::copy_value(const SI2quaterRestOctets& other_value) { single_value = new single_value_struct; if (other_value.ba__ind().is_bound()) { single_value->field_ba__ind = other_value.ba__ind(); } else { single_value->field_ba__ind.clean_up(); } if (other_value.ba__3g__ind().is_bound()) { single_value->field_ba__3g__ind = other_value.ba__3g__ind(); } else { single_value->field_ba__3g__ind.clean_up(); } if (other_value.mp__change__mark().is_bound()) { single_value->field_mp__change__mark = other_value.mp__change__mark(); } else { single_value->field_mp__change__mark.clean_up(); } if (other_value.si2quater__index().is_bound()) { single_value->field_si2quater__index = other_value.si2quater__index(); } else { single_value->field_si2quater__index.clean_up(); } if (other_value.si2quater__count().is_bound()) { single_value->field_si2quater__count = other_value.si2quater__count(); } else { single_value->field_si2quater__count.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().is_bound()) { single_value->field_gprs = other_value.gprs(); } else { single_value->field_gprs.clean_up(); } if (other_value.nc__meas__params().is_bound()) { single_value->field_nc__meas__params = other_value.nc__meas__params(); } else { single_value->field_nc__meas__params.clean_up(); } if (other_value.ext__info().is_bound()) { single_value->field_ext__info = other_value.ext__info(); } else { single_value->field_ext__info.clean_up(); } if (other_value.utran__neigh__desc().is_bound()) { single_value->field_utran__neigh__desc = other_value.utran__neigh__desc(); } else { single_value->field_utran__neigh__desc.clean_up(); } if (other_value.utran__meas__params__desc().is_bound()) { single_value->field_utran__meas__params__desc = other_value.utran__meas__params__desc(); } else { single_value->field_utran__meas__params__desc.clean_up(); } if (other_value.utran__gprs__meas__params__desc().is_bound()) { single_value->field_utran__gprs__meas__params__desc = other_value.utran__gprs__meas__params__desc(); } else { single_value->field_utran__gprs__meas__params__desc.clean_up(); } if (other_value.rel__additions().is_bound()) { single_value->field_rel__additions = other_value.rel__additions(); } else { single_value->field_rel__additions.clean_up(); } set_selection(SPECIFIC_VALUE); } void SI2quaterRestOctets_template::copy_template(const SI2quaterRestOctets_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.ba__ind().get_selection()) { single_value->field_ba__ind = other_value.ba__ind(); } else { single_value->field_ba__ind.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.ba__3g__ind().get_selection()) { single_value->field_ba__3g__ind = other_value.ba__3g__ind(); } else { single_value->field_ba__3g__ind.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.mp__change__mark().get_selection()) { single_value->field_mp__change__mark = other_value.mp__change__mark(); } else { single_value->field_mp__change__mark.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.si2quater__index().get_selection()) { single_value->field_si2quater__index = other_value.si2quater__index(); } else { single_value->field_si2quater__index.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.si2quater__count().get_selection()) { single_value->field_si2quater__count = other_value.si2quater__count(); } else { single_value->field_si2quater__count.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().get_selection()) { single_value->field_gprs = other_value.gprs(); } else { single_value->field_gprs.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.nc__meas__params().get_selection()) { single_value->field_nc__meas__params = other_value.nc__meas__params(); } else { single_value->field_nc__meas__params.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.ext__info().get_selection()) { single_value->field_ext__info = other_value.ext__info(); } else { single_value->field_ext__info.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.utran__neigh__desc().get_selection()) { single_value->field_utran__neigh__desc = other_value.utran__neigh__desc(); } else { single_value->field_utran__neigh__desc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.utran__meas__params__desc().get_selection()) { single_value->field_utran__meas__params__desc = other_value.utran__meas__params__desc(); } else { single_value->field_utran__meas__params__desc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.utran__gprs__meas__params__desc().get_selection()) { single_value->field_utran__gprs__meas__params__desc = other_value.utran__gprs__meas__params__desc(); } else { single_value->field_utran__gprs__meas__params__desc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.rel__additions().get_selection()) { single_value->field_rel__additions = other_value.rel__additions(); } else { single_value->field_rel__additions.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_template[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_template(*other_value.implication_.precondition); implication_.implied_template = new SI2quaterRestOctets_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."); break; } set_selection(other_value); } SI2quaterRestOctets_template::SI2quaterRestOctets_template() { } SI2quaterRestOctets_template::SI2quaterRestOctets_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } SI2quaterRestOctets_template::SI2quaterRestOctets_template(const SI2quaterRestOctets& other_value) { copy_value(other_value); } SI2quaterRestOctets_template::SI2quaterRestOctets_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI2quaterRestOctets&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.SI2quaterRestOctets from an unbound optional field."); } } SI2quaterRestOctets_template::SI2quaterRestOctets_template(SI2quaterRestOctets_template* p_precondition, SI2quaterRestOctets_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } SI2quaterRestOctets_template::SI2quaterRestOctets_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_template::SI2quaterRestOctets_template(const SI2quaterRestOctets_template& other_value) : Base_Template() { copy_template(other_value); } SI2quaterRestOctets_template::~SI2quaterRestOctets_template() { clean_up(); } SI2quaterRestOctets_template& SI2quaterRestOctets_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } SI2quaterRestOctets_template& SI2quaterRestOctets_template::operator=(const SI2quaterRestOctets& other_value) { clean_up(); copy_value(other_value); return *this; } SI2quaterRestOctets_template& SI2quaterRestOctets_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI2quaterRestOctets&)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."); } return *this; } SI2quaterRestOctets_template& SI2quaterRestOctets_template::operator=(const SI2quaterRestOctets_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean SI2quaterRestOctets_template::match(const SI2quaterRestOctets& 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.ba__ind().is_bound()) return FALSE; if(!single_value->field_ba__ind.match(other_value.ba__ind(), legacy))return FALSE; if(!other_value.ba__3g__ind().is_bound()) return FALSE; if(!single_value->field_ba__3g__ind.match(other_value.ba__3g__ind(), legacy))return FALSE; if(!other_value.mp__change__mark().is_bound()) return FALSE; if(!single_value->field_mp__change__mark.match(other_value.mp__change__mark(), legacy))return FALSE; if(!other_value.si2quater__index().is_bound()) return FALSE; if(!single_value->field_si2quater__index.match(other_value.si2quater__index(), legacy))return FALSE; if(!other_value.si2quater__count().is_bound()) return FALSE; if(!single_value->field_si2quater__count.match(other_value.si2quater__count(), 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().is_bound()) return FALSE; if(!single_value->field_gprs.match(other_value.gprs(), legacy))return FALSE; if(!other_value.nc__meas__params().is_bound()) return FALSE; if(!single_value->field_nc__meas__params.match(other_value.nc__meas__params(), legacy))return FALSE; if(!other_value.ext__info().is_bound()) return FALSE; if(!single_value->field_ext__info.match(other_value.ext__info(), legacy))return FALSE; if(!other_value.utran__neigh__desc().is_bound()) return FALSE; if(!single_value->field_utran__neigh__desc.match(other_value.utran__neigh__desc(), legacy))return FALSE; if(!other_value.utran__meas__params__desc().is_bound()) return FALSE; if(!single_value->field_utran__meas__params__desc.match(other_value.utran__meas__params__desc(), legacy))return FALSE; if(!other_value.utran__gprs__meas__params__desc().is_bound()) return FALSE; if(!single_value->field_utran__gprs__meas__params__desc.match(other_value.utran__gprs__meas__params__desc(), legacy))return FALSE; if(!other_value.rel__additions().is_bound()) return FALSE; if(!single_value->field_rel__additions.match(other_value.rel__additions(), 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."); } return FALSE; } boolean SI2quaterRestOctets_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_ba__ind.is_bound() || single_value->field_ba__3g__ind.is_bound() || single_value->field_mp__change__mark.is_bound() || single_value->field_si2quater__index.is_bound() || single_value->field_si2quater__count.is_bound() || single_value->field_meas__params__desc.is_bound() || single_value->field_gprs.is_bound() || single_value->field_nc__meas__params.is_bound() || single_value->field_ext__info.is_bound() || single_value->field_utran__neigh__desc.is_bound() || single_value->field_utran__meas__params__desc.is_bound() || single_value->field_utran__gprs__meas__params__desc.is_bound() || single_value->field_rel__additions.is_bound(); } boolean SI2quaterRestOctets_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_ba__ind.is_value() && single_value->field_ba__3g__ind.is_value() && single_value->field_mp__change__mark.is_value() && single_value->field_si2quater__index.is_value() && single_value->field_si2quater__count.is_value() && single_value->field_meas__params__desc.is_value() && single_value->field_gprs.is_value() && single_value->field_nc__meas__params.is_value() && single_value->field_ext__info.is_value() && single_value->field_utran__neigh__desc.is_value() && single_value->field_utran__meas__params__desc.is_value() && single_value->field_utran__gprs__meas__params__desc.is_value() && single_value->field_rel__additions.is_value(); } void SI2quaterRestOctets_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 SI2quaterRestOctets_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."); SI2quaterRestOctets ret_val; if (single_value->field_ba__ind.is_bound()) { ret_val.ba__ind() = single_value->field_ba__ind.valueof(); } if (single_value->field_ba__3g__ind.is_bound()) { ret_val.ba__3g__ind() = single_value->field_ba__3g__ind.valueof(); } if (single_value->field_mp__change__mark.is_bound()) { ret_val.mp__change__mark() = single_value->field_mp__change__mark.valueof(); } if (single_value->field_si2quater__index.is_bound()) { ret_val.si2quater__index() = single_value->field_si2quater__index.valueof(); } if (single_value->field_si2quater__count.is_bound()) { ret_val.si2quater__count() = single_value->field_si2quater__count.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.is_bound()) { ret_val.gprs() = single_value->field_gprs.valueof(); } if (single_value->field_nc__meas__params.is_bound()) { ret_val.nc__meas__params() = single_value->field_nc__meas__params.valueof(); } if (single_value->field_ext__info.is_bound()) { ret_val.ext__info() = single_value->field_ext__info.valueof(); } if (single_value->field_utran__neigh__desc.is_bound()) { ret_val.utran__neigh__desc() = single_value->field_utran__neigh__desc.valueof(); } if (single_value->field_utran__meas__params__desc.is_bound()) { ret_val.utran__meas__params__desc() = single_value->field_utran__meas__params__desc.valueof(); } if (single_value->field_utran__gprs__meas__params__desc.is_bound()) { ret_val.utran__gprs__meas__params__desc() = single_value->field_utran__gprs__meas__params__desc.valueof(); } if (single_value->field_rel__additions.is_bound()) { ret_val.rel__additions() = single_value->field_rel__additions.valueof(); } return ret_val; } void SI2quaterRestOctets_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."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new SI2quaterRestOctets_template[list_length]; } SI2quaterRestOctets_template& SI2quaterRestOctets_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."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.SI2quaterRestOctets."); return value_list.list_value[list_index]; } BITSTRING_template& SI2quaterRestOctets_template::ba__ind() { set_specific(); return single_value->field_ba__ind; } const BITSTRING_template& SI2quaterRestOctets_template::ba__ind() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ba_ind of a non-specific template of type @GSM_RestOctets.SI2quaterRestOctets."); return single_value->field_ba__ind; } BITSTRING_template& SI2quaterRestOctets_template::ba__3g__ind() { set_specific(); return single_value->field_ba__3g__ind; } const BITSTRING_template& SI2quaterRestOctets_template::ba__3g__ind() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ba_3g_ind of a non-specific template of type @GSM_RestOctets.SI2quaterRestOctets."); return single_value->field_ba__3g__ind; } BITSTRING_template& SI2quaterRestOctets_template::mp__change__mark() { set_specific(); return single_value->field_mp__change__mark; } const BITSTRING_template& SI2quaterRestOctets_template::mp__change__mark() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field mp_change_mark of a non-specific template of type @GSM_RestOctets.SI2quaterRestOctets."); return single_value->field_mp__change__mark; } INTEGER_template& SI2quaterRestOctets_template::si2quater__index() { set_specific(); return single_value->field_si2quater__index; } const INTEGER_template& SI2quaterRestOctets_template::si2quater__index() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field si2quater_index of a non-specific template of type @GSM_RestOctets.SI2quaterRestOctets."); return single_value->field_si2quater__index; } INTEGER_template& SI2quaterRestOctets_template::si2quater__count() { set_specific(); return single_value->field_si2quater__count; } const INTEGER_template& SI2quaterRestOctets_template::si2quater__count() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field si2quater_count of a non-specific template of type @GSM_RestOctets.SI2quaterRestOctets."); return single_value->field_si2quater__count; } MeasParamsDescOpt_template& SI2quaterRestOctets_template::meas__params__desc() { set_specific(); return single_value->field_meas__params__desc; } const MeasParamsDescOpt_template& SI2quaterRestOctets_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."); return single_value->field_meas__params__desc; } SI2quaterRestOctets_gprs_template& SI2quaterRestOctets_template::gprs() { set_specific(); return single_value->field_gprs; } const SI2quaterRestOctets_gprs_template& SI2quaterRestOctets_template::gprs() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field gprs of a non-specific template of type @GSM_RestOctets.SI2quaterRestOctets."); return single_value->field_gprs; } NCMeasParamsOpt_template& SI2quaterRestOctets_template::nc__meas__params() { set_specific(); return single_value->field_nc__meas__params; } const NCMeasParamsOpt_template& SI2quaterRestOctets_template::nc__meas__params() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nc_meas_params of a non-specific template of type @GSM_RestOctets.SI2quaterRestOctets."); return single_value->field_nc__meas__params; } SI2quaterExtInfoOpt_template& SI2quaterRestOctets_template::ext__info() { set_specific(); return single_value->field_ext__info; } const SI2quaterExtInfoOpt_template& SI2quaterRestOctets_template::ext__info() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ext_info of a non-specific template of type @GSM_RestOctets.SI2quaterRestOctets."); return single_value->field_ext__info; } UTRAN__NeighDescOpt_template& SI2quaterRestOctets_template::utran__neigh__desc() { set_specific(); return single_value->field_utran__neigh__desc; } const UTRAN__NeighDescOpt_template& SI2quaterRestOctets_template::utran__neigh__desc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field utran_neigh_desc of a non-specific template of type @GSM_RestOctets.SI2quaterRestOctets."); return single_value->field_utran__neigh__desc; } UTRAN__MeasParamsDescOpt_template& SI2quaterRestOctets_template::utran__meas__params__desc() { set_specific(); return single_value->field_utran__meas__params__desc; } const UTRAN__MeasParamsDescOpt_template& SI2quaterRestOctets_template::utran__meas__params__desc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field utran_meas_params_desc of a non-specific template of type @GSM_RestOctets.SI2quaterRestOctets."); return single_value->field_utran__meas__params__desc; } UTRAN__GPRSMeasParamsDescOpt_template& SI2quaterRestOctets_template::utran__gprs__meas__params__desc() { set_specific(); return single_value->field_utran__gprs__meas__params__desc; } const UTRAN__GPRSMeasParamsDescOpt_template& SI2quaterRestOctets_template::utran__gprs__meas__params__desc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field utran_gprs_meas_params_desc of a non-specific template of type @GSM_RestOctets.SI2quaterRestOctets."); return single_value->field_utran__gprs__meas__params__desc; } SI2quaterAdditions_template& SI2quaterRestOctets_template::rel__additions() { set_specific(); return single_value->field_rel__additions; } const SI2quaterAdditions_template& SI2quaterRestOctets_template::rel__additions() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field rel_additions of a non-specific template of type @GSM_RestOctets.SI2quaterRestOctets."); return single_value->field_rel__additions; } int SI2quaterRestOctets_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterRestOctets which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: return 13; case VALUE_LIST: { if (value_list.n_values<1) TTCN_error("Internal error: Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterRestOctets 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 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 containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterRestOctets containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterRestOctets containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterRestOctets containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterRestOctets containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterRestOctets containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.SI2quaterRestOctets."); } return 0; } void SI2quaterRestOctets_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ ba_ind := "); single_value->field_ba__ind.log(); TTCN_Logger::log_event_str(", ba_3g_ind := "); single_value->field_ba__3g__ind.log(); TTCN_Logger::log_event_str(", mp_change_mark := "); single_value->field_mp__change__mark.log(); TTCN_Logger::log_event_str(", si2quater_index := "); single_value->field_si2quater__index.log(); TTCN_Logger::log_event_str(", si2quater_count := "); single_value->field_si2quater__count.log(); TTCN_Logger::log_event_str(", meas_params_desc := "); single_value->field_meas__params__desc.log(); TTCN_Logger::log_event_str(", gprs := "); single_value->field_gprs.log(); TTCN_Logger::log_event_str(", nc_meas_params := "); single_value->field_nc__meas__params.log(); TTCN_Logger::log_event_str(", ext_info := "); single_value->field_ext__info.log(); TTCN_Logger::log_event_str(", utran_neigh_desc := "); single_value->field_utran__neigh__desc.log(); TTCN_Logger::log_event_str(", utran_meas_params_desc := "); single_value->field_utran__meas__params__desc.log(); TTCN_Logger::log_event_str(", utran_gprs_meas_params_desc := "); single_value->field_utran__gprs__meas__params__desc.log(); TTCN_Logger::log_event_str(", rel_additions := "); single_value->field_rel__additions.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_template::log_match(const SI2quaterRestOctets& 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_ba__ind.match(match_value.ba__ind(), legacy)){ TTCN_Logger::log_logmatch_info(".ba_ind"); single_value->field_ba__ind.log_match(match_value.ba__ind(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_ba__3g__ind.match(match_value.ba__3g__ind(), legacy)){ TTCN_Logger::log_logmatch_info(".ba_3g_ind"); single_value->field_ba__3g__ind.log_match(match_value.ba__3g__ind(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_mp__change__mark.match(match_value.mp__change__mark(), legacy)){ TTCN_Logger::log_logmatch_info(".mp_change_mark"); single_value->field_mp__change__mark.log_match(match_value.mp__change__mark(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_si2quater__index.match(match_value.si2quater__index(), legacy)){ TTCN_Logger::log_logmatch_info(".si2quater_index"); single_value->field_si2quater__index.log_match(match_value.si2quater__index(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_si2quater__count.match(match_value.si2quater__count(), legacy)){ TTCN_Logger::log_logmatch_info(".si2quater_count"); single_value->field_si2quater__count.log_match(match_value.si2quater__count(), 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.match(match_value.gprs(), legacy)){ TTCN_Logger::log_logmatch_info(".gprs"); single_value->field_gprs.log_match(match_value.gprs(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_nc__meas__params.match(match_value.nc__meas__params(), legacy)){ TTCN_Logger::log_logmatch_info(".nc_meas_params"); single_value->field_nc__meas__params.log_match(match_value.nc__meas__params(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_ext__info.match(match_value.ext__info(), legacy)){ TTCN_Logger::log_logmatch_info(".ext_info"); single_value->field_ext__info.log_match(match_value.ext__info(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_utran__neigh__desc.match(match_value.utran__neigh__desc(), legacy)){ TTCN_Logger::log_logmatch_info(".utran_neigh_desc"); single_value->field_utran__neigh__desc.log_match(match_value.utran__neigh__desc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_utran__meas__params__desc.match(match_value.utran__meas__params__desc(), legacy)){ TTCN_Logger::log_logmatch_info(".utran_meas_params_desc"); single_value->field_utran__meas__params__desc.log_match(match_value.utran__meas__params__desc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_utran__gprs__meas__params__desc.match(match_value.utran__gprs__meas__params__desc(), legacy)){ TTCN_Logger::log_logmatch_info(".utran_gprs_meas_params_desc"); single_value->field_utran__gprs__meas__params__desc.log_match(match_value.utran__gprs__meas__params__desc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_rel__additions.match(match_value.rel__additions(), legacy)){ TTCN_Logger::log_logmatch_info(".rel_additions"); single_value->field_rel__additions.log_match(match_value.rel__additions(), 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("{ ba_ind := "); single_value->field_ba__ind.log_match(match_value.ba__ind(), legacy); TTCN_Logger::log_event_str(", ba_3g_ind := "); single_value->field_ba__3g__ind.log_match(match_value.ba__3g__ind(), legacy); TTCN_Logger::log_event_str(", mp_change_mark := "); single_value->field_mp__change__mark.log_match(match_value.mp__change__mark(), legacy); TTCN_Logger::log_event_str(", si2quater_index := "); single_value->field_si2quater__index.log_match(match_value.si2quater__index(), legacy); TTCN_Logger::log_event_str(", si2quater_count := "); single_value->field_si2quater__count.log_match(match_value.si2quater__count(), 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 := "); single_value->field_gprs.log_match(match_value.gprs(), legacy); TTCN_Logger::log_event_str(", nc_meas_params := "); single_value->field_nc__meas__params.log_match(match_value.nc__meas__params(), legacy); TTCN_Logger::log_event_str(", ext_info := "); single_value->field_ext__info.log_match(match_value.ext__info(), legacy); TTCN_Logger::log_event_str(", utran_neigh_desc := "); single_value->field_utran__neigh__desc.log_match(match_value.utran__neigh__desc(), legacy); TTCN_Logger::log_event_str(", utran_meas_params_desc := "); single_value->field_utran__meas__params__desc.log_match(match_value.utran__meas__params__desc(), legacy); TTCN_Logger::log_event_str(", utran_gprs_meas_params_desc := "); single_value->field_utran__gprs__meas__params__desc.log_match(match_value.utran__gprs__meas__params__desc(), legacy); TTCN_Logger::log_event_str(", rel_additions := "); single_value->field_rel__additions.log_match(match_value.rel__additions(), 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_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (ba__ind().is_bound()) ba__ind().set_implicit_omit(); if (ba__3g__ind().is_bound()) ba__3g__ind().set_implicit_omit(); if (mp__change__mark().is_bound()) mp__change__mark().set_implicit_omit(); if (si2quater__index().is_bound()) si2quater__index().set_implicit_omit(); if (si2quater__count().is_bound()) si2quater__count().set_implicit_omit(); if (meas__params__desc().is_bound()) meas__params__desc().set_implicit_omit(); if (gprs().is_bound()) gprs().set_implicit_omit(); if (nc__meas__params().is_bound()) nc__meas__params().set_implicit_omit(); if (ext__info().is_bound()) ext__info().set_implicit_omit(); if (utran__neigh__desc().is_bound()) utran__neigh__desc().set_implicit_omit(); if (utran__meas__params__desc().is_bound()) utran__meas__params__desc().set_implicit_omit(); if (utran__gprs__meas__params__desc().is_bound()) utran__gprs__meas__params__desc().set_implicit_omit(); if (rel__additions().is_bound()) rel__additions().set_implicit_omit(); } void SI2quaterRestOctets_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_ba__ind.encode_text(text_buf); single_value->field_ba__3g__ind.encode_text(text_buf); single_value->field_mp__change__mark.encode_text(text_buf); single_value->field_si2quater__index.encode_text(text_buf); single_value->field_si2quater__count.encode_text(text_buf); single_value->field_meas__params__desc.encode_text(text_buf); single_value->field_gprs.encode_text(text_buf); single_value->field_nc__meas__params.encode_text(text_buf); single_value->field_ext__info.encode_text(text_buf); single_value->field_utran__neigh__desc.encode_text(text_buf); single_value->field_utran__meas__params__desc.encode_text(text_buf); single_value->field_utran__gprs__meas__params__desc.encode_text(text_buf); single_value->field_rel__additions.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."); } } void SI2quaterRestOctets_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_ba__ind.decode_text(text_buf); single_value->field_ba__3g__ind.decode_text(text_buf); single_value->field_mp__change__mark.decode_text(text_buf); single_value->field_si2quater__index.decode_text(text_buf); single_value->field_si2quater__count.decode_text(text_buf); single_value->field_meas__params__desc.decode_text(text_buf); single_value->field_gprs.decode_text(text_buf); single_value->field_nc__meas__params.decode_text(text_buf); single_value->field_ext__info.decode_text(text_buf); single_value->field_utran__neigh__desc.decode_text(text_buf); single_value->field_utran__meas__params__desc.decode_text(text_buf); single_value->field_utran__gprs__meas__params__desc.decode_text(text_buf); single_value->field_rel__additions.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_template[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."); } } void SI2quaterRestOctets_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_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) ba__ind().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) ba__3g__ind().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) mp__change__mark().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) si2quater__index().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) si2quater__count().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) meas__params__desc().set_param(*param.get_elem(5)); if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) gprs().set_param(*param.get_elem(6)); if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) nc__meas__params().set_param(*param.get_elem(7)); if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) ext__info().set_param(*param.get_elem(8)); if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) utran__neigh__desc().set_param(*param.get_elem(9)); if (param.get_size()>10 && param.get_elem(10)->get_type()!=Module_Param::MP_NotUsed) utran__meas__params__desc().set_param(*param.get_elem(10)); if (param.get_size()>11 && param.get_elem(11)->get_type()!=Module_Param::MP_NotUsed) utran__gprs__meas__params__desc().set_param(*param.get_elem(11)); if (param.get_size()>12 && param.get_elem(12)->get_type()!=Module_Param::MP_NotUsed) rel__additions().set_param(*param.get_elem(12)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "ba_ind")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ba__ind().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ba_3g_ind")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ba__3g__ind().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "mp_change_mark")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { mp__change__mark().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "si2quater_index")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { si2quater__index().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "si2quater_count")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { si2quater__count().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")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { gprs().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nc_meas_params")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nc__meas__params().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ext_info")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ext__info().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "utran_neigh_desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { utran__neigh__desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "utran_meas_params_desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { utran__meas__params__desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "utran_gprs_meas_params_desc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { utran__gprs__meas__params__desc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "rel_additions")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rel__additions().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: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { SI2quaterRestOctets_template* precondition = new SI2quaterRestOctets_template; precondition->set_param(*param.get_elem(0)); SI2quaterRestOctets_template* implied_template = new SI2quaterRestOctets_template; implied_template->set_param(*param.get_elem(1)); *this = SI2quaterRestOctets_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.SI2quaterRestOctets"); } is_ifpresent = param.get_ifpresent(); } void SI2quaterRestOctets_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_ba__ind.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI2quaterRestOctets"); single_value->field_ba__3g__ind.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI2quaterRestOctets"); single_value->field_mp__change__mark.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI2quaterRestOctets"); single_value->field_si2quater__index.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI2quaterRestOctets"); single_value->field_si2quater__count.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI2quaterRestOctets"); single_value->field_meas__params__desc.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI2quaterRestOctets"); single_value->field_gprs.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI2quaterRestOctets"); single_value->field_nc__meas__params.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI2quaterRestOctets"); single_value->field_ext__info.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI2quaterRestOctets"); single_value->field_utran__neigh__desc.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI2quaterRestOctets"); single_value->field_utran__meas__params__desc.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI2quaterRestOctets"); single_value->field_utran__gprs__meas__params__desc.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI2quaterRestOctets"); single_value->field_rel__additions.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI2quaterRestOctets"); 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"); } boolean SI2quaterRestOctets_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean SI2quaterRestOctets_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; } SI2quaterRestOctetsList::SI2quaterRestOctetsList(const SI2quaterRestOctetsList& other_value) { if (!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.SI2quaterRestOctetsList."); val_ptr = other_value.val_ptr; val_ptr->ref_count++; } SI2quaterRestOctetsList::~SI2quaterRestOctetsList() { clean_up(); if (val_ptr != NULL) val_ptr = NULL; } void SI2quaterRestOctetsList::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."); } } SI2quaterRestOctetsList& SI2quaterRestOctetsList::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; } SI2quaterRestOctetsList& SI2quaterRestOctetsList::operator=(const SI2quaterRestOctetsList& other_value) { if (other_value.val_ptr == NULL) TTCN_error("Assigning an unbound value of type @GSM_RestOctets.SI2quaterRestOctetsList."); if (this != &other_value) { clean_up(); val_ptr = other_value.val_ptr; val_ptr->ref_count++; } return *this; } boolean SI2quaterRestOctetsList::operator==(null_type) const { if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @GSM_RestOctets.SI2quaterRestOctetsList."); return val_ptr->n_elements == 0 ; } boolean SI2quaterRestOctetsList::operator==(const SI2quaterRestOctetsList& other_value) const { if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @GSM_RestOctets.SI2quaterRestOctetsList."); if (other_value.val_ptr == NULL) TTCN_error("The right operand of comparison is an unbound value of type @GSM_RestOctets.SI2quaterRestOctetsList."); 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; } SI2quaterRestOctets& SI2quaterRestOctetsList::operator[](int index_value) { if (index_value < 0) TTCN_error("Accessing an element of type @GSM_RestOctets.SI2quaterRestOctetsList 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 = (SI2quaterRestOctets**)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 SI2quaterRestOctets(*(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 SI2quaterRestOctets; } return *val_ptr->value_elements[index_value]; } SI2quaterRestOctets& SI2quaterRestOctetsList::operator[](const INTEGER& index_value) { index_value.must_bound("Using an unbound integer value for indexing a value of type @GSM_RestOctets.SI2quaterRestOctetsList."); return (*this)[(int)index_value]; } const SI2quaterRestOctets& SI2quaterRestOctetsList::operator[](int index_value) const { if (val_ptr == NULL) TTCN_error("Accessing an element in an unbound value of type @GSM_RestOctets.SI2quaterRestOctetsList."); if (index_value < 0) TTCN_error("Accessing an element of type @GSM_RestOctets.SI2quaterRestOctetsList 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.SI2quaterRestOctetsList: 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 SI2quaterRestOctets& SI2quaterRestOctetsList::operator[](const INTEGER& index_value) const { index_value.must_bound("Using an unbound integer value for indexing a value of type @GSM_RestOctets.SI2quaterRestOctetsList."); return (*this)[(int)index_value]; } SI2quaterRestOctetsList SI2quaterRestOctetsList::operator<<=(int rotate_count) const { return *this >>= (-rotate_count); } SI2quaterRestOctetsList SI2quaterRestOctetsList::operator<<=(const INTEGER& rotate_count) const { rotate_count.must_bound("Unbound integer operand of rotate left operator."); return *this >>= (int)(-rotate_count); } SI2quaterRestOctetsList SI2quaterRestOctetsList::operator>>=(const INTEGER& rotate_count) const { rotate_count.must_bound("Unbound integer operand of rotate right operator."); return *this >>= (int)rotate_count; } SI2quaterRestOctetsList SI2quaterRestOctetsList::operator>>=(int rotate_count) const { if (val_ptr == NULL) TTCN_error("Performing rotation operation on an unbound value of type @GSM_RestOctets.SI2quaterRestOctetsList."); 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; SI2quaterRestOctetsList 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 SI2quaterRestOctets(*val_ptr->value_elements[i]); } } return ret_val; } SI2quaterRestOctetsList SI2quaterRestOctetsList::operator+(const SI2quaterRestOctetsList& other_value) const { if (val_ptr == NULL || other_value.val_ptr == NULL) TTCN_error("Unbound operand of @GSM_RestOctets.SI2quaterRestOctetsList concatenation."); if (val_ptr->n_elements == 0) return other_value; if (other_value.val_ptr->n_elements == 0) return *this; SI2quaterRestOctetsList 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 SI2quaterRestOctets(*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 SI2quaterRestOctets(*other_value.val_ptr->value_elements[i]); } } return ret_val; } SI2quaterRestOctetsList SI2quaterRestOctetsList::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.SI2quaterRestOctetsList."); check_substr_arguments(val_ptr->n_elements, index, returncount, "@GSM_RestOctets.SI2quaterRestOctetsList","element"); SI2quaterRestOctetsList ret_val; ret_val.set_size(returncount); for (int i=0; ivalue_elements[i+index] != NULL) { ret_val.val_ptr->value_elements[i] = new SI2quaterRestOctets(*val_ptr->value_elements[i+index]); } } return ret_val; } SI2quaterRestOctetsList SI2quaterRestOctetsList::replace(int index, int len, const SI2quaterRestOctetsList& repl) const { if (val_ptr == NULL) TTCN_error("The first argument of replace() is an unbound value of type @GSM_RestOctets.SI2quaterRestOctetsList."); if (repl.val_ptr == NULL) TTCN_error("The fourth argument of replace() is an unbound value of type @GSM_RestOctets.SI2quaterRestOctetsList."); check_replace_arguments(val_ptr->n_elements, index, len, "@GSM_RestOctets.SI2quaterRestOctetsList","element"); SI2quaterRestOctetsList 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 SI2quaterRestOctets(*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 SI2quaterRestOctets(*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 SI2quaterRestOctets(*val_ptr->value_elements[index+i+len]); } } return ret_val; } SI2quaterRestOctetsList SI2quaterRestOctetsList::replace(int index, int len, const SI2quaterRestOctetsList_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 SI2quaterRestOctetsList::set_size(int new_size) { if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a value of type @GSM_RestOctets.SI2quaterRestOctetsList."); 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 = (SI2quaterRestOctets**)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 SI2quaterRestOctets(*(val_ptr->value_elements[elem_count])); } } clean_up(); val_ptr = new_val_ptr; } if (new_size > val_ptr->n_elements) { val_ptr->value_elements = (SI2quaterRestOctets**)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.SI2quaterRestOctetsList: %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 = (SI2quaterRestOctets**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size); val_ptr->n_elements = new_size; } } boolean SI2quaterRestOctetsList::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 SI2quaterRestOctetsList::size_of() const { if (val_ptr == NULL) TTCN_error("Performing sizeof operation on an unbound value of type @GSM_RestOctets.SI2quaterRestOctetsList."); return val_ptr->n_elements; } int SI2quaterRestOctetsList::lengthof() const { if (val_ptr == NULL) TTCN_error("Performing lengthof operation on an unbound value of type @GSM_RestOctets.SI2quaterRestOctetsList."); 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 SI2quaterRestOctetsList::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 SI2quaterRestOctetsList::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 SI2quaterRestOctetsList::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.SI2quaterRestOctetsList"); } 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.SI2quaterRestOctetsList"); } break; default: TTCN_error("Internal error: Unknown operation type."); } } void SI2quaterRestOctetsList::encode_text(Text_Buf& text_buf) const { if (val_ptr == NULL) TTCN_error("Text encoder: Encoding an unbound value of type @GSM_RestOctets.SI2quaterRestOctetsList."); 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 SI2quaterRestOctetsList::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.SI2quaterRestOctetsList."); val_ptr->value_elements = (SI2quaterRestOctets**)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 SI2quaterRestOctets; val_ptr->value_elements[elem_count]->decode_text(text_buf); } } void SI2quaterRestOctetsList::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 SI2quaterRestOctetsList::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 SI2quaterRestOctetsList::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 SI2quaterRestOctetsList::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 SI2quaterRestOctetsList_template::copy_value(const SI2quaterRestOctetsList& other_value) { if (!other_value.is_bound()) TTCN_error("Initialization of a template of type @GSM_RestOctets.SI2quaterRestOctetsList with an unbound value."); single_value.n_elements = other_value.size_of(); single_value.value_elements = (SI2quaterRestOctets_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 SI2quaterRestOctets_template(other_value[elem_count]); } else { single_value.value_elements[elem_count] = new SI2quaterRestOctets_template; } } set_selection(SPECIFIC_VALUE); } void SI2quaterRestOctetsList_template::copy_template(const SI2quaterRestOctetsList_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 = (SI2quaterRestOctets_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 SI2quaterRestOctets_template(*other_value.single_value.value_elements[elem_count]); } else { single_value.value_elements[elem_count] = new SI2quaterRestOctets_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 SI2quaterRestOctetsList_template[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 SI2quaterRestOctetsList_template(*other_value.implication_.precondition); implication_.implied_template = new SI2quaterRestOctetsList_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.SI2quaterRestOctetsList."); break; } set_selection(other_value); } boolean SI2quaterRestOctetsList_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 SI2quaterRestOctetsList_template*)template_ptr)->single_value.value_elements[template_index]->match((*(const SI2quaterRestOctetsList*)value_ptr)[value_index], legacy); else return ((const SI2quaterRestOctetsList_template*)template_ptr)->single_value.value_elements[template_index]->is_any_or_omit(); } SI2quaterRestOctetsList_template::SI2quaterRestOctetsList_template() { } SI2quaterRestOctetsList_template::SI2quaterRestOctetsList_template(template_sel other_value) : Base_Record_Of_Template(other_value) { check_single_selection(other_value); } SI2quaterRestOctetsList_template::SI2quaterRestOctetsList_template(null_type) : Base_Record_Of_Template(SPECIFIC_VALUE) { single_value.n_elements = 0; single_value.value_elements = NULL; } SI2quaterRestOctetsList_template::SI2quaterRestOctetsList_template(const SI2quaterRestOctetsList& other_value) { copy_value(other_value); } SI2quaterRestOctetsList_template::SI2quaterRestOctetsList_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI2quaterRestOctetsList&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.SI2quaterRestOctetsList from an unbound optional field."); } } SI2quaterRestOctetsList_template::SI2quaterRestOctetsList_template(SI2quaterRestOctetsList_template* p_precondition, SI2quaterRestOctetsList_template* p_implied_template) : Base_Record_Of_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } SI2quaterRestOctetsList_template::SI2quaterRestOctetsList_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; } SI2quaterRestOctetsList_template::SI2quaterRestOctetsList_template(const SI2quaterRestOctetsList_template& other_value) : Base_Record_Of_Template() { copy_template(other_value); } SI2quaterRestOctetsList_template::~SI2quaterRestOctetsList_template() { clean_up(); } void SI2quaterRestOctetsList_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; } SI2quaterRestOctetsList_template& SI2quaterRestOctetsList_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } SI2quaterRestOctetsList_template& SI2quaterRestOctetsList_template::operator=(null_type) { clean_up(); set_selection(SPECIFIC_VALUE); single_value.n_elements = 0; single_value.value_elements = NULL; return *this; } SI2quaterRestOctetsList_template& SI2quaterRestOctetsList_template::operator=(const SI2quaterRestOctetsList& other_value) { clean_up(); copy_value(other_value); return *this; } SI2quaterRestOctetsList_template& SI2quaterRestOctetsList_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI2quaterRestOctetsList&)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.SI2quaterRestOctetsList."); } return *this; } SI2quaterRestOctetsList_template& SI2quaterRestOctetsList_template::operator=(const SI2quaterRestOctetsList_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } SI2quaterRestOctets_template& SI2quaterRestOctetsList_template::operator[](int index_value) { if (index_value < 0) TTCN_error("Accessing an element of a template for type @GSM_RestOctets.SI2quaterRestOctetsList 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.SI2quaterRestOctetsList."); break; } return *single_value.value_elements[index_value]; } SI2quaterRestOctets_template& SI2quaterRestOctetsList_template::operator[](const INTEGER& index_value) { index_value.must_bound("Using an unbound integer value for indexing a template of type @GSM_RestOctets.SI2quaterRestOctetsList."); return (*this)[(int)index_value]; } const SI2quaterRestOctets_template& SI2quaterRestOctetsList_template::operator[](int index_value) const { if (index_value < 0) TTCN_error("Accessing an element of a template for type @GSM_RestOctets.SI2quaterRestOctetsList 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.SI2quaterRestOctetsList."); if (index_value >= single_value.n_elements) TTCN_error("Index overflow in a template of type @GSM_RestOctets.SI2quaterRestOctetsList: 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 SI2quaterRestOctets_template& SI2quaterRestOctetsList_template::operator[](const INTEGER& index_value) const { index_value.must_bound("Using an unbound integer value for indexing a template of type @GSM_RestOctets.SI2quaterRestOctetsList."); return (*this)[(int)index_value]; } void SI2quaterRestOctetsList_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.SI2quaterRestOctetsList."); 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 = (SI2quaterRestOctets_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 SI2quaterRestOctets_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 SI2quaterRestOctets_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 = (SI2quaterRestOctets_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size); single_value.n_elements = new_size; } } int SI2quaterRestOctetsList_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 SI2quaterRestOctetsList_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.SI2quaterRestOctetsList 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.SI2quaterRestOctetsList 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.SI2quaterRestOctetsList 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.SI2quaterRestOctetsList 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.SI2quaterRestOctetsList 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.SI2quaterRestOctetsList containing complemented list.", op_name); default: TTCN_error("Performing %sof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.SI2quaterRestOctetsList.", op_name); } return check_section_is_single(min_size, has_any_or_none, op_name, "a", "template of type @GSM_RestOctets.SI2quaterRestOctetsList"); } boolean SI2quaterRestOctetsList_template::match(const SI2quaterRestOctetsList& 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.SI2quaterRestOctetsList."); } return FALSE; } boolean SI2quaterRestOctetsList_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; } SI2quaterRestOctetsList SI2quaterRestOctetsList_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.SI2quaterRestOctetsList."); SI2quaterRestOctetsList 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; } SI2quaterRestOctetsList SI2quaterRestOctetsList_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); } SI2quaterRestOctetsList SI2quaterRestOctetsList_template::replace(int index, int len, const SI2quaterRestOctetsList_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()); } SI2quaterRestOctetsList SI2quaterRestOctetsList_template::replace(int index, int len, const SI2quaterRestOctetsList& 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 SI2quaterRestOctetsList_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 SI2quaterRestOctetsList_template[list_length]; break; default: TTCN_error("Internal error: Setting an invalid type for a template of type @GSM_RestOctets.SI2quaterRestOctetsList."); } set_selection(template_type); } SI2quaterRestOctetsList_template& SI2quaterRestOctetsList_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.SI2quaterRestOctetsList."); if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of type @GSM_RestOctets.SI2quaterRestOctetsList."); return value_list.list_value[list_index]; } void SI2quaterRestOctetsList_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 SI2quaterRestOctetsList_template::log_match(const SI2quaterRestOctetsList& 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 SI2quaterRestOctetsList_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.SI2quaterRestOctetsList."); } } void SI2quaterRestOctetsList_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.SI2quaterRestOctetsList."); single_value.value_elements = (SI2quaterRestOctets_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 SI2quaterRestOctets_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 SI2quaterRestOctetsList_template[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.SI2quaterRestOctetsList."); } } boolean SI2quaterRestOctetsList_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean SI2quaterRestOctetsList_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 SI2quaterRestOctetsList_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: { SI2quaterRestOctetsList_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: { SI2quaterRestOctetsList_template* precondition = new SI2quaterRestOctetsList_template; precondition->set_param(*param.get_elem(0)); SI2quaterRestOctetsList_template* implied_template = new SI2quaterRestOctetsList_template; implied_template->set_param(*param.get_elem(1)); *this = SI2quaterRestOctetsList_template(precondition, implied_template); } break; default: param.type_error("record of template", "@GSM_RestOctets.SI2quaterRestOctetsList"); } is_ifpresent = param.get_ifpresent(); set_length_range(param); } void SI2quaterRestOctetsList_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.SI2quaterRestOctetsList"); 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.SI2quaterRestOctetsList"); } boolean SI2quaterRestOctetsList_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); } } UMTS__AddMeasParamsDesc2::UMTS__AddMeasParamsDesc2() { } UMTS__AddMeasParamsDesc2::UMTS__AddMeasParamsDesc2(const BITSTRING& par_presence, const OPTIONAL< INTEGER >& par_threshold) : field_presence(par_presence), field_threshold(par_threshold) { } UMTS__AddMeasParamsDesc2::UMTS__AddMeasParamsDesc2(const UMTS__AddMeasParamsDesc2& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.UMTS_AddMeasParamsDesc2."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.threshold().is_bound()) field_threshold = other_value.threshold(); else field_threshold.clean_up(); } void UMTS__AddMeasParamsDesc2::clean_up() { field_presence.clean_up(); field_threshold.clean_up(); } const TTCN_Typedescriptor_t* UMTS__AddMeasParamsDesc2::get_descriptor() const { return &UMTS__AddMeasParamsDesc2_descr_; } UMTS__AddMeasParamsDesc2& UMTS__AddMeasParamsDesc2::operator=(const UMTS__AddMeasParamsDesc2& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.UMTS_AddMeasParamsDesc2."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.threshold().is_bound()) field_threshold = other_value.threshold(); else field_threshold.clean_up(); } return *this; } boolean UMTS__AddMeasParamsDesc2::operator==(const UMTS__AddMeasParamsDesc2& other_value) const { return field_presence==other_value.field_presence && field_threshold==other_value.field_threshold; } boolean UMTS__AddMeasParamsDesc2::is_bound() const { return (field_presence.is_bound()) || (OPTIONAL_OMIT == field_threshold.get_selection() || field_threshold.is_bound()); } boolean UMTS__AddMeasParamsDesc2::is_value() const { return field_presence.is_value() && (OPTIONAL_OMIT == field_threshold.get_selection() || field_threshold.is_value()); } int UMTS__AddMeasParamsDesc2::size_of() const { int ret_val = 1; if (field_threshold.ispresent()) ret_val++; return ret_val; } void UMTS__AddMeasParamsDesc2::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(", threshold := "); field_threshold.log(); TTCN_Logger::log_event_str(" }"); } void UMTS__AddMeasParamsDesc2::set_implicit_omit() { if (presence().is_bound()) presence().set_implicit_omit(); if (!threshold().is_bound()) threshold() = OMIT_VALUE; else threshold().set_implicit_omit(); } void UMTS__AddMeasParamsDesc2::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) 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(), "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(), "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.UMTS_AddMeasParamsDesc2: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.UMTS_AddMeasParamsDesc2"); } } void UMTS__AddMeasParamsDesc2::encode_text(Text_Buf& text_buf) const { field_presence.encode_text(text_buf); field_threshold.encode_text(text_buf); } void UMTS__AddMeasParamsDesc2::decode_text(Text_Buf& text_buf) { field_presence.decode_text(text_buf); field_threshold.decode_text(text_buf); } void UMTS__AddMeasParamsDesc2::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__AddMeasParamsDesc2::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__AddMeasParamsDesc2::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__AddMeasParamsDesc2_presence_descr_.raw->forceomit); decoded_field_length = field_presence.RAW_decode(UMTS__AddMeasParamsDesc2_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_threshold = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_1_force_omit(1, force_omit, UMTS__AddMeasParamsDesc2_threshold_descr_.raw->forceomit); decoded_field_length = field_threshold().RAW_decode(UMTS__AddMeasParamsDesc2_threshold_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 1) { field_threshold = 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_threshold=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__AddMeasParamsDesc2::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__AddMeasParamsDesc2_presence_descr_.raw); if (field_threshold.ispresent()) { myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, UMTS__AddMeasParamsDesc2_threshold_descr_.raw); } else myleaf.body.node.nodes[1] = NULL; encoded_length += field_presence.RAW_encode(UMTS__AddMeasParamsDesc2_presence_descr_, *myleaf.body.node.nodes[0]); if (field_threshold.ispresent()) { encoded_length += field_threshold().RAW_encode(UMTS__AddMeasParamsDesc2_threshold_descr_, *myleaf.body.node.nodes[1]); } if (field_threshold.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__AddMeasParamsDesc2_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__AddMeasParamsDesc2_template::single_value_struct { BITSTRING_template field_presence; INTEGER_template field_threshold; }; void UMTS__AddMeasParamsDesc2_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_threshold = ANY_OR_OMIT; } } } void UMTS__AddMeasParamsDesc2_template::copy_value(const UMTS__AddMeasParamsDesc2& 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.threshold().is_bound()) { if (other_value.threshold().ispresent()) single_value->field_threshold = other_value.threshold()(); else single_value->field_threshold = OMIT_VALUE; } else { single_value->field_threshold.clean_up(); } set_selection(SPECIFIC_VALUE); } void UMTS__AddMeasParamsDesc2_template::copy_template(const UMTS__AddMeasParamsDesc2_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.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 UMTS__AddMeasParamsDesc2_template[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__AddMeasParamsDesc2_template(*other_value.implication_.precondition); implication_.implied_template = new UMTS__AddMeasParamsDesc2_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_AddMeasParamsDesc2."); break; } set_selection(other_value); } UMTS__AddMeasParamsDesc2_template::UMTS__AddMeasParamsDesc2_template() { } UMTS__AddMeasParamsDesc2_template::UMTS__AddMeasParamsDesc2_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } UMTS__AddMeasParamsDesc2_template::UMTS__AddMeasParamsDesc2_template(const UMTS__AddMeasParamsDesc2& other_value) { copy_value(other_value); } UMTS__AddMeasParamsDesc2_template::UMTS__AddMeasParamsDesc2_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const UMTS__AddMeasParamsDesc2&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc2 from an unbound optional field."); } } UMTS__AddMeasParamsDesc2_template::UMTS__AddMeasParamsDesc2_template(UMTS__AddMeasParamsDesc2_template* p_precondition, UMTS__AddMeasParamsDesc2_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } UMTS__AddMeasParamsDesc2_template::UMTS__AddMeasParamsDesc2_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__AddMeasParamsDesc2_template::UMTS__AddMeasParamsDesc2_template(const UMTS__AddMeasParamsDesc2_template& other_value) : Base_Template() { copy_template(other_value); } UMTS__AddMeasParamsDesc2_template::~UMTS__AddMeasParamsDesc2_template() { clean_up(); } UMTS__AddMeasParamsDesc2_template& UMTS__AddMeasParamsDesc2_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } UMTS__AddMeasParamsDesc2_template& UMTS__AddMeasParamsDesc2_template::operator=(const UMTS__AddMeasParamsDesc2& other_value) { clean_up(); copy_value(other_value); return *this; } UMTS__AddMeasParamsDesc2_template& UMTS__AddMeasParamsDesc2_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const UMTS__AddMeasParamsDesc2&)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_AddMeasParamsDesc2."); } return *this; } UMTS__AddMeasParamsDesc2_template& UMTS__AddMeasParamsDesc2_template::operator=(const UMTS__AddMeasParamsDesc2_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean UMTS__AddMeasParamsDesc2_template::match(const UMTS__AddMeasParamsDesc2& 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.threshold().is_bound()) return FALSE; if((other_value.threshold().ispresent() ? !single_value->field_threshold.match((const INTEGER&)other_value.threshold(), legacy) : !single_value->field_threshold.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_AddMeasParamsDesc2."); } return FALSE; } boolean UMTS__AddMeasParamsDesc2_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_threshold.is_omit() || single_value->field_threshold.is_bound()); } boolean UMTS__AddMeasParamsDesc2_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_presence.is_value() && (single_value->field_threshold.is_omit() || single_value->field_threshold.is_value()); } void UMTS__AddMeasParamsDesc2_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__AddMeasParamsDesc2 UMTS__AddMeasParamsDesc2_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_AddMeasParamsDesc2."); UMTS__AddMeasParamsDesc2 ret_val; if (single_value->field_presence.is_bound()) { ret_val.presence() = single_value->field_presence.valueof(); } if (single_value->field_threshold.is_omit()) ret_val.threshold() = OMIT_VALUE; else if (single_value->field_threshold.is_bound()) { ret_val.threshold() = single_value->field_threshold.valueof(); } return ret_val; } void UMTS__AddMeasParamsDesc2_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_AddMeasParamsDesc2."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new UMTS__AddMeasParamsDesc2_template[list_length]; } UMTS__AddMeasParamsDesc2_template& UMTS__AddMeasParamsDesc2_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_AddMeasParamsDesc2."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc2."); return value_list.list_value[list_index]; } BITSTRING_template& UMTS__AddMeasParamsDesc2_template::presence() { set_specific(); return single_value->field_presence; } const BITSTRING_template& UMTS__AddMeasParamsDesc2_template::presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field presence of a non-specific template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc2."); return single_value->field_presence; } INTEGER_template& UMTS__AddMeasParamsDesc2_template::threshold() { set_specific(); return single_value->field_threshold; } const INTEGER_template& UMTS__AddMeasParamsDesc2_template::threshold() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field threshold of a non-specific template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc2."); return single_value->field_threshold; } int UMTS__AddMeasParamsDesc2_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc2 which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 1; if (single_value->field_threshold.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_AddMeasParamsDesc2 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_AddMeasParamsDesc2 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_AddMeasParamsDesc2 containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc2 containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc2 containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc2 containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc2 containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc2 containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.UMTS_AddMeasParamsDesc2."); } return 0; } void UMTS__AddMeasParamsDesc2_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(", 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 UMTS__AddMeasParamsDesc2_template::log_match(const UMTS__AddMeasParamsDesc2& 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.threshold().ispresent()){ 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 { if (!single_value->field_threshold.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".threshold := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_threshold.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(", threshold := "); if (match_value.threshold().ispresent()) { single_value->field_threshold.log_match(match_value.threshold(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_threshold.log(); if (single_value->field_threshold.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__AddMeasParamsDesc2_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (presence().is_bound()) presence().set_implicit_omit(); if (!threshold().is_bound()) threshold() = OMIT_VALUE; else threshold().set_implicit_omit(); } void UMTS__AddMeasParamsDesc2_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_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.UMTS_AddMeasParamsDesc2."); } } void UMTS__AddMeasParamsDesc2_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_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 UMTS__AddMeasParamsDesc2_template[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_AddMeasParamsDesc2."); } } void UMTS__AddMeasParamsDesc2_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__AddMeasParamsDesc2_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) 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(), "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(), "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.UMTS_AddMeasParamsDesc2: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { UMTS__AddMeasParamsDesc2_template* precondition = new UMTS__AddMeasParamsDesc2_template; precondition->set_param(*param.get_elem(0)); UMTS__AddMeasParamsDesc2_template* implied_template = new UMTS__AddMeasParamsDesc2_template; implied_template->set_param(*param.get_elem(1)); *this = UMTS__AddMeasParamsDesc2_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.UMTS_AddMeasParamsDesc2"); } is_ifpresent = param.get_ifpresent(); } void UMTS__AddMeasParamsDesc2_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_AddMeasParamsDesc2"); single_value->field_threshold.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.UMTS_AddMeasParamsDesc2"); 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_AddMeasParamsDesc2"); } boolean UMTS__AddMeasParamsDesc2_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean UMTS__AddMeasParamsDesc2_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) { } SelectionParamsOpt::SelectionParamsOpt(const SelectionParamsOpt& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.SelectionParamsOpt."); 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 SelectionParamsOpt::clean_up() { field_presence.clean_up(); field_params.clean_up(); } const TTCN_Typedescriptor_t* SelectionParamsOpt::get_descriptor() const { return &SelectionParamsOpt_descr_; } SelectionParamsOpt& SelectionParamsOpt::operator=(const SelectionParamsOpt& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.SelectionParamsOpt."); 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 SelectionParamsOpt::operator==(const SelectionParamsOpt& other_value) const { return field_presence==other_value.field_presence && field_params==other_value.field_params; } boolean SelectionParamsOpt::is_bound() const { return (field_presence.is_bound()) || (OPTIONAL_OMIT == field_params.get_selection() || field_params.is_bound()); } boolean SelectionParamsOpt::is_value() const { return field_presence.is_value() && (OPTIONAL_OMIT == field_params.get_selection() || field_params.is_value()); } int SelectionParamsOpt::size_of() const { int ret_val = 1; if (field_params.ispresent()) ret_val++; return ret_val; } void SelectionParamsOpt::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 SelectionParamsOpt::set_implicit_omit() { if (presence().is_bound()) presence().set_implicit_omit(); if (!params().is_bound()) params() = OMIT_VALUE; else params().set_implicit_omit(); } void SelectionParamsOpt::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.SelectionParamsOpt: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.SelectionParamsOpt"); } } void SelectionParamsOpt::encode_text(Text_Buf& text_buf) const { field_presence.encode_text(text_buf); field_params.encode_text(text_buf); } void SelectionParamsOpt::decode_text(Text_Buf& text_buf) { field_presence.decode_text(text_buf); field_params.decode_text(text_buf); } void SelectionParamsOpt::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 SelectionParamsOpt::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 SelectionParamsOpt::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, SelectionParamsOpt_presence_descr_.raw->forceomit); decoded_field_length = field_presence.RAW_decode(SelectionParamsOpt_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, SelectionParamsOpt_params_descr_.raw->forceomit); decoded_field_length = field_params().RAW_decode(SelectionParamsOpt_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 SelectionParamsOpt::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, SelectionParamsOpt_presence_descr_.raw); if (field_params.ispresent()) { myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, SelectionParamsOpt_params_descr_.raw); } else myleaf.body.node.nodes[1] = NULL; encoded_length += field_presence.RAW_encode(SelectionParamsOpt_presence_descr_, *myleaf.body.node.nodes[0]); if (field_params.ispresent()) { encoded_length += field_params().RAW_encode(SelectionParamsOpt_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(SelectionParamsOpt_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 SelectionParamsOpt_template::single_value_struct { BITSTRING_template field_presence; SelectionParams_template field_params; }; void SelectionParamsOpt_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 SelectionParamsOpt_template::copy_value(const SelectionParamsOpt& 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 SelectionParamsOpt_template::copy_template(const SelectionParamsOpt_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 SelectionParamsOpt_template[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 SelectionParamsOpt_template(*other_value.implication_.precondition); implication_.implied_template = new SelectionParamsOpt_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.SelectionParamsOpt."); break; } set_selection(other_value); } SelectionParamsOpt_template::SelectionParamsOpt_template() { } SelectionParamsOpt_template::SelectionParamsOpt_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } SelectionParamsOpt_template::SelectionParamsOpt_template(const SelectionParamsOpt& other_value) { copy_value(other_value); } SelectionParamsOpt_template::SelectionParamsOpt_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SelectionParamsOpt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.SelectionParamsOpt from an unbound optional field."); } } SelectionParamsOpt_template::SelectionParamsOpt_template(SelectionParamsOpt_template* p_precondition, SelectionParamsOpt_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } SelectionParamsOpt_template::SelectionParamsOpt_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; } SelectionParamsOpt_template::SelectionParamsOpt_template(const SelectionParamsOpt_template& other_value) : Base_Template() { copy_template(other_value); } SelectionParamsOpt_template::~SelectionParamsOpt_template() { clean_up(); } SelectionParamsOpt_template& SelectionParamsOpt_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } SelectionParamsOpt_template& SelectionParamsOpt_template::operator=(const SelectionParamsOpt& other_value) { clean_up(); copy_value(other_value); return *this; } SelectionParamsOpt_template& SelectionParamsOpt_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SelectionParamsOpt&)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.SelectionParamsOpt."); } return *this; } SelectionParamsOpt_template& SelectionParamsOpt_template::operator=(const SelectionParamsOpt_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean SelectionParamsOpt_template::match(const SelectionParamsOpt& 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 SelectionParams&)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.SelectionParamsOpt."); } return FALSE; } boolean SelectionParamsOpt_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 SelectionParamsOpt_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 SelectionParamsOpt_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; } SelectionParamsOpt SelectionParamsOpt_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.SelectionParamsOpt."); SelectionParamsOpt 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 SelectionParamsOpt_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.SelectionParamsOpt."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new SelectionParamsOpt_template[list_length]; } SelectionParamsOpt_template& SelectionParamsOpt_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.SelectionParamsOpt."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.SelectionParamsOpt."); return value_list.list_value[list_index]; } BITSTRING_template& SelectionParamsOpt_template::presence() { set_specific(); return single_value->field_presence; } const BITSTRING_template& SelectionParamsOpt_template::presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field presence of a non-specific template of type @GSM_RestOctets.SelectionParamsOpt."); return single_value->field_presence; } SelectionParams_template& SelectionParamsOpt_template::params() { set_specific(); return single_value->field_params; } const SelectionParams_template& SelectionParamsOpt_template::params() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field params of a non-specific template of type @GSM_RestOctets.SelectionParamsOpt."); return single_value->field_params; } int SelectionParamsOpt_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SelectionParamsOpt 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.SelectionParamsOpt 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.SelectionParamsOpt 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.SelectionParamsOpt containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SelectionParamsOpt containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SelectionParamsOpt containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SelectionParamsOpt containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SelectionParamsOpt containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SelectionParamsOpt containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.SelectionParamsOpt."); } return 0; } void SelectionParamsOpt_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 SelectionParamsOpt_template::log_match(const SelectionParamsOpt& 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 SelectionParamsOpt_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 SelectionParamsOpt_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.SelectionParamsOpt."); } } void SelectionParamsOpt_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 SelectionParamsOpt_template[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.SelectionParamsOpt."); } } void SelectionParamsOpt_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: { SelectionParamsOpt_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.SelectionParamsOpt: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { SelectionParamsOpt_template* precondition = new SelectionParamsOpt_template; precondition->set_param(*param.get_elem(0)); SelectionParamsOpt_template* implied_template = new SelectionParamsOpt_template; implied_template->set_param(*param.get_elem(1)); *this = SelectionParamsOpt_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.SelectionParamsOpt"); } is_ifpresent = param.get_ifpresent(); } void SelectionParamsOpt_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.SelectionParamsOpt"); single_value->field_params.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SelectionParamsOpt"); 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.SelectionParamsOpt"); } boolean SelectionParamsOpt_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean SelectionParamsOpt_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) cbq().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) cr__offset().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) temp__offset().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) penalty__time().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(), "cbq")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cbq().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "cr_offset")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cr__offset().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "temp_offset")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { temp__offset().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "penalty_time")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { penalty__time().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.SelectionParams: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.SelectionParams"); } } void SelectionParams::encode_text(Text_Buf& text_buf) const { field_cbq.encode_text(text_buf); field_cr__offset.encode_text(text_buf); field_temp__offset.encode_text(text_buf); field_penalty__time.encode_text(text_buf); } void SelectionParams::decode_text(Text_Buf& text_buf) { field_cbq.decode_text(text_buf); field_cr__offset.decode_text(text_buf); field_temp__offset.decode_text(text_buf); field_penalty__time.decode_text(text_buf); } void SelectionParams::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 SelectionParams::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 SelectionParams::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, SelectionParams_cbq_descr_.raw->forceomit); decoded_field_length = field_cbq.RAW_decode(SelectionParams_cbq_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, SelectionParams_cr__offset_descr_.raw->forceomit); decoded_field_length = field_cr__offset.RAW_decode(SelectionParams_cr__offset_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, SelectionParams_temp__offset_descr_.raw->forceomit); decoded_field_length = field_temp__offset.RAW_decode(SelectionParams_temp__offset_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, SelectionParams_penalty__time_descr_.raw->forceomit); decoded_field_length = field_penalty__time.RAW_decode(SelectionParams_penalty__time_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 SelectionParams::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, SelectionParams_cbq_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, SelectionParams_cr__offset_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, SelectionParams_temp__offset_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, SelectionParams_penalty__time_descr_.raw); encoded_length += field_cbq.RAW_encode(SelectionParams_cbq_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_cr__offset.RAW_encode(SelectionParams_cr__offset_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_temp__offset.RAW_encode(SelectionParams_temp__offset_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_penalty__time.RAW_encode(SelectionParams_penalty__time_descr_, *myleaf.body.node.nodes[3]); return myleaf.length = encoded_length; } struct SelectionParams_template::single_value_struct { BOOLEAN_template field_cbq; INTEGER_template field_cr__offset; INTEGER_template field_temp__offset; INTEGER_template field_penalty__time; }; void SelectionParams_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_cbq = ANY_VALUE; single_value->field_cr__offset = ANY_VALUE; single_value->field_temp__offset = ANY_VALUE; single_value->field_penalty__time = ANY_VALUE; } } } void SelectionParams_template::copy_value(const SelectionParams& other_value) { single_value = new single_value_struct; if (other_value.cbq().is_bound()) { single_value->field_cbq = other_value.cbq(); } else { single_value->field_cbq.clean_up(); } if (other_value.cr__offset().is_bound()) { single_value->field_cr__offset = other_value.cr__offset(); } else { single_value->field_cr__offset.clean_up(); } if (other_value.temp__offset().is_bound()) { single_value->field_temp__offset = other_value.temp__offset(); } else { single_value->field_temp__offset.clean_up(); } if (other_value.penalty__time().is_bound()) { single_value->field_penalty__time = other_value.penalty__time(); } else { single_value->field_penalty__time.clean_up(); } set_selection(SPECIFIC_VALUE); } void SelectionParams_template::copy_template(const SelectionParams_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.cbq().get_selection()) { single_value->field_cbq = other_value.cbq(); } else { single_value->field_cbq.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.cr__offset().get_selection()) { single_value->field_cr__offset = other_value.cr__offset(); } else { single_value->field_cr__offset.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.temp__offset().get_selection()) { single_value->field_temp__offset = other_value.temp__offset(); } else { single_value->field_temp__offset.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.penalty__time().get_selection()) { single_value->field_penalty__time = other_value.penalty__time(); } else { single_value->field_penalty__time.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 SelectionParams_template[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 SelectionParams_template(*other_value.implication_.precondition); implication_.implied_template = new SelectionParams_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.SelectionParams."); break; } set_selection(other_value); } SelectionParams_template::SelectionParams_template() { } SelectionParams_template::SelectionParams_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } SelectionParams_template::SelectionParams_template(const SelectionParams& other_value) { copy_value(other_value); } SelectionParams_template::SelectionParams_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SelectionParams&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.SelectionParams from an unbound optional field."); } } SelectionParams_template::SelectionParams_template(SelectionParams_template* p_precondition, SelectionParams_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } SelectionParams_template::SelectionParams_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; } SelectionParams_template::SelectionParams_template(const SelectionParams_template& other_value) : Base_Template() { copy_template(other_value); } SelectionParams_template::~SelectionParams_template() { clean_up(); } SelectionParams_template& SelectionParams_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } SelectionParams_template& SelectionParams_template::operator=(const SelectionParams& other_value) { clean_up(); copy_value(other_value); return *this; } SelectionParams_template& SelectionParams_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SelectionParams&)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.SelectionParams."); } return *this; } SelectionParams_template& SelectionParams_template::operator=(const SelectionParams_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean SelectionParams_template::match(const SelectionParams& 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.cbq().is_bound()) return FALSE; if(!single_value->field_cbq.match(other_value.cbq(), legacy))return FALSE; if(!other_value.cr__offset().is_bound()) return FALSE; if(!single_value->field_cr__offset.match(other_value.cr__offset(), legacy))return FALSE; if(!other_value.temp__offset().is_bound()) return FALSE; if(!single_value->field_temp__offset.match(other_value.temp__offset(), legacy))return FALSE; if(!other_value.penalty__time().is_bound()) return FALSE; if(!single_value->field_penalty__time.match(other_value.penalty__time(), 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.SelectionParams."); } return FALSE; } boolean SelectionParams_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_cbq.is_bound() || single_value->field_cr__offset.is_bound() || single_value->field_temp__offset.is_bound() || single_value->field_penalty__time.is_bound(); } boolean SelectionParams_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_cbq.is_value() && single_value->field_cr__offset.is_value() && single_value->field_temp__offset.is_value() && single_value->field_penalty__time.is_value(); } void SelectionParams_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; } SelectionParams SelectionParams_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.SelectionParams."); SelectionParams ret_val; if (single_value->field_cbq.is_bound()) { ret_val.cbq() = single_value->field_cbq.valueof(); } if (single_value->field_cr__offset.is_bound()) { ret_val.cr__offset() = single_value->field_cr__offset.valueof(); } if (single_value->field_temp__offset.is_bound()) { ret_val.temp__offset() = single_value->field_temp__offset.valueof(); } if (single_value->field_penalty__time.is_bound()) { ret_val.penalty__time() = single_value->field_penalty__time.valueof(); } return ret_val; } void SelectionParams_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.SelectionParams."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new SelectionParams_template[list_length]; } SelectionParams_template& SelectionParams_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.SelectionParams."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.SelectionParams."); return value_list.list_value[list_index]; } BOOLEAN_template& SelectionParams_template::cbq() { set_specific(); return single_value->field_cbq; } const BOOLEAN_template& SelectionParams_template::cbq() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field cbq of a non-specific template of type @GSM_RestOctets.SelectionParams."); return single_value->field_cbq; } INTEGER_template& SelectionParams_template::cr__offset() { set_specific(); return single_value->field_cr__offset; } const INTEGER_template& SelectionParams_template::cr__offset() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field cr_offset of a non-specific template of type @GSM_RestOctets.SelectionParams."); return single_value->field_cr__offset; } INTEGER_template& SelectionParams_template::temp__offset() { set_specific(); return single_value->field_temp__offset; } const INTEGER_template& SelectionParams_template::temp__offset() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field temp_offset of a non-specific template of type @GSM_RestOctets.SelectionParams."); return single_value->field_temp__offset; } INTEGER_template& SelectionParams_template::penalty__time() { set_specific(); return single_value->field_penalty__time; } const INTEGER_template& SelectionParams_template::penalty__time() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field penalty_time of a non-specific template of type @GSM_RestOctets.SelectionParams."); return single_value->field_penalty__time; } int SelectionParams_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SelectionParams 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.SelectionParams 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.SelectionParams 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.SelectionParams containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SelectionParams containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SelectionParams containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SelectionParams containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SelectionParams containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SelectionParams containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.SelectionParams."); } return 0; } void SelectionParams_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ cbq := "); single_value->field_cbq.log(); TTCN_Logger::log_event_str(", cr_offset := "); single_value->field_cr__offset.log(); TTCN_Logger::log_event_str(", temp_offset := "); single_value->field_temp__offset.log(); TTCN_Logger::log_event_str(", penalty_time := "); single_value->field_penalty__time.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 SelectionParams_template::log_match(const SelectionParams& 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_cbq.match(match_value.cbq(), legacy)){ TTCN_Logger::log_logmatch_info(".cbq"); single_value->field_cbq.log_match(match_value.cbq(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_cr__offset.match(match_value.cr__offset(), legacy)){ TTCN_Logger::log_logmatch_info(".cr_offset"); single_value->field_cr__offset.log_match(match_value.cr__offset(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_temp__offset.match(match_value.temp__offset(), legacy)){ TTCN_Logger::log_logmatch_info(".temp_offset"); single_value->field_temp__offset.log_match(match_value.temp__offset(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_penalty__time.match(match_value.penalty__time(), legacy)){ TTCN_Logger::log_logmatch_info(".penalty_time"); single_value->field_penalty__time.log_match(match_value.penalty__time(), 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("{ cbq := "); single_value->field_cbq.log_match(match_value.cbq(), legacy); TTCN_Logger::log_event_str(", cr_offset := "); single_value->field_cr__offset.log_match(match_value.cr__offset(), legacy); TTCN_Logger::log_event_str(", temp_offset := "); single_value->field_temp__offset.log_match(match_value.temp__offset(), legacy); TTCN_Logger::log_event_str(", penalty_time := "); single_value->field_penalty__time.log_match(match_value.penalty__time(), 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 SelectionParams_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (cbq().is_bound()) cbq().set_implicit_omit(); if (cr__offset().is_bound()) cr__offset().set_implicit_omit(); if (temp__offset().is_bound()) temp__offset().set_implicit_omit(); if (penalty__time().is_bound()) penalty__time().set_implicit_omit(); } void SelectionParams_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_cbq.encode_text(text_buf); single_value->field_cr__offset.encode_text(text_buf); single_value->field_temp__offset.encode_text(text_buf); single_value->field_penalty__time.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.SelectionParams."); } } void SelectionParams_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_cbq.decode_text(text_buf); single_value->field_cr__offset.decode_text(text_buf); single_value->field_temp__offset.decode_text(text_buf); single_value->field_penalty__time.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 SelectionParams_template[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.SelectionParams."); } } void SelectionParams_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: { SelectionParams_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) cbq().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) cr__offset().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) temp__offset().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) penalty__time().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(), "cbq")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cbq().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "cr_offset")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cr__offset().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "temp_offset")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { temp__offset().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "penalty_time")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { penalty__time().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.SelectionParams: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { SelectionParams_template* precondition = new SelectionParams_template; precondition->set_param(*param.get_elem(0)); SelectionParams_template* implied_template = new SelectionParams_template; implied_template->set_param(*param.get_elem(1)); *this = SelectionParams_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.SelectionParams"); } is_ifpresent = param.get_ifpresent(); } void SelectionParams_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_cbq.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SelectionParams"); single_value->field_cr__offset.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SelectionParams"); single_value->field_temp__offset.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SelectionParams"); single_value->field_penalty__time.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SelectionParams"); 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.SelectionParams"); } boolean SelectionParams_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean SelectionParams_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_offset) : field_presence(par_presence), field_offset(par_offset) { } PowerOffsetOpt::PowerOffsetOpt(const PowerOffsetOpt& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.PowerOffsetOpt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.offset().is_bound()) field_offset = other_value.offset(); else field_offset.clean_up(); } void PowerOffsetOpt::clean_up() { field_presence.clean_up(); field_offset.clean_up(); } const TTCN_Typedescriptor_t* PowerOffsetOpt::get_descriptor() const { return &PowerOffsetOpt_descr_; } PowerOffsetOpt& PowerOffsetOpt::operator=(const PowerOffsetOpt& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.PowerOffsetOpt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.offset().is_bound()) field_offset = other_value.offset(); else field_offset.clean_up(); } return *this; } boolean PowerOffsetOpt::operator==(const PowerOffsetOpt& other_value) const { return field_presence==other_value.field_presence && field_offset==other_value.field_offset; } boolean PowerOffsetOpt::is_bound() const { return (field_presence.is_bound()) || (OPTIONAL_OMIT == field_offset.get_selection() || field_offset.is_bound()); } boolean PowerOffsetOpt::is_value() const { return field_presence.is_value() && (OPTIONAL_OMIT == field_offset.get_selection() || field_offset.is_value()); } int PowerOffsetOpt::size_of() const { int ret_val = 1; if (field_offset.ispresent()) ret_val++; return ret_val; } void PowerOffsetOpt::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(", offset := "); field_offset.log(); TTCN_Logger::log_event_str(" }"); } void PowerOffsetOpt::set_implicit_omit() { if (presence().is_bound()) presence().set_implicit_omit(); if (!offset().is_bound()) offset() = OMIT_VALUE; else offset().set_implicit_omit(); } void PowerOffsetOpt::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) offset().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(), "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_idxerror("Non existent field name in type @GSM_RestOctets.PowerOffsetOpt: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.PowerOffsetOpt"); } } void PowerOffsetOpt::encode_text(Text_Buf& text_buf) const { field_presence.encode_text(text_buf); field_offset.encode_text(text_buf); } void PowerOffsetOpt::decode_text(Text_Buf& text_buf) { field_presence.decode_text(text_buf); field_offset.decode_text(text_buf); } void PowerOffsetOpt::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 PowerOffsetOpt::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 PowerOffsetOpt::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, PowerOffsetOpt_presence_descr_.raw->forceomit); decoded_field_length = field_presence.RAW_decode(PowerOffsetOpt_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_offset = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_1_force_omit(1, force_omit, PowerOffsetOpt_offset_descr_.raw->forceomit); decoded_field_length = field_offset().RAW_decode(PowerOffsetOpt_offset_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 1) { field_offset = 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_offset=OMIT_VALUE; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int PowerOffsetOpt::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, PowerOffsetOpt_presence_descr_.raw); if (field_offset.ispresent()) { myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, PowerOffsetOpt_offset_descr_.raw); } else myleaf.body.node.nodes[1] = NULL; encoded_length += field_presence.RAW_encode(PowerOffsetOpt_presence_descr_, *myleaf.body.node.nodes[0]); if (field_offset.ispresent()) { encoded_length += field_offset().RAW_encode(PowerOffsetOpt_offset_descr_, *myleaf.body.node.nodes[1]); } if (field_offset.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(PowerOffsetOpt_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 PowerOffsetOpt_template::single_value_struct { BITSTRING_template field_presence; INTEGER_template field_offset; }; void PowerOffsetOpt_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_offset = ANY_OR_OMIT; } } } void PowerOffsetOpt_template::copy_value(const PowerOffsetOpt& 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.offset().is_bound()) { if (other_value.offset().ispresent()) single_value->field_offset = other_value.offset()(); else single_value->field_offset = OMIT_VALUE; } else { single_value->field_offset.clean_up(); } set_selection(SPECIFIC_VALUE); } void PowerOffsetOpt_template::copy_template(const PowerOffsetOpt_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.offset().get_selection()) { single_value->field_offset = other_value.offset(); } else { single_value->field_offset.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 PowerOffsetOpt_template[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 PowerOffsetOpt_template(*other_value.implication_.precondition); implication_.implied_template = new PowerOffsetOpt_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.PowerOffsetOpt."); break; } set_selection(other_value); } PowerOffsetOpt_template::PowerOffsetOpt_template() { } PowerOffsetOpt_template::PowerOffsetOpt_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } PowerOffsetOpt_template::PowerOffsetOpt_template(const PowerOffsetOpt& other_value) { copy_value(other_value); } PowerOffsetOpt_template::PowerOffsetOpt_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PowerOffsetOpt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.PowerOffsetOpt from an unbound optional field."); } } PowerOffsetOpt_template::PowerOffsetOpt_template(PowerOffsetOpt_template* p_precondition, PowerOffsetOpt_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } PowerOffsetOpt_template::PowerOffsetOpt_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; } PowerOffsetOpt_template::PowerOffsetOpt_template(const PowerOffsetOpt_template& other_value) : Base_Template() { copy_template(other_value); } PowerOffsetOpt_template::~PowerOffsetOpt_template() { clean_up(); } PowerOffsetOpt_template& PowerOffsetOpt_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } PowerOffsetOpt_template& PowerOffsetOpt_template::operator=(const PowerOffsetOpt& other_value) { clean_up(); copy_value(other_value); return *this; } PowerOffsetOpt_template& PowerOffsetOpt_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PowerOffsetOpt&)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.PowerOffsetOpt."); } return *this; } PowerOffsetOpt_template& PowerOffsetOpt_template::operator=(const PowerOffsetOpt_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean PowerOffsetOpt_template::match(const PowerOffsetOpt& 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.offset().is_bound()) return FALSE; if((other_value.offset().ispresent() ? !single_value->field_offset.match((const INTEGER&)other_value.offset(), legacy) : !single_value->field_offset.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.PowerOffsetOpt."); } return FALSE; } boolean PowerOffsetOpt_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_offset.is_omit() || single_value->field_offset.is_bound()); } boolean PowerOffsetOpt_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_presence.is_value() && (single_value->field_offset.is_omit() || single_value->field_offset.is_value()); } void PowerOffsetOpt_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; } PowerOffsetOpt PowerOffsetOpt_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.PowerOffsetOpt."); PowerOffsetOpt ret_val; if (single_value->field_presence.is_bound()) { ret_val.presence() = single_value->field_presence.valueof(); } if (single_value->field_offset.is_omit()) ret_val.offset() = OMIT_VALUE; else if (single_value->field_offset.is_bound()) { ret_val.offset() = single_value->field_offset.valueof(); } return ret_val; } void PowerOffsetOpt_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.PowerOffsetOpt."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new PowerOffsetOpt_template[list_length]; } PowerOffsetOpt_template& PowerOffsetOpt_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.PowerOffsetOpt."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.PowerOffsetOpt."); return value_list.list_value[list_index]; } BITSTRING_template& PowerOffsetOpt_template::presence() { set_specific(); return single_value->field_presence; } const BITSTRING_template& PowerOffsetOpt_template::presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field presence of a non-specific template of type @GSM_RestOctets.PowerOffsetOpt."); return single_value->field_presence; } INTEGER_template& PowerOffsetOpt_template::offset() { set_specific(); return single_value->field_offset; } const INTEGER_template& PowerOffsetOpt_template::offset() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field offset of a non-specific template of type @GSM_RestOctets.PowerOffsetOpt."); return single_value->field_offset; } int PowerOffsetOpt_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.PowerOffsetOpt which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 1; if (single_value->field_offset.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.PowerOffsetOpt 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.PowerOffsetOpt 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.PowerOffsetOpt containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.PowerOffsetOpt containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.PowerOffsetOpt containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.PowerOffsetOpt containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.PowerOffsetOpt containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.PowerOffsetOpt containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.PowerOffsetOpt."); } return 0; } void PowerOffsetOpt_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(", offset := "); single_value->field_offset.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 PowerOffsetOpt_template::log_match(const PowerOffsetOpt& 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.offset().ispresent()){ 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); } } else { if (!single_value->field_offset.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".offset := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_offset.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(", offset := "); if (match_value.offset().ispresent()) { single_value->field_offset.log_match(match_value.offset(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_offset.log(); if (single_value->field_offset.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 PowerOffsetOpt_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (presence().is_bound()) presence().set_implicit_omit(); if (!offset().is_bound()) offset() = OMIT_VALUE; else offset().set_implicit_omit(); } void PowerOffsetOpt_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_offset.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.PowerOffsetOpt."); } } void PowerOffsetOpt_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_offset.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 PowerOffsetOpt_template[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.PowerOffsetOpt."); } } void PowerOffsetOpt_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: { PowerOffsetOpt_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) offset().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(), "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_idxerror("Non existent field name in type @GSM_RestOctets.PowerOffsetOpt: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { PowerOffsetOpt_template* precondition = new PowerOffsetOpt_template; precondition->set_param(*param.get_elem(0)); PowerOffsetOpt_template* implied_template = new PowerOffsetOpt_template; implied_template->set_param(*param.get_elem(1)); *this = PowerOffsetOpt_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.PowerOffsetOpt"); } is_ifpresent = param.get_ifpresent(); } void PowerOffsetOpt_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.PowerOffsetOpt"); single_value->field_offset.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.PowerOffsetOpt"); 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.PowerOffsetOpt"); } boolean PowerOffsetOpt_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean PowerOffsetOpt_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_where) : field_presence(par_presence), field_where(par_where) { } SchedIfAndWhere::SchedIfAndWhere(const SchedIfAndWhere& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.SchedIfAndWhere."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.where().is_bound()) field_where = other_value.where(); else field_where.clean_up(); } void SchedIfAndWhere::clean_up() { field_presence.clean_up(); field_where.clean_up(); } const TTCN_Typedescriptor_t* SchedIfAndWhere::get_descriptor() const { return &SchedIfAndWhere_descr_; } SchedIfAndWhere& SchedIfAndWhere::operator=(const SchedIfAndWhere& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.SchedIfAndWhere."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.where().is_bound()) field_where = other_value.where(); else field_where.clean_up(); } return *this; } boolean SchedIfAndWhere::operator==(const SchedIfAndWhere& other_value) const { return field_presence==other_value.field_presence && field_where==other_value.field_where; } boolean SchedIfAndWhere::is_bound() const { return (field_presence.is_bound()) || (OPTIONAL_OMIT == field_where.get_selection() || field_where.is_bound()); } boolean SchedIfAndWhere::is_value() const { return field_presence.is_value() && (OPTIONAL_OMIT == field_where.get_selection() || field_where.is_value()); } int SchedIfAndWhere::size_of() const { int ret_val = 1; if (field_where.ispresent()) ret_val++; return ret_val; } void SchedIfAndWhere::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(", where := "); field_where.log(); TTCN_Logger::log_event_str(" }"); } void SchedIfAndWhere::set_implicit_omit() { if (presence().is_bound()) presence().set_implicit_omit(); if (!where().is_bound()) where() = OMIT_VALUE; else where().set_implicit_omit(); } void SchedIfAndWhere::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) where().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(), "where")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { where().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.SchedIfAndWhere: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.SchedIfAndWhere"); } } void SchedIfAndWhere::encode_text(Text_Buf& text_buf) const { field_presence.encode_text(text_buf); field_where.encode_text(text_buf); } void SchedIfAndWhere::decode_text(Text_Buf& text_buf) { field_presence.decode_text(text_buf); field_where.decode_text(text_buf); } void SchedIfAndWhere::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 SchedIfAndWhere::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 SchedIfAndWhere::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, SchedIfAndWhere_presence_descr_.raw->forceomit); decoded_field_length = field_presence.RAW_decode(SchedIfAndWhere_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_where = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_1_force_omit(1, force_omit, SchedIfAndWhere_where_descr_.raw->forceomit); decoded_field_length = field_where().RAW_decode(SchedIfAndWhere_where_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 1) { field_where = 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_where=OMIT_VALUE; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int SchedIfAndWhere::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, SchedIfAndWhere_presence_descr_.raw); if (field_where.ispresent()) { myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, SchedIfAndWhere_where_descr_.raw); } else myleaf.body.node.nodes[1] = NULL; encoded_length += field_presence.RAW_encode(SchedIfAndWhere_presence_descr_, *myleaf.body.node.nodes[0]); if (field_where.ispresent()) { encoded_length += field_where().RAW_encode(SchedIfAndWhere_where_descr_, *myleaf.body.node.nodes[1]); } if (field_where.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(SchedIfAndWhere_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 SchedIfAndWhere_template::single_value_struct { BITSTRING_template field_presence; INTEGER_template field_where; }; void SchedIfAndWhere_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_where = ANY_OR_OMIT; } } } void SchedIfAndWhere_template::copy_value(const SchedIfAndWhere& 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.where().is_bound()) { if (other_value.where().ispresent()) single_value->field_where = other_value.where()(); else single_value->field_where = OMIT_VALUE; } else { single_value->field_where.clean_up(); } set_selection(SPECIFIC_VALUE); } void SchedIfAndWhere_template::copy_template(const SchedIfAndWhere_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.where().get_selection()) { single_value->field_where = other_value.where(); } else { single_value->field_where.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 SchedIfAndWhere_template[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 SchedIfAndWhere_template(*other_value.implication_.precondition); implication_.implied_template = new SchedIfAndWhere_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.SchedIfAndWhere."); break; } set_selection(other_value); } SchedIfAndWhere_template::SchedIfAndWhere_template() { } SchedIfAndWhere_template::SchedIfAndWhere_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } SchedIfAndWhere_template::SchedIfAndWhere_template(const SchedIfAndWhere& other_value) { copy_value(other_value); } SchedIfAndWhere_template::SchedIfAndWhere_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SchedIfAndWhere&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.SchedIfAndWhere from an unbound optional field."); } } SchedIfAndWhere_template::SchedIfAndWhere_template(SchedIfAndWhere_template* p_precondition, SchedIfAndWhere_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } SchedIfAndWhere_template::SchedIfAndWhere_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; } SchedIfAndWhere_template::SchedIfAndWhere_template(const SchedIfAndWhere_template& other_value) : Base_Template() { copy_template(other_value); } SchedIfAndWhere_template::~SchedIfAndWhere_template() { clean_up(); } SchedIfAndWhere_template& SchedIfAndWhere_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } SchedIfAndWhere_template& SchedIfAndWhere_template::operator=(const SchedIfAndWhere& other_value) { clean_up(); copy_value(other_value); return *this; } SchedIfAndWhere_template& SchedIfAndWhere_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SchedIfAndWhere&)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.SchedIfAndWhere."); } return *this; } SchedIfAndWhere_template& SchedIfAndWhere_template::operator=(const SchedIfAndWhere_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean SchedIfAndWhere_template::match(const SchedIfAndWhere& 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.where().is_bound()) return FALSE; if((other_value.where().ispresent() ? !single_value->field_where.match((const INTEGER&)other_value.where(), legacy) : !single_value->field_where.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.SchedIfAndWhere."); } return FALSE; } boolean SchedIfAndWhere_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_where.is_omit() || single_value->field_where.is_bound()); } boolean SchedIfAndWhere_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_presence.is_value() && (single_value->field_where.is_omit() || single_value->field_where.is_value()); } void SchedIfAndWhere_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; } SchedIfAndWhere SchedIfAndWhere_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.SchedIfAndWhere."); SchedIfAndWhere ret_val; if (single_value->field_presence.is_bound()) { ret_val.presence() = single_value->field_presence.valueof(); } if (single_value->field_where.is_omit()) ret_val.where() = OMIT_VALUE; else if (single_value->field_where.is_bound()) { ret_val.where() = single_value->field_where.valueof(); } return ret_val; } void SchedIfAndWhere_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.SchedIfAndWhere."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new SchedIfAndWhere_template[list_length]; } SchedIfAndWhere_template& SchedIfAndWhere_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.SchedIfAndWhere."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.SchedIfAndWhere."); return value_list.list_value[list_index]; } BITSTRING_template& SchedIfAndWhere_template::presence() { set_specific(); return single_value->field_presence; } const BITSTRING_template& SchedIfAndWhere_template::presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field presence of a non-specific template of type @GSM_RestOctets.SchedIfAndWhere."); return single_value->field_presence; } INTEGER_template& SchedIfAndWhere_template::where() { set_specific(); return single_value->field_where; } const INTEGER_template& SchedIfAndWhere_template::where() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field where of a non-specific template of type @GSM_RestOctets.SchedIfAndWhere."); return single_value->field_where; } int SchedIfAndWhere_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SchedIfAndWhere which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 1; if (single_value->field_where.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.SchedIfAndWhere 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.SchedIfAndWhere 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.SchedIfAndWhere containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SchedIfAndWhere containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SchedIfAndWhere containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SchedIfAndWhere containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SchedIfAndWhere containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SchedIfAndWhere containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.SchedIfAndWhere."); } return 0; } void SchedIfAndWhere_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(", where := "); single_value->field_where.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 SchedIfAndWhere_template::log_match(const SchedIfAndWhere& 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.where().ispresent()){ if(!single_value->field_where.match(match_value.where(), legacy)){ TTCN_Logger::log_logmatch_info(".where"); single_value->field_where.log_match(match_value.where(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_where.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".where := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_where.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(", where := "); if (match_value.where().ispresent()) { single_value->field_where.log_match(match_value.where(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_where.log(); if (single_value->field_where.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 SchedIfAndWhere_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (presence().is_bound()) presence().set_implicit_omit(); if (!where().is_bound()) where() = OMIT_VALUE; else where().set_implicit_omit(); } void SchedIfAndWhere_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_where.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.SchedIfAndWhere."); } } void SchedIfAndWhere_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_where.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 SchedIfAndWhere_template[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.SchedIfAndWhere."); } } void SchedIfAndWhere_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: { SchedIfAndWhere_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) where().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(), "where")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { where().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.SchedIfAndWhere: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { SchedIfAndWhere_template* precondition = new SchedIfAndWhere_template; precondition->set_param(*param.get_elem(0)); SchedIfAndWhere_template* implied_template = new SchedIfAndWhere_template; implied_template->set_param(*param.get_elem(1)); *this = SchedIfAndWhere_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.SchedIfAndWhere"); } is_ifpresent = param.get_ifpresent(); } void SchedIfAndWhere_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.SchedIfAndWhere"); single_value->field_where.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SchedIfAndWhere"); 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.SchedIfAndWhere"); } boolean SchedIfAndWhere_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean SchedIfAndWhere_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_ind) : field_presence(par_presence), field_ind(par_ind) { } GPRSIndicatorOpt::GPRSIndicatorOpt(const GPRSIndicatorOpt& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.GPRSIndicatorOpt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.ind().is_bound()) field_ind = other_value.ind(); else field_ind.clean_up(); } void GPRSIndicatorOpt::clean_up() { field_presence.clean_up(); field_ind.clean_up(); } const TTCN_Typedescriptor_t* GPRSIndicatorOpt::get_descriptor() const { return &GPRSIndicatorOpt_descr_; } GPRSIndicatorOpt& GPRSIndicatorOpt::operator=(const GPRSIndicatorOpt& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.GPRSIndicatorOpt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.ind().is_bound()) field_ind = other_value.ind(); else field_ind.clean_up(); } return *this; } boolean GPRSIndicatorOpt::operator==(const GPRSIndicatorOpt& other_value) const { return field_presence==other_value.field_presence && field_ind==other_value.field_ind; } boolean GPRSIndicatorOpt::is_bound() const { return (field_presence.is_bound()) || (OPTIONAL_OMIT == field_ind.get_selection() || field_ind.is_bound()); } boolean GPRSIndicatorOpt::is_value() const { return field_presence.is_value() && (OPTIONAL_OMIT == field_ind.get_selection() || field_ind.is_value()); } int GPRSIndicatorOpt::size_of() const { int ret_val = 1; if (field_ind.ispresent()) ret_val++; return ret_val; } void GPRSIndicatorOpt::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(", ind := "); field_ind.log(); TTCN_Logger::log_event_str(" }"); } void GPRSIndicatorOpt::set_implicit_omit() { if (presence().is_bound()) presence().set_implicit_omit(); if (!ind().is_bound()) ind() = OMIT_VALUE; else ind().set_implicit_omit(); } void GPRSIndicatorOpt::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) ind().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(), "ind")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ind().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.GPRSIndicatorOpt: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.GPRSIndicatorOpt"); } } void GPRSIndicatorOpt::encode_text(Text_Buf& text_buf) const { field_presence.encode_text(text_buf); field_ind.encode_text(text_buf); } void GPRSIndicatorOpt::decode_text(Text_Buf& text_buf) { field_presence.decode_text(text_buf); field_ind.decode_text(text_buf); } void GPRSIndicatorOpt::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 GPRSIndicatorOpt::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 GPRSIndicatorOpt::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, GPRSIndicatorOpt_presence_descr_.raw->forceomit); decoded_field_length = field_presence.RAW_decode(GPRSIndicatorOpt_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_ind = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_1_force_omit(1, force_omit, GPRSIndicatorOpt_ind_descr_.raw->forceomit); decoded_field_length = field_ind().RAW_decode(GPRSIndicatorOpt_ind_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 1) { field_ind = 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_ind=OMIT_VALUE; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int GPRSIndicatorOpt::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, GPRSIndicatorOpt_presence_descr_.raw); if (field_ind.ispresent()) { myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, GPRSIndicatorOpt_ind_descr_.raw); } else myleaf.body.node.nodes[1] = NULL; encoded_length += field_presence.RAW_encode(GPRSIndicatorOpt_presence_descr_, *myleaf.body.node.nodes[0]); if (field_ind.ispresent()) { encoded_length += field_ind().RAW_encode(GPRSIndicatorOpt_ind_descr_, *myleaf.body.node.nodes[1]); } if (field_ind.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(GPRSIndicatorOpt_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 GPRSIndicatorOpt_template::single_value_struct { BITSTRING_template field_presence; GPRSIndicator_template field_ind; }; void GPRSIndicatorOpt_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_ind = ANY_OR_OMIT; } } } void GPRSIndicatorOpt_template::copy_value(const GPRSIndicatorOpt& 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.ind().is_bound()) { if (other_value.ind().ispresent()) single_value->field_ind = other_value.ind()(); else single_value->field_ind = OMIT_VALUE; } else { single_value->field_ind.clean_up(); } set_selection(SPECIFIC_VALUE); } void GPRSIndicatorOpt_template::copy_template(const GPRSIndicatorOpt_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.ind().get_selection()) { single_value->field_ind = other_value.ind(); } else { single_value->field_ind.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 GPRSIndicatorOpt_template[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 GPRSIndicatorOpt_template(*other_value.implication_.precondition); implication_.implied_template = new GPRSIndicatorOpt_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.GPRSIndicatorOpt."); break; } set_selection(other_value); } GPRSIndicatorOpt_template::GPRSIndicatorOpt_template() { } GPRSIndicatorOpt_template::GPRSIndicatorOpt_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } GPRSIndicatorOpt_template::GPRSIndicatorOpt_template(const GPRSIndicatorOpt& other_value) { copy_value(other_value); } GPRSIndicatorOpt_template::GPRSIndicatorOpt_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const GPRSIndicatorOpt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.GPRSIndicatorOpt from an unbound optional field."); } } GPRSIndicatorOpt_template::GPRSIndicatorOpt_template(GPRSIndicatorOpt_template* p_precondition, GPRSIndicatorOpt_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } GPRSIndicatorOpt_template::GPRSIndicatorOpt_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; } GPRSIndicatorOpt_template::GPRSIndicatorOpt_template(const GPRSIndicatorOpt_template& other_value) : Base_Template() { copy_template(other_value); } GPRSIndicatorOpt_template::~GPRSIndicatorOpt_template() { clean_up(); } GPRSIndicatorOpt_template& GPRSIndicatorOpt_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } GPRSIndicatorOpt_template& GPRSIndicatorOpt_template::operator=(const GPRSIndicatorOpt& other_value) { clean_up(); copy_value(other_value); return *this; } GPRSIndicatorOpt_template& GPRSIndicatorOpt_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const GPRSIndicatorOpt&)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.GPRSIndicatorOpt."); } return *this; } GPRSIndicatorOpt_template& GPRSIndicatorOpt_template::operator=(const GPRSIndicatorOpt_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean GPRSIndicatorOpt_template::match(const GPRSIndicatorOpt& 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.ind().is_bound()) return FALSE; if((other_value.ind().ispresent() ? !single_value->field_ind.match((const GPRSIndicator&)other_value.ind(), legacy) : !single_value->field_ind.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.GPRSIndicatorOpt."); } return FALSE; } boolean GPRSIndicatorOpt_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_ind.is_omit() || single_value->field_ind.is_bound()); } boolean GPRSIndicatorOpt_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_presence.is_value() && (single_value->field_ind.is_omit() || single_value->field_ind.is_value()); } void GPRSIndicatorOpt_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; } GPRSIndicatorOpt GPRSIndicatorOpt_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.GPRSIndicatorOpt."); GPRSIndicatorOpt ret_val; if (single_value->field_presence.is_bound()) { ret_val.presence() = single_value->field_presence.valueof(); } if (single_value->field_ind.is_omit()) ret_val.ind() = OMIT_VALUE; else if (single_value->field_ind.is_bound()) { ret_val.ind() = single_value->field_ind.valueof(); } return ret_val; } void GPRSIndicatorOpt_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.GPRSIndicatorOpt."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new GPRSIndicatorOpt_template[list_length]; } GPRSIndicatorOpt_template& GPRSIndicatorOpt_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.GPRSIndicatorOpt."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.GPRSIndicatorOpt."); return value_list.list_value[list_index]; } BITSTRING_template& GPRSIndicatorOpt_template::presence() { set_specific(); return single_value->field_presence; } const BITSTRING_template& GPRSIndicatorOpt_template::presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field presence of a non-specific template of type @GSM_RestOctets.GPRSIndicatorOpt."); return single_value->field_presence; } GPRSIndicator_template& GPRSIndicatorOpt_template::ind() { set_specific(); return single_value->field_ind; } const GPRSIndicator_template& GPRSIndicatorOpt_template::ind() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ind of a non-specific template of type @GSM_RestOctets.GPRSIndicatorOpt."); return single_value->field_ind; } int GPRSIndicatorOpt_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.GPRSIndicatorOpt which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 1; if (single_value->field_ind.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.GPRSIndicatorOpt 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.GPRSIndicatorOpt 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.GPRSIndicatorOpt containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.GPRSIndicatorOpt containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.GPRSIndicatorOpt containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.GPRSIndicatorOpt containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.GPRSIndicatorOpt containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.GPRSIndicatorOpt containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.GPRSIndicatorOpt."); } return 0; } void GPRSIndicatorOpt_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(", ind := "); single_value->field_ind.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 GPRSIndicatorOpt_template::log_match(const GPRSIndicatorOpt& 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.ind().ispresent()){ if(!single_value->field_ind.match(match_value.ind(), legacy)){ TTCN_Logger::log_logmatch_info(".ind"); single_value->field_ind.log_match(match_value.ind(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_ind.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".ind := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_ind.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(", ind := "); if (match_value.ind().ispresent()) { single_value->field_ind.log_match(match_value.ind(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_ind.log(); if (single_value->field_ind.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 GPRSIndicatorOpt_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (presence().is_bound()) presence().set_implicit_omit(); if (!ind().is_bound()) ind() = OMIT_VALUE; else ind().set_implicit_omit(); } void GPRSIndicatorOpt_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_ind.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.GPRSIndicatorOpt."); } } void GPRSIndicatorOpt_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_ind.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 GPRSIndicatorOpt_template[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.GPRSIndicatorOpt."); } } void GPRSIndicatorOpt_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: { GPRSIndicatorOpt_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) ind().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(), "ind")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ind().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.GPRSIndicatorOpt: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { GPRSIndicatorOpt_template* precondition = new GPRSIndicatorOpt_template; precondition->set_param(*param.get_elem(0)); GPRSIndicatorOpt_template* implied_template = new GPRSIndicatorOpt_template; implied_template->set_param(*param.get_elem(1)); *this = GPRSIndicatorOpt_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.GPRSIndicatorOpt"); } is_ifpresent = param.get_ifpresent(); } void GPRSIndicatorOpt_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.GPRSIndicatorOpt"); single_value->field_ind.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.GPRSIndicatorOpt"); 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.GPRSIndicatorOpt"); } boolean GPRSIndicatorOpt_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean GPRSIndicatorOpt_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) ra__colour().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) si13__pos().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(), "ra_colour")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ra__colour().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "si13_pos")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { si13__pos().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.GPRSIndicator: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.GPRSIndicator"); } } void GPRSIndicator::encode_text(Text_Buf& text_buf) const { field_ra__colour.encode_text(text_buf); field_si13__pos.encode_text(text_buf); } void GPRSIndicator::decode_text(Text_Buf& text_buf) { field_ra__colour.decode_text(text_buf); field_si13__pos.decode_text(text_buf); } void GPRSIndicator::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 GPRSIndicator::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 GPRSIndicator::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, GPRSIndicator_ra__colour_descr_.raw->forceomit); decoded_field_length = field_ra__colour.RAW_decode(GPRSIndicator_ra__colour_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, GPRSIndicator_si13__pos_descr_.raw->forceomit); decoded_field_length = field_si13__pos.RAW_decode(GPRSIndicator_si13__pos_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 GPRSIndicator::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, GPRSIndicator_ra__colour_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, GPRSIndicator_si13__pos_descr_.raw); encoded_length += field_ra__colour.RAW_encode(GPRSIndicator_ra__colour_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_si13__pos.RAW_encode(GPRSIndicator_si13__pos_descr_, *myleaf.body.node.nodes[1]); return myleaf.length = encoded_length; } struct GPRSIndicator_template::single_value_struct { INTEGER_template field_ra__colour; BITSTRING_template field_si13__pos; }; void GPRSIndicator_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_ra__colour = ANY_VALUE; single_value->field_si13__pos = ANY_VALUE; } } } void GPRSIndicator_template::copy_value(const GPRSIndicator& other_value) { single_value = new single_value_struct; if (other_value.ra__colour().is_bound()) { single_value->field_ra__colour = other_value.ra__colour(); } else { single_value->field_ra__colour.clean_up(); } if (other_value.si13__pos().is_bound()) { single_value->field_si13__pos = other_value.si13__pos(); } else { single_value->field_si13__pos.clean_up(); } set_selection(SPECIFIC_VALUE); } void GPRSIndicator_template::copy_template(const GPRSIndicator_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.ra__colour().get_selection()) { single_value->field_ra__colour = other_value.ra__colour(); } else { single_value->field_ra__colour.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.si13__pos().get_selection()) { single_value->field_si13__pos = other_value.si13__pos(); } else { single_value->field_si13__pos.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 GPRSIndicator_template[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 GPRSIndicator_template(*other_value.implication_.precondition); implication_.implied_template = new GPRSIndicator_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.GPRSIndicator."); break; } set_selection(other_value); } GPRSIndicator_template::GPRSIndicator_template() { } GPRSIndicator_template::GPRSIndicator_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } GPRSIndicator_template::GPRSIndicator_template(const GPRSIndicator& other_value) { copy_value(other_value); } GPRSIndicator_template::GPRSIndicator_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const GPRSIndicator&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.GPRSIndicator from an unbound optional field."); } } GPRSIndicator_template::GPRSIndicator_template(GPRSIndicator_template* p_precondition, GPRSIndicator_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } GPRSIndicator_template::GPRSIndicator_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; } GPRSIndicator_template::GPRSIndicator_template(const GPRSIndicator_template& other_value) : Base_Template() { copy_template(other_value); } GPRSIndicator_template::~GPRSIndicator_template() { clean_up(); } GPRSIndicator_template& GPRSIndicator_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } GPRSIndicator_template& GPRSIndicator_template::operator=(const GPRSIndicator& other_value) { clean_up(); copy_value(other_value); return *this; } GPRSIndicator_template& GPRSIndicator_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const GPRSIndicator&)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.GPRSIndicator."); } return *this; } GPRSIndicator_template& GPRSIndicator_template::operator=(const GPRSIndicator_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean GPRSIndicator_template::match(const GPRSIndicator& 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.ra__colour().is_bound()) return FALSE; if(!single_value->field_ra__colour.match(other_value.ra__colour(), legacy))return FALSE; if(!other_value.si13__pos().is_bound()) return FALSE; if(!single_value->field_si13__pos.match(other_value.si13__pos(), 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.GPRSIndicator."); } return FALSE; } boolean GPRSIndicator_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_ra__colour.is_bound() || single_value->field_si13__pos.is_bound(); } boolean GPRSIndicator_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_ra__colour.is_value() && single_value->field_si13__pos.is_value(); } void GPRSIndicator_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; } GPRSIndicator GPRSIndicator_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.GPRSIndicator."); GPRSIndicator ret_val; if (single_value->field_ra__colour.is_bound()) { ret_val.ra__colour() = single_value->field_ra__colour.valueof(); } if (single_value->field_si13__pos.is_bound()) { ret_val.si13__pos() = single_value->field_si13__pos.valueof(); } return ret_val; } void GPRSIndicator_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.GPRSIndicator."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new GPRSIndicator_template[list_length]; } GPRSIndicator_template& GPRSIndicator_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.GPRSIndicator."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.GPRSIndicator."); return value_list.list_value[list_index]; } INTEGER_template& GPRSIndicator_template::ra__colour() { set_specific(); return single_value->field_ra__colour; } const INTEGER_template& GPRSIndicator_template::ra__colour() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ra_colour of a non-specific template of type @GSM_RestOctets.GPRSIndicator."); return single_value->field_ra__colour; } BITSTRING_template& GPRSIndicator_template::si13__pos() { set_specific(); return single_value->field_si13__pos; } const BITSTRING_template& GPRSIndicator_template::si13__pos() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field si13_pos of a non-specific template of type @GSM_RestOctets.GPRSIndicator."); return single_value->field_si13__pos; } int GPRSIndicator_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.GPRSIndicator 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.GPRSIndicator 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.GPRSIndicator 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.GPRSIndicator containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.GPRSIndicator containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.GPRSIndicator containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.GPRSIndicator containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.GPRSIndicator containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.GPRSIndicator containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.GPRSIndicator."); } return 0; } void GPRSIndicator_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ ra_colour := "); single_value->field_ra__colour.log(); TTCN_Logger::log_event_str(", si13_pos := "); single_value->field_si13__pos.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 GPRSIndicator_template::log_match(const GPRSIndicator& 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_ra__colour.match(match_value.ra__colour(), legacy)){ TTCN_Logger::log_logmatch_info(".ra_colour"); single_value->field_ra__colour.log_match(match_value.ra__colour(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_si13__pos.match(match_value.si13__pos(), legacy)){ TTCN_Logger::log_logmatch_info(".si13_pos"); single_value->field_si13__pos.log_match(match_value.si13__pos(), 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("{ ra_colour := "); single_value->field_ra__colour.log_match(match_value.ra__colour(), legacy); TTCN_Logger::log_event_str(", si13_pos := "); single_value->field_si13__pos.log_match(match_value.si13__pos(), 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 GPRSIndicator_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (ra__colour().is_bound()) ra__colour().set_implicit_omit(); if (si13__pos().is_bound()) si13__pos().set_implicit_omit(); } void GPRSIndicator_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_ra__colour.encode_text(text_buf); single_value->field_si13__pos.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.GPRSIndicator."); } } void GPRSIndicator_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_ra__colour.decode_text(text_buf); single_value->field_si13__pos.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 GPRSIndicator_template[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.GPRSIndicator."); } } void GPRSIndicator_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: { GPRSIndicator_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) ra__colour().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) si13__pos().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(), "ra_colour")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ra__colour().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "si13_pos")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { si13__pos().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.GPRSIndicator: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { GPRSIndicator_template* precondition = new GPRSIndicator_template; precondition->set_param(*param.get_elem(0)); GPRSIndicator_template* implied_template = new GPRSIndicator_template; implied_template->set_param(*param.get_elem(1)); *this = GPRSIndicator_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.GPRSIndicator"); } is_ifpresent = param.get_ifpresent(); } void GPRSIndicator_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_ra__colour.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.GPRSIndicator"); single_value->field_si13__pos.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.GPRSIndicator"); 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.GPRSIndicator"); } boolean GPRSIndicator_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean GPRSIndicator_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_ind) : field_presence(par_presence), field_ind(par_ind) { } SI2quaterIndicatorOpt::SI2quaterIndicatorOpt(const SI2quaterIndicatorOpt& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.SI2quaterIndicatorOpt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.ind().is_bound()) field_ind = other_value.ind(); else field_ind.clean_up(); } void SI2quaterIndicatorOpt::clean_up() { field_presence.clean_up(); field_ind.clean_up(); } const TTCN_Typedescriptor_t* SI2quaterIndicatorOpt::get_descriptor() const { return &SI2quaterIndicatorOpt_descr_; } SI2quaterIndicatorOpt& SI2quaterIndicatorOpt::operator=(const SI2quaterIndicatorOpt& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.SI2quaterIndicatorOpt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.ind().is_bound()) field_ind = other_value.ind(); else field_ind.clean_up(); } return *this; } boolean SI2quaterIndicatorOpt::operator==(const SI2quaterIndicatorOpt& other_value) const { return field_presence==other_value.field_presence && field_ind==other_value.field_ind; } boolean SI2quaterIndicatorOpt::is_bound() const { return (field_presence.is_bound()) || (OPTIONAL_OMIT == field_ind.get_selection() || field_ind.is_bound()); } boolean SI2quaterIndicatorOpt::is_value() const { return field_presence.is_value() && (OPTIONAL_OMIT == field_ind.get_selection() || field_ind.is_value()); } int SI2quaterIndicatorOpt::size_of() const { int ret_val = 1; if (field_ind.ispresent()) ret_val++; return ret_val; } void SI2quaterIndicatorOpt::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(", ind := "); field_ind.log(); TTCN_Logger::log_event_str(" }"); } void SI2quaterIndicatorOpt::set_implicit_omit() { if (presence().is_bound()) presence().set_implicit_omit(); if (!ind().is_bound()) ind() = OMIT_VALUE; else ind().set_implicit_omit(); } void SI2quaterIndicatorOpt::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) ind().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(), "ind")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ind().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.SI2quaterIndicatorOpt: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.SI2quaterIndicatorOpt"); } } void SI2quaterIndicatorOpt::encode_text(Text_Buf& text_buf) const { field_presence.encode_text(text_buf); field_ind.encode_text(text_buf); } void SI2quaterIndicatorOpt::decode_text(Text_Buf& text_buf) { field_presence.decode_text(text_buf); field_ind.decode_text(text_buf); } void SI2quaterIndicatorOpt::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 SI2quaterIndicatorOpt::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 SI2quaterIndicatorOpt::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, SI2quaterIndicatorOpt_presence_descr_.raw->forceomit); decoded_field_length = field_presence.RAW_decode(SI2quaterIndicatorOpt_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_ind = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_1_force_omit(1, force_omit, SI2quaterIndicatorOpt_ind_descr_.raw->forceomit); decoded_field_length = field_ind().RAW_decode(SI2quaterIndicatorOpt_ind_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 1) { field_ind = 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_ind=OMIT_VALUE; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int SI2quaterIndicatorOpt::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, SI2quaterIndicatorOpt_presence_descr_.raw); if (field_ind.ispresent()) { myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, SI2quaterIndicatorOpt_ind_descr_.raw); } else myleaf.body.node.nodes[1] = NULL; encoded_length += field_presence.RAW_encode(SI2quaterIndicatorOpt_presence_descr_, *myleaf.body.node.nodes[0]); if (field_ind.ispresent()) { encoded_length += field_ind().RAW_encode(SI2quaterIndicatorOpt_ind_descr_, *myleaf.body.node.nodes[1]); } if (field_ind.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(SI2quaterIndicatorOpt_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 SI2quaterIndicatorOpt_template::single_value_struct { BITSTRING_template field_presence; BITSTRING_template field_ind; }; void SI2quaterIndicatorOpt_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_ind = ANY_OR_OMIT; } } } void SI2quaterIndicatorOpt_template::copy_value(const SI2quaterIndicatorOpt& 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.ind().is_bound()) { if (other_value.ind().ispresent()) single_value->field_ind = other_value.ind()(); else single_value->field_ind = OMIT_VALUE; } else { single_value->field_ind.clean_up(); } set_selection(SPECIFIC_VALUE); } void SI2quaterIndicatorOpt_template::copy_template(const SI2quaterIndicatorOpt_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.ind().get_selection()) { single_value->field_ind = other_value.ind(); } else { single_value->field_ind.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 SI2quaterIndicatorOpt_template[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 SI2quaterIndicatorOpt_template(*other_value.implication_.precondition); implication_.implied_template = new SI2quaterIndicatorOpt_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.SI2quaterIndicatorOpt."); break; } set_selection(other_value); } SI2quaterIndicatorOpt_template::SI2quaterIndicatorOpt_template() { } SI2quaterIndicatorOpt_template::SI2quaterIndicatorOpt_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } SI2quaterIndicatorOpt_template::SI2quaterIndicatorOpt_template(const SI2quaterIndicatorOpt& other_value) { copy_value(other_value); } SI2quaterIndicatorOpt_template::SI2quaterIndicatorOpt_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI2quaterIndicatorOpt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.SI2quaterIndicatorOpt from an unbound optional field."); } } SI2quaterIndicatorOpt_template::SI2quaterIndicatorOpt_template(SI2quaterIndicatorOpt_template* p_precondition, SI2quaterIndicatorOpt_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } SI2quaterIndicatorOpt_template::SI2quaterIndicatorOpt_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; } SI2quaterIndicatorOpt_template::SI2quaterIndicatorOpt_template(const SI2quaterIndicatorOpt_template& other_value) : Base_Template() { copy_template(other_value); } SI2quaterIndicatorOpt_template::~SI2quaterIndicatorOpt_template() { clean_up(); } SI2quaterIndicatorOpt_template& SI2quaterIndicatorOpt_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } SI2quaterIndicatorOpt_template& SI2quaterIndicatorOpt_template::operator=(const SI2quaterIndicatorOpt& other_value) { clean_up(); copy_value(other_value); return *this; } SI2quaterIndicatorOpt_template& SI2quaterIndicatorOpt_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI2quaterIndicatorOpt&)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.SI2quaterIndicatorOpt."); } return *this; } SI2quaterIndicatorOpt_template& SI2quaterIndicatorOpt_template::operator=(const SI2quaterIndicatorOpt_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean SI2quaterIndicatorOpt_template::match(const SI2quaterIndicatorOpt& 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.ind().is_bound()) return FALSE; if((other_value.ind().ispresent() ? !single_value->field_ind.match((const BITSTRING&)other_value.ind(), legacy) : !single_value->field_ind.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.SI2quaterIndicatorOpt."); } return FALSE; } boolean SI2quaterIndicatorOpt_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_ind.is_omit() || single_value->field_ind.is_bound()); } boolean SI2quaterIndicatorOpt_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_presence.is_value() && (single_value->field_ind.is_omit() || single_value->field_ind.is_value()); } void SI2quaterIndicatorOpt_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; } SI2quaterIndicatorOpt SI2quaterIndicatorOpt_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.SI2quaterIndicatorOpt."); SI2quaterIndicatorOpt ret_val; if (single_value->field_presence.is_bound()) { ret_val.presence() = single_value->field_presence.valueof(); } if (single_value->field_ind.is_omit()) ret_val.ind() = OMIT_VALUE; else if (single_value->field_ind.is_bound()) { ret_val.ind() = single_value->field_ind.valueof(); } return ret_val; } void SI2quaterIndicatorOpt_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.SI2quaterIndicatorOpt."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new SI2quaterIndicatorOpt_template[list_length]; } SI2quaterIndicatorOpt_template& SI2quaterIndicatorOpt_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.SI2quaterIndicatorOpt."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.SI2quaterIndicatorOpt."); return value_list.list_value[list_index]; } BITSTRING_template& SI2quaterIndicatorOpt_template::presence() { set_specific(); return single_value->field_presence; } const BITSTRING_template& SI2quaterIndicatorOpt_template::presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field presence of a non-specific template of type @GSM_RestOctets.SI2quaterIndicatorOpt."); return single_value->field_presence; } BITSTRING_template& SI2quaterIndicatorOpt_template::ind() { set_specific(); return single_value->field_ind; } const BITSTRING_template& SI2quaterIndicatorOpt_template::ind() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ind of a non-specific template of type @GSM_RestOctets.SI2quaterIndicatorOpt."); return single_value->field_ind; } int SI2quaterIndicatorOpt_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterIndicatorOpt which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 1; if (single_value->field_ind.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.SI2quaterIndicatorOpt 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.SI2quaterIndicatorOpt 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.SI2quaterIndicatorOpt containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterIndicatorOpt containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterIndicatorOpt containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterIndicatorOpt containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterIndicatorOpt containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI2quaterIndicatorOpt containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.SI2quaterIndicatorOpt."); } return 0; } void SI2quaterIndicatorOpt_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(", ind := "); single_value->field_ind.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 SI2quaterIndicatorOpt_template::log_match(const SI2quaterIndicatorOpt& 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.ind().ispresent()){ if(!single_value->field_ind.match(match_value.ind(), legacy)){ TTCN_Logger::log_logmatch_info(".ind"); single_value->field_ind.log_match(match_value.ind(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_ind.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".ind := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_ind.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(", ind := "); if (match_value.ind().ispresent()) { single_value->field_ind.log_match(match_value.ind(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_ind.log(); if (single_value->field_ind.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 SI2quaterIndicatorOpt_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (presence().is_bound()) presence().set_implicit_omit(); if (!ind().is_bound()) ind() = OMIT_VALUE; else ind().set_implicit_omit(); } void SI2quaterIndicatorOpt_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_ind.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.SI2quaterIndicatorOpt."); } } void SI2quaterIndicatorOpt_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_ind.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 SI2quaterIndicatorOpt_template[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.SI2quaterIndicatorOpt."); } } void SI2quaterIndicatorOpt_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: { SI2quaterIndicatorOpt_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) ind().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(), "ind")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ind().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.SI2quaterIndicatorOpt: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { SI2quaterIndicatorOpt_template* precondition = new SI2quaterIndicatorOpt_template; precondition->set_param(*param.get_elem(0)); SI2quaterIndicatorOpt_template* implied_template = new SI2quaterIndicatorOpt_template; implied_template->set_param(*param.get_elem(1)); *this = SI2quaterIndicatorOpt_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.SI2quaterIndicatorOpt"); } is_ifpresent = param.get_ifpresent(); } void SI2quaterIndicatorOpt_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.SI2quaterIndicatorOpt"); single_value->field_ind.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI2quaterIndicatorOpt"); 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.SI2quaterIndicatorOpt"); } boolean SI2quaterIndicatorOpt_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean SI2quaterIndicatorOpt_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_iu__mode__ind, const OPTIONAL< SI21IndicatorOpt >& par_si21__ind) : field_sel__params(par_sel__params), field_pwr__offset(par_pwr__offset), field_si__2ter__ind(par_si__2ter__ind), field_early__cm__ind(par_early__cm__ind), field_sched__where(par_sched__where), field_gprs__ind(par_gprs__ind), field_umts__early__cm__ind(par_umts__early__cm__ind), field_si2__quater__ind(par_si2__quater__ind), field_iu__mode__ind(par_iu__mode__ind), field_si21__ind(par_si21__ind) { } SI3RestOctets::SI3RestOctets(const SI3RestOctets& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.SI3RestOctets."); if (other_value.sel__params().is_bound()) field_sel__params = other_value.sel__params(); else field_sel__params.clean_up(); if (other_value.pwr__offset().is_bound()) field_pwr__offset = other_value.pwr__offset(); else field_pwr__offset.clean_up(); if (other_value.si__2ter__ind().is_bound()) field_si__2ter__ind = other_value.si__2ter__ind(); else field_si__2ter__ind.clean_up(); if (other_value.early__cm__ind().is_bound()) field_early__cm__ind = other_value.early__cm__ind(); else field_early__cm__ind.clean_up(); if (other_value.sched__where().is_bound()) field_sched__where = other_value.sched__where(); else field_sched__where.clean_up(); if (other_value.gprs__ind().is_bound()) field_gprs__ind = other_value.gprs__ind(); else field_gprs__ind.clean_up(); if (other_value.umts__early__cm__ind().is_bound()) field_umts__early__cm__ind = other_value.umts__early__cm__ind(); else field_umts__early__cm__ind.clean_up(); if (other_value.si2__quater__ind().is_bound()) field_si2__quater__ind = other_value.si2__quater__ind(); else field_si2__quater__ind.clean_up(); if (other_value.iu__mode__ind().is_bound()) field_iu__mode__ind = other_value.iu__mode__ind(); else field_iu__mode__ind.clean_up(); if (other_value.si21__ind().is_bound()) field_si21__ind = other_value.si21__ind(); else field_si21__ind.clean_up(); } void SI3RestOctets::clean_up() { field_sel__params.clean_up(); field_pwr__offset.clean_up(); field_si__2ter__ind.clean_up(); field_early__cm__ind.clean_up(); field_sched__where.clean_up(); field_gprs__ind.clean_up(); field_umts__early__cm__ind.clean_up(); field_si2__quater__ind.clean_up(); field_iu__mode__ind.clean_up(); field_si21__ind.clean_up(); } const TTCN_Typedescriptor_t* SI3RestOctets::get_descriptor() const { return &SI3RestOctets_descr_; } SI3RestOctets& SI3RestOctets::operator=(const SI3RestOctets& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.SI3RestOctets."); if (other_value.sel__params().is_bound()) field_sel__params = other_value.sel__params(); else field_sel__params.clean_up(); if (other_value.pwr__offset().is_bound()) field_pwr__offset = other_value.pwr__offset(); else field_pwr__offset.clean_up(); if (other_value.si__2ter__ind().is_bound()) field_si__2ter__ind = other_value.si__2ter__ind(); else field_si__2ter__ind.clean_up(); if (other_value.early__cm__ind().is_bound()) field_early__cm__ind = other_value.early__cm__ind(); else field_early__cm__ind.clean_up(); if (other_value.sched__where().is_bound()) field_sched__where = other_value.sched__where(); else field_sched__where.clean_up(); if (other_value.gprs__ind().is_bound()) field_gprs__ind = other_value.gprs__ind(); else field_gprs__ind.clean_up(); if (other_value.umts__early__cm__ind().is_bound()) field_umts__early__cm__ind = other_value.umts__early__cm__ind(); else field_umts__early__cm__ind.clean_up(); if (other_value.si2__quater__ind().is_bound()) field_si2__quater__ind = other_value.si2__quater__ind(); else field_si2__quater__ind.clean_up(); if (other_value.iu__mode__ind().is_bound()) field_iu__mode__ind = other_value.iu__mode__ind(); else field_iu__mode__ind.clean_up(); if (other_value.si21__ind().is_bound()) field_si21__ind = other_value.si21__ind(); else field_si21__ind.clean_up(); } return *this; } boolean SI3RestOctets::operator==(const SI3RestOctets& other_value) const { return field_sel__params==other_value.field_sel__params && field_pwr__offset==other_value.field_pwr__offset && field_si__2ter__ind==other_value.field_si__2ter__ind && field_early__cm__ind==other_value.field_early__cm__ind && field_sched__where==other_value.field_sched__where && field_gprs__ind==other_value.field_gprs__ind && field_umts__early__cm__ind==other_value.field_umts__early__cm__ind && field_si2__quater__ind==other_value.field_si2__quater__ind && field_iu__mode__ind==other_value.field_iu__mode__ind && field_si21__ind==other_value.field_si21__ind; } boolean SI3RestOctets::is_bound() const { return (field_sel__params.is_bound()) || (field_pwr__offset.is_bound()) || (field_si__2ter__ind.is_bound()) || (field_early__cm__ind.is_bound()) || (field_sched__where.is_bound()) || (field_gprs__ind.is_bound()) || (field_umts__early__cm__ind.is_bound()) || (field_si2__quater__ind.is_bound()) || (OPTIONAL_OMIT == field_iu__mode__ind.get_selection() || field_iu__mode__ind.is_bound()) || (OPTIONAL_OMIT == field_si21__ind.get_selection() || field_si21__ind.is_bound()); } boolean SI3RestOctets::is_value() const { return field_sel__params.is_value() && field_pwr__offset.is_value() && field_si__2ter__ind.is_value() && field_early__cm__ind.is_value() && field_sched__where.is_value() && field_gprs__ind.is_value() && field_umts__early__cm__ind.is_value() && field_si2__quater__ind.is_value() && (OPTIONAL_OMIT == field_iu__mode__ind.get_selection() || field_iu__mode__ind.is_value()) && (OPTIONAL_OMIT == field_si21__ind.get_selection() || field_si21__ind.is_value()); } int SI3RestOctets::size_of() const { int ret_val = 8; if (field_iu__mode__ind.ispresent()) ret_val++; if (field_si21__ind.ispresent()) ret_val++; return ret_val; } void SI3RestOctets::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ sel_params := "); field_sel__params.log(); TTCN_Logger::log_event_str(", pwr_offset := "); field_pwr__offset.log(); TTCN_Logger::log_event_str(", si_2ter_ind := "); field_si__2ter__ind.log(); TTCN_Logger::log_event_str(", early_cm_ind := "); field_early__cm__ind.log(); TTCN_Logger::log_event_str(", sched_where := "); field_sched__where.log(); TTCN_Logger::log_event_str(", gprs_ind := "); field_gprs__ind.log(); TTCN_Logger::log_event_str(", umts_early_cm_ind := "); field_umts__early__cm__ind.log(); TTCN_Logger::log_event_str(", si2_quater_ind := "); field_si2__quater__ind.log(); TTCN_Logger::log_event_str(", iu_mode_ind := "); field_iu__mode__ind.log(); TTCN_Logger::log_event_str(", si21_ind := "); field_si21__ind.log(); TTCN_Logger::log_event_str(" }"); } void SI3RestOctets::set_implicit_omit() { if (sel__params().is_bound()) sel__params().set_implicit_omit(); if (pwr__offset().is_bound()) pwr__offset().set_implicit_omit(); if (si__2ter__ind().is_bound()) si__2ter__ind().set_implicit_omit(); if (early__cm__ind().is_bound()) early__cm__ind().set_implicit_omit(); if (sched__where().is_bound()) sched__where().set_implicit_omit(); if (gprs__ind().is_bound()) gprs__ind().set_implicit_omit(); if (umts__early__cm__ind().is_bound()) umts__early__cm__ind().set_implicit_omit(); if (si2__quater__ind().is_bound()) si2__quater__ind().set_implicit_omit(); if (!iu__mode__ind().is_bound()) iu__mode__ind() = OMIT_VALUE; else iu__mode__ind().set_implicit_omit(); if (!si21__ind().is_bound()) si21__ind() = OMIT_VALUE; else si21__ind().set_implicit_omit(); } void SI3RestOctets::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) sel__params().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) pwr__offset().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) si__2ter__ind().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) early__cm__ind().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) sched__where().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) gprs__ind().set_param(*param.get_elem(5)); if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) umts__early__cm__ind().set_param(*param.get_elem(6)); if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) si2__quater__ind().set_param(*param.get_elem(7)); if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) iu__mode__ind().set_param(*param.get_elem(8)); if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) si21__ind().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(), "sel_params")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { sel__params().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "pwr_offset")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { pwr__offset().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "si_2ter_ind")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { si__2ter__ind().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "early_cm_ind")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { early__cm__ind().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "sched_where")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { sched__where().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "gprs_ind")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { gprs__ind().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "umts_early_cm_ind")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { umts__early__cm__ind().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "si2_quater_ind")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { si2__quater__ind().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "iu_mode_ind")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { iu__mode__ind().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "si21_ind")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { si21__ind().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.SI3RestOctets: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.SI3RestOctets"); } } void SI3RestOctets::encode_text(Text_Buf& text_buf) const { field_sel__params.encode_text(text_buf); field_pwr__offset.encode_text(text_buf); field_si__2ter__ind.encode_text(text_buf); field_early__cm__ind.encode_text(text_buf); field_sched__where.encode_text(text_buf); field_gprs__ind.encode_text(text_buf); field_umts__early__cm__ind.encode_text(text_buf); field_si2__quater__ind.encode_text(text_buf); field_iu__mode__ind.encode_text(text_buf); field_si21__ind.encode_text(text_buf); } void SI3RestOctets::decode_text(Text_Buf& text_buf) { field_sel__params.decode_text(text_buf); field_pwr__offset.decode_text(text_buf); field_si__2ter__ind.decode_text(text_buf); field_early__cm__ind.decode_text(text_buf); field_sched__where.decode_text(text_buf); field_gprs__ind.decode_text(text_buf); field_umts__early__cm__ind.decode_text(text_buf); field_si2__quater__ind.decode_text(text_buf); field_iu__mode__ind.decode_text(text_buf); field_si21__ind.decode_text(text_buf); } void SI3RestOctets::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 SI3RestOctets::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 SI3RestOctets::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, SI3RestOctets_sel__params_descr_.raw->forceomit); decoded_field_length = field_sel__params.RAW_decode(SI3RestOctets_sel__params_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, SI3RestOctets_pwr__offset_descr_.raw->forceomit); decoded_field_length = field_pwr__offset.RAW_decode(SI3RestOctets_pwr__offset_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, SI3RestOctets_si__2ter__ind_descr_.raw->forceomit); decoded_field_length = field_si__2ter__ind.RAW_decode(SI3RestOctets_si__2ter__ind_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, SI3RestOctets_early__cm__ind_descr_.raw->forceomit); decoded_field_length = field_early__cm__ind.RAW_decode(SI3RestOctets_early__cm__ind_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, SI3RestOctets_sched__where_descr_.raw->forceomit); decoded_field_length = field_sched__where.RAW_decode(SI3RestOctets_sched__where_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, SI3RestOctets_gprs__ind_descr_.raw->forceomit); decoded_field_length = field_gprs__ind.RAW_decode(SI3RestOctets_gprs__ind_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, SI3RestOctets_umts__early__cm__ind_descr_.raw->forceomit); decoded_field_length = field_umts__early__cm__ind.RAW_decode(SI3RestOctets_umts__early__cm__ind_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_6_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); RAW_Force_Omit field_7_force_omit(7, force_omit, SI3RestOctets_si2__quater__ind_descr_.raw->forceomit); decoded_field_length = field_si2__quater__ind.RAW_decode(SI3RestOctets_si2__quater__ind_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_7_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); if (limit > 0 && field_gprs__ind.presence() == bs_1){ if (force_omit != NULL && (*force_omit)(8)) { field_iu__mode__ind = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_8_force_omit(8, force_omit, SI3RestOctets_iu__mode__ind_descr_.raw->forceomit); decoded_field_length = field_iu__mode__ind().RAW_decode(SI3RestOctets_iu__mode__ind_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_8_force_omit); if (decoded_field_length < 1) { field_iu__mode__ind = 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_iu__mode__ind=OMIT_VALUE; if (limit > 0 && field_sched__where.presence() == bs_1){ if (force_omit != NULL && (*force_omit)(9)) { field_si21__ind = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_9_force_omit(9, force_omit, SI3RestOctets_si21__ind_descr_.raw->forceomit); decoded_field_length = field_si21__ind().RAW_decode(SI3RestOctets_si21__ind_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_9_force_omit); if (decoded_field_length < 1) { field_si21__ind = 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_si21__ind=OMIT_VALUE; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int SI3RestOctets::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, SI3RestOctets_sel__params_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, SI3RestOctets_pwr__offset_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, SI3RestOctets_si__2ter__ind_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, SI3RestOctets_early__cm__ind_descr_.raw); myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, SI3RestOctets_sched__where_descr_.raw); myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, SI3RestOctets_gprs__ind_descr_.raw); myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, SI3RestOctets_umts__early__cm__ind_descr_.raw); myleaf.body.node.nodes[7] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 7, SI3RestOctets_si2__quater__ind_descr_.raw); if (field_iu__mode__ind.ispresent()) { myleaf.body.node.nodes[8] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 8, SI3RestOctets_iu__mode__ind_descr_.raw); } else myleaf.body.node.nodes[8] = NULL; if (field_si21__ind.ispresent()) { myleaf.body.node.nodes[9] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 9, SI3RestOctets_si21__ind_descr_.raw); } else myleaf.body.node.nodes[9] = NULL; encoded_length += field_sel__params.RAW_encode(SI3RestOctets_sel__params_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_pwr__offset.RAW_encode(SI3RestOctets_pwr__offset_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_si__2ter__ind.RAW_encode(SI3RestOctets_si__2ter__ind_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_early__cm__ind.RAW_encode(SI3RestOctets_early__cm__ind_descr_, *myleaf.body.node.nodes[3]); encoded_length += field_sched__where.RAW_encode(SI3RestOctets_sched__where_descr_, *myleaf.body.node.nodes[4]); encoded_length += field_gprs__ind.RAW_encode(SI3RestOctets_gprs__ind_descr_, *myleaf.body.node.nodes[5]); encoded_length += field_umts__early__cm__ind.RAW_encode(SI3RestOctets_umts__early__cm__ind_descr_, *myleaf.body.node.nodes[6]); encoded_length += field_si2__quater__ind.RAW_encode(SI3RestOctets_si2__quater__ind_descr_, *myleaf.body.node.nodes[7]); if (field_iu__mode__ind.ispresent()) { encoded_length += field_iu__mode__ind().RAW_encode(SI3RestOctets_iu__mode__ind_descr_, *myleaf.body.node.nodes[8]); } if (field_si21__ind.ispresent()) { encoded_length += field_si21__ind().RAW_encode(SI3RestOctets_si21__ind_descr_, *myleaf.body.node.nodes[9]); } if (field_iu__mode__ind.ispresent() && (field_gprs__ind.presence() != bs_1)) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+2; int new_pos0[]={5,0}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,2,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ bs_1.RAW_encode(GPRSIndicatorOpt_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_si21__ind.ispresent() && (field_sched__where.presence() != bs_1)) { RAW_enc_tree* temp_leaf; { RAW_enc_tr_pos pr_pos0; pr_pos0.level=myleaf.curr_pos.level+2; int new_pos0[]={4,0}; pr_pos0.pos=init_new_tree_pos(myleaf.curr_pos,2,new_pos0); temp_leaf = myleaf.get_node(pr_pos0); if(temp_leaf != NULL){ bs_1.RAW_encode(SchedIfAndWhere_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 SI3RestOctets_template::single_value_struct { SelectionParamsOpt_template field_sel__params; PowerOffsetOpt_template field_pwr__offset; BITSTRING_template field_si__2ter__ind; BITSTRING_template field_early__cm__ind; SchedIfAndWhere_template field_sched__where; GPRSIndicatorOpt_template field_gprs__ind; BITSTRING_template field_umts__early__cm__ind; SI2quaterIndicatorOpt_template field_si2__quater__ind; BITSTRING_template field_iu__mode__ind; SI21IndicatorOpt_template field_si21__ind; }; void SI3RestOctets_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_sel__params = ANY_VALUE; single_value->field_pwr__offset = ANY_VALUE; single_value->field_si__2ter__ind = ANY_VALUE; single_value->field_early__cm__ind = ANY_VALUE; single_value->field_sched__where = ANY_VALUE; single_value->field_gprs__ind = ANY_VALUE; single_value->field_umts__early__cm__ind = ANY_VALUE; single_value->field_si2__quater__ind = ANY_VALUE; single_value->field_iu__mode__ind = ANY_OR_OMIT; single_value->field_si21__ind = ANY_OR_OMIT; } } } void SI3RestOctets_template::copy_value(const SI3RestOctets& other_value) { single_value = new single_value_struct; if (other_value.sel__params().is_bound()) { single_value->field_sel__params = other_value.sel__params(); } else { single_value->field_sel__params.clean_up(); } if (other_value.pwr__offset().is_bound()) { single_value->field_pwr__offset = other_value.pwr__offset(); } else { single_value->field_pwr__offset.clean_up(); } if (other_value.si__2ter__ind().is_bound()) { single_value->field_si__2ter__ind = other_value.si__2ter__ind(); } else { single_value->field_si__2ter__ind.clean_up(); } if (other_value.early__cm__ind().is_bound()) { single_value->field_early__cm__ind = other_value.early__cm__ind(); } else { single_value->field_early__cm__ind.clean_up(); } if (other_value.sched__where().is_bound()) { single_value->field_sched__where = other_value.sched__where(); } else { single_value->field_sched__where.clean_up(); } if (other_value.gprs__ind().is_bound()) { single_value->field_gprs__ind = other_value.gprs__ind(); } else { single_value->field_gprs__ind.clean_up(); } if (other_value.umts__early__cm__ind().is_bound()) { single_value->field_umts__early__cm__ind = other_value.umts__early__cm__ind(); } else { single_value->field_umts__early__cm__ind.clean_up(); } if (other_value.si2__quater__ind().is_bound()) { single_value->field_si2__quater__ind = other_value.si2__quater__ind(); } else { single_value->field_si2__quater__ind.clean_up(); } if (other_value.iu__mode__ind().is_bound()) { if (other_value.iu__mode__ind().ispresent()) single_value->field_iu__mode__ind = other_value.iu__mode__ind()(); else single_value->field_iu__mode__ind = OMIT_VALUE; } else { single_value->field_iu__mode__ind.clean_up(); } if (other_value.si21__ind().is_bound()) { if (other_value.si21__ind().ispresent()) single_value->field_si21__ind = other_value.si21__ind()(); else single_value->field_si21__ind = OMIT_VALUE; } else { single_value->field_si21__ind.clean_up(); } set_selection(SPECIFIC_VALUE); } void SI3RestOctets_template::copy_template(const SI3RestOctets_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.sel__params().get_selection()) { single_value->field_sel__params = other_value.sel__params(); } else { single_value->field_sel__params.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.pwr__offset().get_selection()) { single_value->field_pwr__offset = other_value.pwr__offset(); } else { single_value->field_pwr__offset.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.si__2ter__ind().get_selection()) { single_value->field_si__2ter__ind = other_value.si__2ter__ind(); } else { single_value->field_si__2ter__ind.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.early__cm__ind().get_selection()) { single_value->field_early__cm__ind = other_value.early__cm__ind(); } else { single_value->field_early__cm__ind.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.sched__where().get_selection()) { single_value->field_sched__where = other_value.sched__where(); } else { single_value->field_sched__where.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.gprs__ind().get_selection()) { single_value->field_gprs__ind = other_value.gprs__ind(); } else { single_value->field_gprs__ind.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.umts__early__cm__ind().get_selection()) { single_value->field_umts__early__cm__ind = other_value.umts__early__cm__ind(); } else { single_value->field_umts__early__cm__ind.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.si2__quater__ind().get_selection()) { single_value->field_si2__quater__ind = other_value.si2__quater__ind(); } else { single_value->field_si2__quater__ind.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.iu__mode__ind().get_selection()) { single_value->field_iu__mode__ind = other_value.iu__mode__ind(); } else { single_value->field_iu__mode__ind.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.si21__ind().get_selection()) { single_value->field_si21__ind = other_value.si21__ind(); } else { single_value->field_si21__ind.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 SI3RestOctets_template[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 SI3RestOctets_template(*other_value.implication_.precondition); implication_.implied_template = new SI3RestOctets_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.SI3RestOctets."); break; } set_selection(other_value); } SI3RestOctets_template::SI3RestOctets_template() { } SI3RestOctets_template::SI3RestOctets_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } SI3RestOctets_template::SI3RestOctets_template(const SI3RestOctets& other_value) { copy_value(other_value); } SI3RestOctets_template::SI3RestOctets_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI3RestOctets&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.SI3RestOctets from an unbound optional field."); } } SI3RestOctets_template::SI3RestOctets_template(SI3RestOctets_template* p_precondition, SI3RestOctets_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } SI3RestOctets_template::SI3RestOctets_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; } SI3RestOctets_template::SI3RestOctets_template(const SI3RestOctets_template& other_value) : Base_Template() { copy_template(other_value); } SI3RestOctets_template::~SI3RestOctets_template() { clean_up(); } SI3RestOctets_template& SI3RestOctets_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } SI3RestOctets_template& SI3RestOctets_template::operator=(const SI3RestOctets& other_value) { clean_up(); copy_value(other_value); return *this; } SI3RestOctets_template& SI3RestOctets_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI3RestOctets&)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.SI3RestOctets."); } return *this; } SI3RestOctets_template& SI3RestOctets_template::operator=(const SI3RestOctets_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean SI3RestOctets_template::match(const SI3RestOctets& 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.sel__params().is_bound()) return FALSE; if(!single_value->field_sel__params.match(other_value.sel__params(), legacy))return FALSE; if(!other_value.pwr__offset().is_bound()) return FALSE; if(!single_value->field_pwr__offset.match(other_value.pwr__offset(), legacy))return FALSE; if(!other_value.si__2ter__ind().is_bound()) return FALSE; if(!single_value->field_si__2ter__ind.match(other_value.si__2ter__ind(), legacy))return FALSE; if(!other_value.early__cm__ind().is_bound()) return FALSE; if(!single_value->field_early__cm__ind.match(other_value.early__cm__ind(), legacy))return FALSE; if(!other_value.sched__where().is_bound()) return FALSE; if(!single_value->field_sched__where.match(other_value.sched__where(), legacy))return FALSE; if(!other_value.gprs__ind().is_bound()) return FALSE; if(!single_value->field_gprs__ind.match(other_value.gprs__ind(), legacy))return FALSE; if(!other_value.umts__early__cm__ind().is_bound()) return FALSE; if(!single_value->field_umts__early__cm__ind.match(other_value.umts__early__cm__ind(), legacy))return FALSE; if(!other_value.si2__quater__ind().is_bound()) return FALSE; if(!single_value->field_si2__quater__ind.match(other_value.si2__quater__ind(), legacy))return FALSE; if(!other_value.iu__mode__ind().is_bound()) return FALSE; if((other_value.iu__mode__ind().ispresent() ? !single_value->field_iu__mode__ind.match((const BITSTRING&)other_value.iu__mode__ind(), legacy) : !single_value->field_iu__mode__ind.match_omit(legacy)))return FALSE; if(!other_value.si21__ind().is_bound()) return FALSE; if((other_value.si21__ind().ispresent() ? !single_value->field_si21__ind.match((const SI21IndicatorOpt&)other_value.si21__ind(), legacy) : !single_value->field_si21__ind.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.SI3RestOctets."); } return FALSE; } boolean SI3RestOctets_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_sel__params.is_bound() || single_value->field_pwr__offset.is_bound() || single_value->field_si__2ter__ind.is_bound() || single_value->field_early__cm__ind.is_bound() || single_value->field_sched__where.is_bound() || single_value->field_gprs__ind.is_bound() || single_value->field_umts__early__cm__ind.is_bound() || single_value->field_si2__quater__ind.is_bound() || (single_value->field_iu__mode__ind.is_omit() || single_value->field_iu__mode__ind.is_bound()) || (single_value->field_si21__ind.is_omit() || single_value->field_si21__ind.is_bound()); } boolean SI3RestOctets_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_sel__params.is_value() && single_value->field_pwr__offset.is_value() && single_value->field_si__2ter__ind.is_value() && single_value->field_early__cm__ind.is_value() && single_value->field_sched__where.is_value() && single_value->field_gprs__ind.is_value() && single_value->field_umts__early__cm__ind.is_value() && single_value->field_si2__quater__ind.is_value() && (single_value->field_iu__mode__ind.is_omit() || single_value->field_iu__mode__ind.is_value()) && (single_value->field_si21__ind.is_omit() || single_value->field_si21__ind.is_value()); } void SI3RestOctets_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; } SI3RestOctets SI3RestOctets_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.SI3RestOctets."); SI3RestOctets ret_val; if (single_value->field_sel__params.is_bound()) { ret_val.sel__params() = single_value->field_sel__params.valueof(); } if (single_value->field_pwr__offset.is_bound()) { ret_val.pwr__offset() = single_value->field_pwr__offset.valueof(); } if (single_value->field_si__2ter__ind.is_bound()) { ret_val.si__2ter__ind() = single_value->field_si__2ter__ind.valueof(); } if (single_value->field_early__cm__ind.is_bound()) { ret_val.early__cm__ind() = single_value->field_early__cm__ind.valueof(); } if (single_value->field_sched__where.is_bound()) { ret_val.sched__where() = single_value->field_sched__where.valueof(); } if (single_value->field_gprs__ind.is_bound()) { ret_val.gprs__ind() = single_value->field_gprs__ind.valueof(); } if (single_value->field_umts__early__cm__ind.is_bound()) { ret_val.umts__early__cm__ind() = single_value->field_umts__early__cm__ind.valueof(); } if (single_value->field_si2__quater__ind.is_bound()) { ret_val.si2__quater__ind() = single_value->field_si2__quater__ind.valueof(); } if (single_value->field_iu__mode__ind.is_omit()) ret_val.iu__mode__ind() = OMIT_VALUE; else if (single_value->field_iu__mode__ind.is_bound()) { ret_val.iu__mode__ind() = single_value->field_iu__mode__ind.valueof(); } if (single_value->field_si21__ind.is_omit()) ret_val.si21__ind() = OMIT_VALUE; else if (single_value->field_si21__ind.is_bound()) { ret_val.si21__ind() = single_value->field_si21__ind.valueof(); } return ret_val; } void SI3RestOctets_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.SI3RestOctets."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new SI3RestOctets_template[list_length]; } SI3RestOctets_template& SI3RestOctets_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.SI3RestOctets."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.SI3RestOctets."); return value_list.list_value[list_index]; } SelectionParamsOpt_template& SI3RestOctets_template::sel__params() { set_specific(); return single_value->field_sel__params; } const SelectionParamsOpt_template& SI3RestOctets_template::sel__params() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field sel_params of a non-specific template of type @GSM_RestOctets.SI3RestOctets."); return single_value->field_sel__params; } PowerOffsetOpt_template& SI3RestOctets_template::pwr__offset() { set_specific(); return single_value->field_pwr__offset; } const PowerOffsetOpt_template& SI3RestOctets_template::pwr__offset() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field pwr_offset of a non-specific template of type @GSM_RestOctets.SI3RestOctets."); return single_value->field_pwr__offset; } BITSTRING_template& SI3RestOctets_template::si__2ter__ind() { set_specific(); return single_value->field_si__2ter__ind; } const BITSTRING_template& SI3RestOctets_template::si__2ter__ind() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field si_2ter_ind of a non-specific template of type @GSM_RestOctets.SI3RestOctets."); return single_value->field_si__2ter__ind; } BITSTRING_template& SI3RestOctets_template::early__cm__ind() { set_specific(); return single_value->field_early__cm__ind; } const BITSTRING_template& SI3RestOctets_template::early__cm__ind() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field early_cm_ind of a non-specific template of type @GSM_RestOctets.SI3RestOctets."); return single_value->field_early__cm__ind; } SchedIfAndWhere_template& SI3RestOctets_template::sched__where() { set_specific(); return single_value->field_sched__where; } const SchedIfAndWhere_template& SI3RestOctets_template::sched__where() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field sched_where of a non-specific template of type @GSM_RestOctets.SI3RestOctets."); return single_value->field_sched__where; } GPRSIndicatorOpt_template& SI3RestOctets_template::gprs__ind() { set_specific(); return single_value->field_gprs__ind; } const GPRSIndicatorOpt_template& SI3RestOctets_template::gprs__ind() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field gprs_ind of a non-specific template of type @GSM_RestOctets.SI3RestOctets."); return single_value->field_gprs__ind; } BITSTRING_template& SI3RestOctets_template::umts__early__cm__ind() { set_specific(); return single_value->field_umts__early__cm__ind; } const BITSTRING_template& SI3RestOctets_template::umts__early__cm__ind() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field umts_early_cm_ind of a non-specific template of type @GSM_RestOctets.SI3RestOctets."); return single_value->field_umts__early__cm__ind; } SI2quaterIndicatorOpt_template& SI3RestOctets_template::si2__quater__ind() { set_specific(); return single_value->field_si2__quater__ind; } const SI2quaterIndicatorOpt_template& SI3RestOctets_template::si2__quater__ind() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field si2_quater_ind of a non-specific template of type @GSM_RestOctets.SI3RestOctets."); return single_value->field_si2__quater__ind; } BITSTRING_template& SI3RestOctets_template::iu__mode__ind() { set_specific(); return single_value->field_iu__mode__ind; } const BITSTRING_template& SI3RestOctets_template::iu__mode__ind() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field iu_mode_ind of a non-specific template of type @GSM_RestOctets.SI3RestOctets."); return single_value->field_iu__mode__ind; } SI21IndicatorOpt_template& SI3RestOctets_template::si21__ind() { set_specific(); return single_value->field_si21__ind; } const SI21IndicatorOpt_template& SI3RestOctets_template::si21__ind() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field si21_ind of a non-specific template of type @GSM_RestOctets.SI3RestOctets."); return single_value->field_si21__ind; } int SI3RestOctets_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI3RestOctets which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 8; if (single_value->field_iu__mode__ind.is_present()) ret_val++; if (single_value->field_si21__ind.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.SI3RestOctets 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.SI3RestOctets 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.SI3RestOctets containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI3RestOctets containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI3RestOctets containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI3RestOctets containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI3RestOctets containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI3RestOctets containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.SI3RestOctets."); } return 0; } void SI3RestOctets_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ sel_params := "); single_value->field_sel__params.log(); TTCN_Logger::log_event_str(", pwr_offset := "); single_value->field_pwr__offset.log(); TTCN_Logger::log_event_str(", si_2ter_ind := "); single_value->field_si__2ter__ind.log(); TTCN_Logger::log_event_str(", early_cm_ind := "); single_value->field_early__cm__ind.log(); TTCN_Logger::log_event_str(", sched_where := "); single_value->field_sched__where.log(); TTCN_Logger::log_event_str(", gprs_ind := "); single_value->field_gprs__ind.log(); TTCN_Logger::log_event_str(", umts_early_cm_ind := "); single_value->field_umts__early__cm__ind.log(); TTCN_Logger::log_event_str(", si2_quater_ind := "); single_value->field_si2__quater__ind.log(); TTCN_Logger::log_event_str(", iu_mode_ind := "); single_value->field_iu__mode__ind.log(); TTCN_Logger::log_event_str(", si21_ind := "); single_value->field_si21__ind.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 SI3RestOctets_template::log_match(const SI3RestOctets& 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_sel__params.match(match_value.sel__params(), legacy)){ TTCN_Logger::log_logmatch_info(".sel_params"); single_value->field_sel__params.log_match(match_value.sel__params(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_pwr__offset.match(match_value.pwr__offset(), legacy)){ TTCN_Logger::log_logmatch_info(".pwr_offset"); single_value->field_pwr__offset.log_match(match_value.pwr__offset(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_si__2ter__ind.match(match_value.si__2ter__ind(), legacy)){ TTCN_Logger::log_logmatch_info(".si_2ter_ind"); single_value->field_si__2ter__ind.log_match(match_value.si__2ter__ind(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_early__cm__ind.match(match_value.early__cm__ind(), legacy)){ TTCN_Logger::log_logmatch_info(".early_cm_ind"); single_value->field_early__cm__ind.log_match(match_value.early__cm__ind(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_sched__where.match(match_value.sched__where(), legacy)){ TTCN_Logger::log_logmatch_info(".sched_where"); single_value->field_sched__where.log_match(match_value.sched__where(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_gprs__ind.match(match_value.gprs__ind(), legacy)){ TTCN_Logger::log_logmatch_info(".gprs_ind"); single_value->field_gprs__ind.log_match(match_value.gprs__ind(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_umts__early__cm__ind.match(match_value.umts__early__cm__ind(), legacy)){ TTCN_Logger::log_logmatch_info(".umts_early_cm_ind"); single_value->field_umts__early__cm__ind.log_match(match_value.umts__early__cm__ind(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_si2__quater__ind.match(match_value.si2__quater__ind(), legacy)){ TTCN_Logger::log_logmatch_info(".si2_quater_ind"); single_value->field_si2__quater__ind.log_match(match_value.si2__quater__ind(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.iu__mode__ind().ispresent()){ if(!single_value->field_iu__mode__ind.match(match_value.iu__mode__ind(), legacy)){ TTCN_Logger::log_logmatch_info(".iu_mode_ind"); single_value->field_iu__mode__ind.log_match(match_value.iu__mode__ind(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_iu__mode__ind.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".iu_mode_ind := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_iu__mode__ind.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if (match_value.si21__ind().ispresent()){ if(!single_value->field_si21__ind.match(match_value.si21__ind(), legacy)){ TTCN_Logger::log_logmatch_info(".si21_ind"); single_value->field_si21__ind.log_match(match_value.si21__ind(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_si21__ind.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".si21_ind := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_si21__ind.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("{ sel_params := "); single_value->field_sel__params.log_match(match_value.sel__params(), legacy); TTCN_Logger::log_event_str(", pwr_offset := "); single_value->field_pwr__offset.log_match(match_value.pwr__offset(), legacy); TTCN_Logger::log_event_str(", si_2ter_ind := "); single_value->field_si__2ter__ind.log_match(match_value.si__2ter__ind(), legacy); TTCN_Logger::log_event_str(", early_cm_ind := "); single_value->field_early__cm__ind.log_match(match_value.early__cm__ind(), legacy); TTCN_Logger::log_event_str(", sched_where := "); single_value->field_sched__where.log_match(match_value.sched__where(), legacy); TTCN_Logger::log_event_str(", gprs_ind := "); single_value->field_gprs__ind.log_match(match_value.gprs__ind(), legacy); TTCN_Logger::log_event_str(", umts_early_cm_ind := "); single_value->field_umts__early__cm__ind.log_match(match_value.umts__early__cm__ind(), legacy); TTCN_Logger::log_event_str(", si2_quater_ind := "); single_value->field_si2__quater__ind.log_match(match_value.si2__quater__ind(), legacy); TTCN_Logger::log_event_str(", iu_mode_ind := "); if (match_value.iu__mode__ind().ispresent()) { single_value->field_iu__mode__ind.log_match(match_value.iu__mode__ind(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_iu__mode__ind.log(); if (single_value->field_iu__mode__ind.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", si21_ind := "); if (match_value.si21__ind().ispresent()) { single_value->field_si21__ind.log_match(match_value.si21__ind(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_si21__ind.log(); if (single_value->field_si21__ind.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 SI3RestOctets_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (sel__params().is_bound()) sel__params().set_implicit_omit(); if (pwr__offset().is_bound()) pwr__offset().set_implicit_omit(); if (si__2ter__ind().is_bound()) si__2ter__ind().set_implicit_omit(); if (early__cm__ind().is_bound()) early__cm__ind().set_implicit_omit(); if (sched__where().is_bound()) sched__where().set_implicit_omit(); if (gprs__ind().is_bound()) gprs__ind().set_implicit_omit(); if (umts__early__cm__ind().is_bound()) umts__early__cm__ind().set_implicit_omit(); if (si2__quater__ind().is_bound()) si2__quater__ind().set_implicit_omit(); if (!iu__mode__ind().is_bound()) iu__mode__ind() = OMIT_VALUE; else iu__mode__ind().set_implicit_omit(); if (!si21__ind().is_bound()) si21__ind() = OMIT_VALUE; else si21__ind().set_implicit_omit(); } void SI3RestOctets_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_sel__params.encode_text(text_buf); single_value->field_pwr__offset.encode_text(text_buf); single_value->field_si__2ter__ind.encode_text(text_buf); single_value->field_early__cm__ind.encode_text(text_buf); single_value->field_sched__where.encode_text(text_buf); single_value->field_gprs__ind.encode_text(text_buf); single_value->field_umts__early__cm__ind.encode_text(text_buf); single_value->field_si2__quater__ind.encode_text(text_buf); single_value->field_iu__mode__ind.encode_text(text_buf); single_value->field_si21__ind.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.SI3RestOctets."); } } void SI3RestOctets_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_sel__params.decode_text(text_buf); single_value->field_pwr__offset.decode_text(text_buf); single_value->field_si__2ter__ind.decode_text(text_buf); single_value->field_early__cm__ind.decode_text(text_buf); single_value->field_sched__where.decode_text(text_buf); single_value->field_gprs__ind.decode_text(text_buf); single_value->field_umts__early__cm__ind.decode_text(text_buf); single_value->field_si2__quater__ind.decode_text(text_buf); single_value->field_iu__mode__ind.decode_text(text_buf); single_value->field_si21__ind.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 SI3RestOctets_template[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.SI3RestOctets."); } } void SI3RestOctets_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: { SI3RestOctets_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) sel__params().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) pwr__offset().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) si__2ter__ind().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) early__cm__ind().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) sched__where().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) gprs__ind().set_param(*param.get_elem(5)); if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) umts__early__cm__ind().set_param(*param.get_elem(6)); if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) si2__quater__ind().set_param(*param.get_elem(7)); if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) iu__mode__ind().set_param(*param.get_elem(8)); if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) si21__ind().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(), "sel_params")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { sel__params().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "pwr_offset")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { pwr__offset().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "si_2ter_ind")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { si__2ter__ind().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "early_cm_ind")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { early__cm__ind().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "sched_where")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { sched__where().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "gprs_ind")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { gprs__ind().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "umts_early_cm_ind")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { umts__early__cm__ind().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "si2_quater_ind")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { si2__quater__ind().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "iu_mode_ind")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { iu__mode__ind().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "si21_ind")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { si21__ind().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.SI3RestOctets: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { SI3RestOctets_template* precondition = new SI3RestOctets_template; precondition->set_param(*param.get_elem(0)); SI3RestOctets_template* implied_template = new SI3RestOctets_template; implied_template->set_param(*param.get_elem(1)); *this = SI3RestOctets_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.SI3RestOctets"); } is_ifpresent = param.get_ifpresent(); } void SI3RestOctets_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_sel__params.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI3RestOctets"); single_value->field_pwr__offset.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI3RestOctets"); single_value->field_si__2ter__ind.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI3RestOctets"); single_value->field_early__cm__ind.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI3RestOctets"); single_value->field_sched__where.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI3RestOctets"); single_value->field_gprs__ind.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI3RestOctets"); single_value->field_umts__early__cm__ind.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI3RestOctets"); single_value->field_si2__quater__ind.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI3RestOctets"); single_value->field_iu__mode__ind.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI3RestOctets"); single_value->field_si21__ind.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI3RestOctets"); 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.SI3RestOctets"); } boolean SI3RestOctets_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean SI3RestOctets_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_pos) : field_presence(par_presence), field_pos(par_pos) { } SI21IndicatorOpt::SI21IndicatorOpt(const SI21IndicatorOpt& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.SI21IndicatorOpt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.pos().is_bound()) field_pos = other_value.pos(); else field_pos.clean_up(); } void SI21IndicatorOpt::clean_up() { field_presence.clean_up(); field_pos.clean_up(); } const TTCN_Typedescriptor_t* SI21IndicatorOpt::get_descriptor() const { return &SI21IndicatorOpt_descr_; } SI21IndicatorOpt& SI21IndicatorOpt::operator=(const SI21IndicatorOpt& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.SI21IndicatorOpt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.pos().is_bound()) field_pos = other_value.pos(); else field_pos.clean_up(); } return *this; } boolean SI21IndicatorOpt::operator==(const SI21IndicatorOpt& other_value) const { return field_presence==other_value.field_presence && field_pos==other_value.field_pos; } boolean SI21IndicatorOpt::is_bound() const { return (field_presence.is_bound()) || (OPTIONAL_OMIT == field_pos.get_selection() || field_pos.is_bound()); } boolean SI21IndicatorOpt::is_value() const { return field_presence.is_value() && (OPTIONAL_OMIT == field_pos.get_selection() || field_pos.is_value()); } int SI21IndicatorOpt::size_of() const { int ret_val = 1; if (field_pos.ispresent()) ret_val++; return ret_val; } void SI21IndicatorOpt::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(", pos := "); field_pos.log(); TTCN_Logger::log_event_str(" }"); } void SI21IndicatorOpt::set_implicit_omit() { if (presence().is_bound()) presence().set_implicit_omit(); if (!pos().is_bound()) pos() = OMIT_VALUE; else pos().set_implicit_omit(); } void SI21IndicatorOpt::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) pos().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(), "pos")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { pos().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.SI21IndicatorOpt: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.SI21IndicatorOpt"); } } void SI21IndicatorOpt::encode_text(Text_Buf& text_buf) const { field_presence.encode_text(text_buf); field_pos.encode_text(text_buf); } void SI21IndicatorOpt::decode_text(Text_Buf& text_buf) { field_presence.decode_text(text_buf); field_pos.decode_text(text_buf); } void SI21IndicatorOpt::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 SI21IndicatorOpt::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 SI21IndicatorOpt::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, SI21IndicatorOpt_presence_descr_.raw->forceomit); decoded_field_length = field_presence.RAW_decode(SI21IndicatorOpt_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_pos = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_1_force_omit(1, force_omit, SI21IndicatorOpt_pos_descr_.raw->forceomit); decoded_field_length = field_pos().RAW_decode(SI21IndicatorOpt_pos_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 1) { field_pos = 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_pos=OMIT_VALUE; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int SI21IndicatorOpt::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, SI21IndicatorOpt_presence_descr_.raw); if (field_pos.ispresent()) { myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, SI21IndicatorOpt_pos_descr_.raw); } else myleaf.body.node.nodes[1] = NULL; encoded_length += field_presence.RAW_encode(SI21IndicatorOpt_presence_descr_, *myleaf.body.node.nodes[0]); if (field_pos.ispresent()) { encoded_length += field_pos().RAW_encode(SI21IndicatorOpt_pos_descr_, *myleaf.body.node.nodes[1]); } if (field_pos.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(SI21IndicatorOpt_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 SI21IndicatorOpt_template::single_value_struct { BITSTRING_template field_presence; BITSTRING_template field_pos; }; void SI21IndicatorOpt_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_pos = ANY_OR_OMIT; } } } void SI21IndicatorOpt_template::copy_value(const SI21IndicatorOpt& 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.pos().is_bound()) { if (other_value.pos().ispresent()) single_value->field_pos = other_value.pos()(); else single_value->field_pos = OMIT_VALUE; } else { single_value->field_pos.clean_up(); } set_selection(SPECIFIC_VALUE); } void SI21IndicatorOpt_template::copy_template(const SI21IndicatorOpt_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.pos().get_selection()) { single_value->field_pos = other_value.pos(); } else { single_value->field_pos.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 SI21IndicatorOpt_template[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 SI21IndicatorOpt_template(*other_value.implication_.precondition); implication_.implied_template = new SI21IndicatorOpt_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.SI21IndicatorOpt."); break; } set_selection(other_value); } SI21IndicatorOpt_template::SI21IndicatorOpt_template() { } SI21IndicatorOpt_template::SI21IndicatorOpt_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } SI21IndicatorOpt_template::SI21IndicatorOpt_template(const SI21IndicatorOpt& other_value) { copy_value(other_value); } SI21IndicatorOpt_template::SI21IndicatorOpt_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI21IndicatorOpt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.SI21IndicatorOpt from an unbound optional field."); } } SI21IndicatorOpt_template::SI21IndicatorOpt_template(SI21IndicatorOpt_template* p_precondition, SI21IndicatorOpt_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } SI21IndicatorOpt_template::SI21IndicatorOpt_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; } SI21IndicatorOpt_template::SI21IndicatorOpt_template(const SI21IndicatorOpt_template& other_value) : Base_Template() { copy_template(other_value); } SI21IndicatorOpt_template::~SI21IndicatorOpt_template() { clean_up(); } SI21IndicatorOpt_template& SI21IndicatorOpt_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } SI21IndicatorOpt_template& SI21IndicatorOpt_template::operator=(const SI21IndicatorOpt& other_value) { clean_up(); copy_value(other_value); return *this; } SI21IndicatorOpt_template& SI21IndicatorOpt_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI21IndicatorOpt&)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.SI21IndicatorOpt."); } return *this; } SI21IndicatorOpt_template& SI21IndicatorOpt_template::operator=(const SI21IndicatorOpt_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean SI21IndicatorOpt_template::match(const SI21IndicatorOpt& 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.pos().is_bound()) return FALSE; if((other_value.pos().ispresent() ? !single_value->field_pos.match((const BITSTRING&)other_value.pos(), legacy) : !single_value->field_pos.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.SI21IndicatorOpt."); } return FALSE; } boolean SI21IndicatorOpt_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_pos.is_omit() || single_value->field_pos.is_bound()); } boolean SI21IndicatorOpt_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_presence.is_value() && (single_value->field_pos.is_omit() || single_value->field_pos.is_value()); } void SI21IndicatorOpt_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; } SI21IndicatorOpt SI21IndicatorOpt_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.SI21IndicatorOpt."); SI21IndicatorOpt ret_val; if (single_value->field_presence.is_bound()) { ret_val.presence() = single_value->field_presence.valueof(); } if (single_value->field_pos.is_omit()) ret_val.pos() = OMIT_VALUE; else if (single_value->field_pos.is_bound()) { ret_val.pos() = single_value->field_pos.valueof(); } return ret_val; } void SI21IndicatorOpt_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.SI21IndicatorOpt."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new SI21IndicatorOpt_template[list_length]; } SI21IndicatorOpt_template& SI21IndicatorOpt_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.SI21IndicatorOpt."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.SI21IndicatorOpt."); return value_list.list_value[list_index]; } BITSTRING_template& SI21IndicatorOpt_template::presence() { set_specific(); return single_value->field_presence; } const BITSTRING_template& SI21IndicatorOpt_template::presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field presence of a non-specific template of type @GSM_RestOctets.SI21IndicatorOpt."); return single_value->field_presence; } BITSTRING_template& SI21IndicatorOpt_template::pos() { set_specific(); return single_value->field_pos; } const BITSTRING_template& SI21IndicatorOpt_template::pos() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field pos of a non-specific template of type @GSM_RestOctets.SI21IndicatorOpt."); return single_value->field_pos; } int SI21IndicatorOpt_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI21IndicatorOpt which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 1; if (single_value->field_pos.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.SI21IndicatorOpt 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.SI21IndicatorOpt 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.SI21IndicatorOpt containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI21IndicatorOpt containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI21IndicatorOpt containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI21IndicatorOpt containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI21IndicatorOpt containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI21IndicatorOpt containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.SI21IndicatorOpt."); } return 0; } void SI21IndicatorOpt_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(", pos := "); single_value->field_pos.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 SI21IndicatorOpt_template::log_match(const SI21IndicatorOpt& 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.pos().ispresent()){ if(!single_value->field_pos.match(match_value.pos(), legacy)){ TTCN_Logger::log_logmatch_info(".pos"); single_value->field_pos.log_match(match_value.pos(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_pos.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".pos := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_pos.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(", pos := "); if (match_value.pos().ispresent()) { single_value->field_pos.log_match(match_value.pos(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_pos.log(); if (single_value->field_pos.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 SI21IndicatorOpt_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (presence().is_bound()) presence().set_implicit_omit(); if (!pos().is_bound()) pos() = OMIT_VALUE; else pos().set_implicit_omit(); } void SI21IndicatorOpt_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_pos.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.SI21IndicatorOpt."); } } void SI21IndicatorOpt_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_pos.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 SI21IndicatorOpt_template[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.SI21IndicatorOpt."); } } void SI21IndicatorOpt_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: { SI21IndicatorOpt_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) pos().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(), "pos")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { pos().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.SI21IndicatorOpt: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { SI21IndicatorOpt_template* precondition = new SI21IndicatorOpt_template; precondition->set_param(*param.get_elem(0)); SI21IndicatorOpt_template* implied_template = new SI21IndicatorOpt_template; implied_template->set_param(*param.get_elem(1)); *this = SI21IndicatorOpt_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.SI21IndicatorOpt"); } is_ifpresent = param.get_ifpresent(); } void SI21IndicatorOpt_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.SI21IndicatorOpt"); single_value->field_pos.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI21IndicatorOpt"); 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.SI21IndicatorOpt"); } boolean SI21IndicatorOpt_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean SI21IndicatorOpt_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_s) : field_sel__params(par_sel__params), field_pwr__offset(par_pwr__offset), field_gprs__ind(par_gprs__ind), field_s__presence(par_s__presence), field_s(par_s) { } SI4RestOctets::SI4RestOctets(const SI4RestOctets& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.SI4RestOctets."); if (other_value.sel__params().is_bound()) field_sel__params = other_value.sel__params(); else field_sel__params.clean_up(); if (other_value.pwr__offset().is_bound()) field_pwr__offset = other_value.pwr__offset(); else field_pwr__offset.clean_up(); if (other_value.gprs__ind().is_bound()) field_gprs__ind = other_value.gprs__ind(); else field_gprs__ind.clean_up(); if (other_value.s__presence().is_bound()) field_s__presence = other_value.s__presence(); else field_s__presence.clean_up(); if (other_value.s().is_bound()) field_s = other_value.s(); else field_s.clean_up(); } void SI4RestOctets::clean_up() { field_sel__params.clean_up(); field_pwr__offset.clean_up(); field_gprs__ind.clean_up(); field_s__presence.clean_up(); field_s.clean_up(); } const TTCN_Typedescriptor_t* SI4RestOctets::get_descriptor() const { return &SI4RestOctets_descr_; } SI4RestOctets& SI4RestOctets::operator=(const SI4RestOctets& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.SI4RestOctets."); if (other_value.sel__params().is_bound()) field_sel__params = other_value.sel__params(); else field_sel__params.clean_up(); if (other_value.pwr__offset().is_bound()) field_pwr__offset = other_value.pwr__offset(); else field_pwr__offset.clean_up(); if (other_value.gprs__ind().is_bound()) field_gprs__ind = other_value.gprs__ind(); else field_gprs__ind.clean_up(); if (other_value.s__presence().is_bound()) field_s__presence = other_value.s__presence(); else field_s__presence.clean_up(); if (other_value.s().is_bound()) field_s = other_value.s(); else field_s.clean_up(); } return *this; } boolean SI4RestOctets::operator==(const SI4RestOctets& other_value) const { return field_sel__params==other_value.field_sel__params && field_pwr__offset==other_value.field_pwr__offset && field_gprs__ind==other_value.field_gprs__ind && field_s__presence==other_value.field_s__presence && field_s==other_value.field_s; } boolean SI4RestOctets::is_bound() const { return (field_sel__params.is_bound()) || (field_pwr__offset.is_bound()) || (field_gprs__ind.is_bound()) || (field_s__presence.is_bound()) || (OPTIONAL_OMIT == field_s.get_selection() || field_s.is_bound()); } boolean SI4RestOctets::is_value() const { return field_sel__params.is_value() && field_pwr__offset.is_value() && field_gprs__ind.is_value() && field_s__presence.is_value() && (OPTIONAL_OMIT == field_s.get_selection() || field_s.is_value()); } int SI4RestOctets::size_of() const { int ret_val = 4; if (field_s.ispresent()) ret_val++; return ret_val; } void SI4RestOctets::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ sel_params := "); field_sel__params.log(); TTCN_Logger::log_event_str(", pwr_offset := "); field_pwr__offset.log(); TTCN_Logger::log_event_str(", gprs_ind := "); field_gprs__ind.log(); TTCN_Logger::log_event_str(", s_presence := "); field_s__presence.log(); TTCN_Logger::log_event_str(", s := "); field_s.log(); TTCN_Logger::log_event_str(" }"); } void SI4RestOctets::set_implicit_omit() { if (sel__params().is_bound()) sel__params().set_implicit_omit(); if (pwr__offset().is_bound()) pwr__offset().set_implicit_omit(); if (gprs__ind().is_bound()) gprs__ind().set_implicit_omit(); if (s__presence().is_bound()) s__presence().set_implicit_omit(); if (!s().is_bound()) s() = OMIT_VALUE; else s().set_implicit_omit(); } void SI4RestOctets::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "record value"); switch (param.get_type()) { case Module_Param::MP_Value_List: if (50 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) sel__params().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) pwr__offset().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) gprs__ind().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) s__presence().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) s().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(), "sel_params")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { sel__params().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "pwr_offset")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { pwr__offset().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "gprs_ind")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { gprs__ind().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "s_presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { s__presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "s")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { s().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.SI4RestOctets: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.SI4RestOctets"); } } void SI4RestOctets::encode_text(Text_Buf& text_buf) const { field_sel__params.encode_text(text_buf); field_pwr__offset.encode_text(text_buf); field_gprs__ind.encode_text(text_buf); field_s__presence.encode_text(text_buf); field_s.encode_text(text_buf); } void SI4RestOctets::decode_text(Text_Buf& text_buf) { field_sel__params.decode_text(text_buf); field_pwr__offset.decode_text(text_buf); field_gprs__ind.decode_text(text_buf); field_s__presence.decode_text(text_buf); field_s.decode_text(text_buf); } void SI4RestOctets::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 SI4RestOctets::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 SI4RestOctets::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, SI4RestOctets_sel__params_descr_.raw->forceomit); decoded_field_length = field_sel__params.RAW_decode(SI4RestOctets_sel__params_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, SI4RestOctets_pwr__offset_descr_.raw->forceomit); decoded_field_length = field_pwr__offset.RAW_decode(SI4RestOctets_pwr__offset_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, SI4RestOctets_gprs__ind_descr_.raw->forceomit); decoded_field_length = field_gprs__ind.RAW_decode(SI4RestOctets_gprs__ind_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, SI4RestOctets_s__presence_descr_.raw->forceomit); decoded_field_length = field_s__presence.RAW_decode(SI4RestOctets_s__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_s__presence == bs_0){ if (force_omit != NULL && (*force_omit)(4)) { field_s = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_4_force_omit(4, force_omit, SI4RestOctets_s_descr_.raw->forceomit); decoded_field_length = field_s().RAW_decode(SI4RestOctets_s_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_4_force_omit); if (decoded_field_length < 1) { field_s = 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_s=OMIT_VALUE; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int SI4RestOctets::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, SI4RestOctets_sel__params_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, SI4RestOctets_pwr__offset_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, SI4RestOctets_gprs__ind_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, SI4RestOctets_s__presence_descr_.raw); if (field_s.ispresent()) { myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, SI4RestOctets_s_descr_.raw); } else myleaf.body.node.nodes[4] = NULL; encoded_length += field_sel__params.RAW_encode(SI4RestOctets_sel__params_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_pwr__offset.RAW_encode(SI4RestOctets_pwr__offset_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_gprs__ind.RAW_encode(SI4RestOctets_gprs__ind_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_s__presence.RAW_encode(SI4RestOctets_s__presence_descr_, *myleaf.body.node.nodes[3]); if (field_s.ispresent()) { encoded_length += field_s().RAW_encode(SI4RestOctets_s_descr_, *myleaf.body.node.nodes[4]); } if (field_s.ispresent() && (field_s__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(SI4RestOctets_s__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 SI4RestOctets_template::single_value_struct { SelectionParamsOpt_template field_sel__params; PowerOffsetOpt_template field_pwr__offset; GPRSIndicatorOpt_template field_gprs__ind; BITSTRING_template field_s__presence; BITSTRING_template field_s; }; void SI4RestOctets_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_sel__params = ANY_VALUE; single_value->field_pwr__offset = ANY_VALUE; single_value->field_gprs__ind = ANY_VALUE; single_value->field_s__presence = ANY_VALUE; single_value->field_s = ANY_OR_OMIT; } } } void SI4RestOctets_template::copy_value(const SI4RestOctets& other_value) { single_value = new single_value_struct; if (other_value.sel__params().is_bound()) { single_value->field_sel__params = other_value.sel__params(); } else { single_value->field_sel__params.clean_up(); } if (other_value.pwr__offset().is_bound()) { single_value->field_pwr__offset = other_value.pwr__offset(); } else { single_value->field_pwr__offset.clean_up(); } if (other_value.gprs__ind().is_bound()) { single_value->field_gprs__ind = other_value.gprs__ind(); } else { single_value->field_gprs__ind.clean_up(); } if (other_value.s__presence().is_bound()) { single_value->field_s__presence = other_value.s__presence(); } else { single_value->field_s__presence.clean_up(); } if (other_value.s().is_bound()) { if (other_value.s().ispresent()) single_value->field_s = other_value.s()(); else single_value->field_s = OMIT_VALUE; } else { single_value->field_s.clean_up(); } set_selection(SPECIFIC_VALUE); } void SI4RestOctets_template::copy_template(const SI4RestOctets_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.sel__params().get_selection()) { single_value->field_sel__params = other_value.sel__params(); } else { single_value->field_sel__params.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.pwr__offset().get_selection()) { single_value->field_pwr__offset = other_value.pwr__offset(); } else { single_value->field_pwr__offset.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.gprs__ind().get_selection()) { single_value->field_gprs__ind = other_value.gprs__ind(); } else { single_value->field_gprs__ind.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.s__presence().get_selection()) { single_value->field_s__presence = other_value.s__presence(); } else { single_value->field_s__presence.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.s().get_selection()) { single_value->field_s = other_value.s(); } else { single_value->field_s.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 SI4RestOctets_template[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 SI4RestOctets_template(*other_value.implication_.precondition); implication_.implied_template = new SI4RestOctets_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.SI4RestOctets."); break; } set_selection(other_value); } SI4RestOctets_template::SI4RestOctets_template() { } SI4RestOctets_template::SI4RestOctets_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } SI4RestOctets_template::SI4RestOctets_template(const SI4RestOctets& other_value) { copy_value(other_value); } SI4RestOctets_template::SI4RestOctets_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI4RestOctets&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.SI4RestOctets from an unbound optional field."); } } SI4RestOctets_template::SI4RestOctets_template(SI4RestOctets_template* p_precondition, SI4RestOctets_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } SI4RestOctets_template::SI4RestOctets_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; } SI4RestOctets_template::SI4RestOctets_template(const SI4RestOctets_template& other_value) : Base_Template() { copy_template(other_value); } SI4RestOctets_template::~SI4RestOctets_template() { clean_up(); } SI4RestOctets_template& SI4RestOctets_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } SI4RestOctets_template& SI4RestOctets_template::operator=(const SI4RestOctets& other_value) { clean_up(); copy_value(other_value); return *this; } SI4RestOctets_template& SI4RestOctets_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI4RestOctets&)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.SI4RestOctets."); } return *this; } SI4RestOctets_template& SI4RestOctets_template::operator=(const SI4RestOctets_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean SI4RestOctets_template::match(const SI4RestOctets& 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.sel__params().is_bound()) return FALSE; if(!single_value->field_sel__params.match(other_value.sel__params(), legacy))return FALSE; if(!other_value.pwr__offset().is_bound()) return FALSE; if(!single_value->field_pwr__offset.match(other_value.pwr__offset(), legacy))return FALSE; if(!other_value.gprs__ind().is_bound()) return FALSE; if(!single_value->field_gprs__ind.match(other_value.gprs__ind(), legacy))return FALSE; if(!other_value.s__presence().is_bound()) return FALSE; if(!single_value->field_s__presence.match(other_value.s__presence(), legacy))return FALSE; if(!other_value.s().is_bound()) return FALSE; if((other_value.s().ispresent() ? !single_value->field_s.match((const BITSTRING&)other_value.s(), legacy) : !single_value->field_s.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.SI4RestOctets."); } return FALSE; } boolean SI4RestOctets_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_sel__params.is_bound() || single_value->field_pwr__offset.is_bound() || single_value->field_gprs__ind.is_bound() || single_value->field_s__presence.is_bound() || (single_value->field_s.is_omit() || single_value->field_s.is_bound()); } boolean SI4RestOctets_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_sel__params.is_value() && single_value->field_pwr__offset.is_value() && single_value->field_gprs__ind.is_value() && single_value->field_s__presence.is_value() && (single_value->field_s.is_omit() || single_value->field_s.is_value()); } void SI4RestOctets_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; } SI4RestOctets SI4RestOctets_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.SI4RestOctets."); SI4RestOctets ret_val; if (single_value->field_sel__params.is_bound()) { ret_val.sel__params() = single_value->field_sel__params.valueof(); } if (single_value->field_pwr__offset.is_bound()) { ret_val.pwr__offset() = single_value->field_pwr__offset.valueof(); } if (single_value->field_gprs__ind.is_bound()) { ret_val.gprs__ind() = single_value->field_gprs__ind.valueof(); } if (single_value->field_s__presence.is_bound()) { ret_val.s__presence() = single_value->field_s__presence.valueof(); } if (single_value->field_s.is_omit()) ret_val.s() = OMIT_VALUE; else if (single_value->field_s.is_bound()) { ret_val.s() = single_value->field_s.valueof(); } return ret_val; } void SI4RestOctets_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.SI4RestOctets."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new SI4RestOctets_template[list_length]; } SI4RestOctets_template& SI4RestOctets_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.SI4RestOctets."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.SI4RestOctets."); return value_list.list_value[list_index]; } SelectionParamsOpt_template& SI4RestOctets_template::sel__params() { set_specific(); return single_value->field_sel__params; } const SelectionParamsOpt_template& SI4RestOctets_template::sel__params() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field sel_params of a non-specific template of type @GSM_RestOctets.SI4RestOctets."); return single_value->field_sel__params; } PowerOffsetOpt_template& SI4RestOctets_template::pwr__offset() { set_specific(); return single_value->field_pwr__offset; } const PowerOffsetOpt_template& SI4RestOctets_template::pwr__offset() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field pwr_offset of a non-specific template of type @GSM_RestOctets.SI4RestOctets."); return single_value->field_pwr__offset; } GPRSIndicatorOpt_template& SI4RestOctets_template::gprs__ind() { set_specific(); return single_value->field_gprs__ind; } const GPRSIndicatorOpt_template& SI4RestOctets_template::gprs__ind() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field gprs_ind of a non-specific template of type @GSM_RestOctets.SI4RestOctets."); return single_value->field_gprs__ind; } BITSTRING_template& SI4RestOctets_template::s__presence() { set_specific(); return single_value->field_s__presence; } const BITSTRING_template& SI4RestOctets_template::s__presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field s_presence of a non-specific template of type @GSM_RestOctets.SI4RestOctets."); return single_value->field_s__presence; } BITSTRING_template& SI4RestOctets_template::s() { set_specific(); return single_value->field_s; } const BITSTRING_template& SI4RestOctets_template::s() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field s of a non-specific template of type @GSM_RestOctets.SI4RestOctets."); return single_value->field_s; } int SI4RestOctets_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI4RestOctets which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 4; if (single_value->field_s.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.SI4RestOctets 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.SI4RestOctets 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.SI4RestOctets containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI4RestOctets containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI4RestOctets containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI4RestOctets containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI4RestOctets containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI4RestOctets containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.SI4RestOctets."); } return 0; } void SI4RestOctets_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ sel_params := "); single_value->field_sel__params.log(); TTCN_Logger::log_event_str(", pwr_offset := "); single_value->field_pwr__offset.log(); TTCN_Logger::log_event_str(", gprs_ind := "); single_value->field_gprs__ind.log(); TTCN_Logger::log_event_str(", s_presence := "); single_value->field_s__presence.log(); TTCN_Logger::log_event_str(", s := "); single_value->field_s.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 SI4RestOctets_template::log_match(const SI4RestOctets& 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_sel__params.match(match_value.sel__params(), legacy)){ TTCN_Logger::log_logmatch_info(".sel_params"); single_value->field_sel__params.log_match(match_value.sel__params(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_pwr__offset.match(match_value.pwr__offset(), legacy)){ TTCN_Logger::log_logmatch_info(".pwr_offset"); single_value->field_pwr__offset.log_match(match_value.pwr__offset(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_gprs__ind.match(match_value.gprs__ind(), legacy)){ TTCN_Logger::log_logmatch_info(".gprs_ind"); single_value->field_gprs__ind.log_match(match_value.gprs__ind(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_s__presence.match(match_value.s__presence(), legacy)){ TTCN_Logger::log_logmatch_info(".s_presence"); single_value->field_s__presence.log_match(match_value.s__presence(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.s().ispresent()){ if(!single_value->field_s.match(match_value.s(), legacy)){ TTCN_Logger::log_logmatch_info(".s"); single_value->field_s.log_match(match_value.s(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_s.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".s := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_s.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("{ sel_params := "); single_value->field_sel__params.log_match(match_value.sel__params(), legacy); TTCN_Logger::log_event_str(", pwr_offset := "); single_value->field_pwr__offset.log_match(match_value.pwr__offset(), legacy); TTCN_Logger::log_event_str(", gprs_ind := "); single_value->field_gprs__ind.log_match(match_value.gprs__ind(), legacy); TTCN_Logger::log_event_str(", s_presence := "); single_value->field_s__presence.log_match(match_value.s__presence(), legacy); TTCN_Logger::log_event_str(", s := "); if (match_value.s().ispresent()) { single_value->field_s.log_match(match_value.s(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_s.log(); if (single_value->field_s.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 SI4RestOctets_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (sel__params().is_bound()) sel__params().set_implicit_omit(); if (pwr__offset().is_bound()) pwr__offset().set_implicit_omit(); if (gprs__ind().is_bound()) gprs__ind().set_implicit_omit(); if (s__presence().is_bound()) s__presence().set_implicit_omit(); if (!s().is_bound()) s() = OMIT_VALUE; else s().set_implicit_omit(); } void SI4RestOctets_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_sel__params.encode_text(text_buf); single_value->field_pwr__offset.encode_text(text_buf); single_value->field_gprs__ind.encode_text(text_buf); single_value->field_s__presence.encode_text(text_buf); single_value->field_s.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.SI4RestOctets."); } } void SI4RestOctets_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_sel__params.decode_text(text_buf); single_value->field_pwr__offset.decode_text(text_buf); single_value->field_gprs__ind.decode_text(text_buf); single_value->field_s__presence.decode_text(text_buf); single_value->field_s.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 SI4RestOctets_template[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.SI4RestOctets."); } } void SI4RestOctets_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: { SI4RestOctets_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) sel__params().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) pwr__offset().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) gprs__ind().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) s__presence().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) s().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(), "sel_params")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { sel__params().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "pwr_offset")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { pwr__offset().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "gprs_ind")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { gprs__ind().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "s_presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { s__presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "s")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { s().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.SI4RestOctets: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { SI4RestOctets_template* precondition = new SI4RestOctets_template; precondition->set_param(*param.get_elem(0)); SI4RestOctets_template* implied_template = new SI4RestOctets_template; implied_template->set_param(*param.get_elem(1)); *this = SI4RestOctets_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.SI4RestOctets"); } is_ifpresent = param.get_ifpresent(); } void SI4RestOctets_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_sel__params.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI4RestOctets"); single_value->field_pwr__offset.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI4RestOctets"); single_value->field_gprs__ind.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI4RestOctets"); single_value->field_s__presence.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI4RestOctets"); single_value->field_s.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI4RestOctets"); 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.SI4RestOctets"); } boolean SI4RestOctets_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean SI4RestOctets_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) { } PchAndNchInfoOpt::PchAndNchInfoOpt(const PchAndNchInfoOpt& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.PchAndNchInfoOpt."); 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 PchAndNchInfoOpt::clean_up() { field_presence.clean_up(); field_info.clean_up(); } const TTCN_Typedescriptor_t* PchAndNchInfoOpt::get_descriptor() const { return &PchAndNchInfoOpt_descr_; } PchAndNchInfoOpt& PchAndNchInfoOpt::operator=(const PchAndNchInfoOpt& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.PchAndNchInfoOpt."); 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 PchAndNchInfoOpt::operator==(const PchAndNchInfoOpt& other_value) const { return field_presence==other_value.field_presence && field_info==other_value.field_info; } boolean PchAndNchInfoOpt::is_bound() const { return (field_presence.is_bound()) || (OPTIONAL_OMIT == field_info.get_selection() || field_info.is_bound()); } boolean PchAndNchInfoOpt::is_value() const { return field_presence.is_value() && (OPTIONAL_OMIT == field_info.get_selection() || field_info.is_value()); } int PchAndNchInfoOpt::size_of() const { int ret_val = 1; if (field_info.ispresent()) ret_val++; return ret_val; } void PchAndNchInfoOpt::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 PchAndNchInfoOpt::set_implicit_omit() { if (presence().is_bound()) presence().set_implicit_omit(); if (!info().is_bound()) info() = OMIT_VALUE; else info().set_implicit_omit(); } void PchAndNchInfoOpt::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.PchAndNchInfoOpt: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.PchAndNchInfoOpt"); } } void PchAndNchInfoOpt::encode_text(Text_Buf& text_buf) const { field_presence.encode_text(text_buf); field_info.encode_text(text_buf); } void PchAndNchInfoOpt::decode_text(Text_Buf& text_buf) { field_presence.decode_text(text_buf); field_info.decode_text(text_buf); } void PchAndNchInfoOpt::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 PchAndNchInfoOpt::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 PchAndNchInfoOpt::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, PchAndNchInfoOpt_presence_descr_.raw->forceomit); decoded_field_length = field_presence.RAW_decode(PchAndNchInfoOpt_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, PchAndNchInfoOpt_info_descr_.raw->forceomit); decoded_field_length = field_info().RAW_decode(PchAndNchInfoOpt_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 PchAndNchInfoOpt::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, PchAndNchInfoOpt_presence_descr_.raw); if (field_info.ispresent()) { myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, PchAndNchInfoOpt_info_descr_.raw); } else myleaf.body.node.nodes[1] = NULL; encoded_length += field_presence.RAW_encode(PchAndNchInfoOpt_presence_descr_, *myleaf.body.node.nodes[0]); if (field_info.ispresent()) { encoded_length += field_info().RAW_encode(PchAndNchInfoOpt_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(PchAndNchInfoOpt_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 PchAndNchInfoOpt_template::single_value_struct { BITSTRING_template field_presence; PchAndNchInfo_template field_info; }; void PchAndNchInfoOpt_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 PchAndNchInfoOpt_template::copy_value(const PchAndNchInfoOpt& 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 PchAndNchInfoOpt_template::copy_template(const PchAndNchInfoOpt_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 PchAndNchInfoOpt_template[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 PchAndNchInfoOpt_template(*other_value.implication_.precondition); implication_.implied_template = new PchAndNchInfoOpt_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.PchAndNchInfoOpt."); break; } set_selection(other_value); } PchAndNchInfoOpt_template::PchAndNchInfoOpt_template() { } PchAndNchInfoOpt_template::PchAndNchInfoOpt_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } PchAndNchInfoOpt_template::PchAndNchInfoOpt_template(const PchAndNchInfoOpt& other_value) { copy_value(other_value); } PchAndNchInfoOpt_template::PchAndNchInfoOpt_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PchAndNchInfoOpt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.PchAndNchInfoOpt from an unbound optional field."); } } PchAndNchInfoOpt_template::PchAndNchInfoOpt_template(PchAndNchInfoOpt_template* p_precondition, PchAndNchInfoOpt_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } PchAndNchInfoOpt_template::PchAndNchInfoOpt_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; } PchAndNchInfoOpt_template::PchAndNchInfoOpt_template(const PchAndNchInfoOpt_template& other_value) : Base_Template() { copy_template(other_value); } PchAndNchInfoOpt_template::~PchAndNchInfoOpt_template() { clean_up(); } PchAndNchInfoOpt_template& PchAndNchInfoOpt_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } PchAndNchInfoOpt_template& PchAndNchInfoOpt_template::operator=(const PchAndNchInfoOpt& other_value) { clean_up(); copy_value(other_value); return *this; } PchAndNchInfoOpt_template& PchAndNchInfoOpt_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PchAndNchInfoOpt&)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.PchAndNchInfoOpt."); } return *this; } PchAndNchInfoOpt_template& PchAndNchInfoOpt_template::operator=(const PchAndNchInfoOpt_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean PchAndNchInfoOpt_template::match(const PchAndNchInfoOpt& 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 PchAndNchInfo&)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.PchAndNchInfoOpt."); } return FALSE; } boolean PchAndNchInfoOpt_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 PchAndNchInfoOpt_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 PchAndNchInfoOpt_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; } PchAndNchInfoOpt PchAndNchInfoOpt_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.PchAndNchInfoOpt."); PchAndNchInfoOpt 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 PchAndNchInfoOpt_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.PchAndNchInfoOpt."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new PchAndNchInfoOpt_template[list_length]; } PchAndNchInfoOpt_template& PchAndNchInfoOpt_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.PchAndNchInfoOpt."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.PchAndNchInfoOpt."); return value_list.list_value[list_index]; } BITSTRING_template& PchAndNchInfoOpt_template::presence() { set_specific(); return single_value->field_presence; } const BITSTRING_template& PchAndNchInfoOpt_template::presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field presence of a non-specific template of type @GSM_RestOctets.PchAndNchInfoOpt."); return single_value->field_presence; } PchAndNchInfo_template& PchAndNchInfoOpt_template::info() { set_specific(); return single_value->field_info; } const PchAndNchInfo_template& PchAndNchInfoOpt_template::info() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field info of a non-specific template of type @GSM_RestOctets.PchAndNchInfoOpt."); return single_value->field_info; } int PchAndNchInfoOpt_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.PchAndNchInfoOpt 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.PchAndNchInfoOpt 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.PchAndNchInfoOpt 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.PchAndNchInfoOpt containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.PchAndNchInfoOpt containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.PchAndNchInfoOpt containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.PchAndNchInfoOpt containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.PchAndNchInfoOpt containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.PchAndNchInfoOpt containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.PchAndNchInfoOpt."); } return 0; } void PchAndNchInfoOpt_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 PchAndNchInfoOpt_template::log_match(const PchAndNchInfoOpt& 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 PchAndNchInfoOpt_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 PchAndNchInfoOpt_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.PchAndNchInfoOpt."); } } void PchAndNchInfoOpt_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 PchAndNchInfoOpt_template[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.PchAndNchInfoOpt."); } } void PchAndNchInfoOpt_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: { PchAndNchInfoOpt_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.PchAndNchInfoOpt: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { PchAndNchInfoOpt_template* precondition = new PchAndNchInfoOpt_template; precondition->set_param(*param.get_elem(0)); PchAndNchInfoOpt_template* implied_template = new PchAndNchInfoOpt_template; implied_template->set_param(*param.get_elem(1)); *this = PchAndNchInfoOpt_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.PchAndNchInfoOpt"); } is_ifpresent = param.get_ifpresent(); } void PchAndNchInfoOpt_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.PchAndNchInfoOpt"); single_value->field_info.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.PchAndNchInfoOpt"); 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.PchAndNchInfoOpt"); } boolean PchAndNchInfoOpt_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean PchAndNchInfoOpt_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_call__prio, const BITSTRING& par_nln__status__sacch) : field_pag__chan__restruct(par_pag__chan__restruct), field_nln__sacch(par_nln__sacch), field_call__prio__presence(par_call__prio__presence), field_call__prio(par_call__prio), field_nln__status__sacch(par_nln__status__sacch) { } PchAndNchInfo::PchAndNchInfo(const PchAndNchInfo& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.PchAndNchInfo."); if (other_value.pag__chan__restruct().is_bound()) field_pag__chan__restruct = other_value.pag__chan__restruct(); else field_pag__chan__restruct.clean_up(); if (other_value.nln__sacch().is_bound()) field_nln__sacch = other_value.nln__sacch(); else field_nln__sacch.clean_up(); if (other_value.call__prio__presence().is_bound()) field_call__prio__presence = other_value.call__prio__presence(); else field_call__prio__presence.clean_up(); if (other_value.call__prio().is_bound()) field_call__prio = other_value.call__prio(); else field_call__prio.clean_up(); if (other_value.nln__status__sacch().is_bound()) field_nln__status__sacch = other_value.nln__status__sacch(); else field_nln__status__sacch.clean_up(); } void PchAndNchInfo::clean_up() { field_pag__chan__restruct.clean_up(); field_nln__sacch.clean_up(); field_call__prio__presence.clean_up(); field_call__prio.clean_up(); field_nln__status__sacch.clean_up(); } const TTCN_Typedescriptor_t* PchAndNchInfo::get_descriptor() const { return &PchAndNchInfo_descr_; } PchAndNchInfo& PchAndNchInfo::operator=(const PchAndNchInfo& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.PchAndNchInfo."); if (other_value.pag__chan__restruct().is_bound()) field_pag__chan__restruct = other_value.pag__chan__restruct(); else field_pag__chan__restruct.clean_up(); if (other_value.nln__sacch().is_bound()) field_nln__sacch = other_value.nln__sacch(); else field_nln__sacch.clean_up(); if (other_value.call__prio__presence().is_bound()) field_call__prio__presence = other_value.call__prio__presence(); else field_call__prio__presence.clean_up(); if (other_value.call__prio().is_bound()) field_call__prio = other_value.call__prio(); else field_call__prio.clean_up(); if (other_value.nln__status__sacch().is_bound()) field_nln__status__sacch = other_value.nln__status__sacch(); else field_nln__status__sacch.clean_up(); } return *this; } boolean PchAndNchInfo::operator==(const PchAndNchInfo& other_value) const { return field_pag__chan__restruct==other_value.field_pag__chan__restruct && field_nln__sacch==other_value.field_nln__sacch && field_call__prio__presence==other_value.field_call__prio__presence && field_call__prio==other_value.field_call__prio && field_nln__status__sacch==other_value.field_nln__status__sacch; } boolean PchAndNchInfo::is_bound() const { return (field_pag__chan__restruct.is_bound()) || (field_nln__sacch.is_bound()) || (field_call__prio__presence.is_bound()) || (OPTIONAL_OMIT == field_call__prio.get_selection() || field_call__prio.is_bound()) || (field_nln__status__sacch.is_bound()); } boolean PchAndNchInfo::is_value() const { return field_pag__chan__restruct.is_value() && field_nln__sacch.is_value() && field_call__prio__presence.is_value() && (OPTIONAL_OMIT == field_call__prio.get_selection() || field_call__prio.is_value()) && field_nln__status__sacch.is_value(); } int PchAndNchInfo::size_of() const { int ret_val = 4; if (field_call__prio.ispresent()) ret_val++; return ret_val; } void PchAndNchInfo::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ pag_chan_restruct := "); field_pag__chan__restruct.log(); TTCN_Logger::log_event_str(", nln_sacch := "); field_nln__sacch.log(); TTCN_Logger::log_event_str(", call_prio_presence := "); field_call__prio__presence.log(); TTCN_Logger::log_event_str(", call_prio := "); field_call__prio.log(); TTCN_Logger::log_event_str(", nln_status_sacch := "); field_nln__status__sacch.log(); TTCN_Logger::log_event_str(" }"); } void PchAndNchInfo::set_implicit_omit() { if (pag__chan__restruct().is_bound()) pag__chan__restruct().set_implicit_omit(); if (nln__sacch().is_bound()) nln__sacch().set_implicit_omit(); if (call__prio__presence().is_bound()) call__prio__presence().set_implicit_omit(); if (!call__prio().is_bound()) call__prio() = OMIT_VALUE; else call__prio().set_implicit_omit(); if (nln__status__sacch().is_bound()) nln__status__sacch().set_implicit_omit(); } void PchAndNchInfo::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "record value"); switch (param.get_type()) { case Module_Param::MP_Value_List: if (50 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) pag__chan__restruct().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) nln__sacch().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) call__prio__presence().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) call__prio().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) nln__status__sacch().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(), "pag_chan_restruct")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { pag__chan__restruct().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nln_sacch")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nln__sacch().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "call_prio_presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { call__prio__presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "call_prio")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { call__prio().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nln_status_sacch")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nln__status__sacch().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.PchAndNchInfo: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.PchAndNchInfo"); } } void PchAndNchInfo::encode_text(Text_Buf& text_buf) const { field_pag__chan__restruct.encode_text(text_buf); field_nln__sacch.encode_text(text_buf); field_call__prio__presence.encode_text(text_buf); field_call__prio.encode_text(text_buf); field_nln__status__sacch.encode_text(text_buf); } void PchAndNchInfo::decode_text(Text_Buf& text_buf) { field_pag__chan__restruct.decode_text(text_buf); field_nln__sacch.decode_text(text_buf); field_call__prio__presence.decode_text(text_buf); field_call__prio.decode_text(text_buf); field_nln__status__sacch.decode_text(text_buf); } void PchAndNchInfo::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 PchAndNchInfo::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 PchAndNchInfo::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, PchAndNchInfo_pag__chan__restruct_descr_.raw->forceomit); decoded_field_length = field_pag__chan__restruct.RAW_decode(PchAndNchInfo_pag__chan__restruct_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, PchAndNchInfo_nln__sacch_descr_.raw->forceomit); decoded_field_length = field_nln__sacch.RAW_decode(PchAndNchInfo_nln__sacch_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, PchAndNchInfo_call__prio__presence_descr_.raw->forceomit); decoded_field_length = field_call__prio__presence.RAW_decode(PchAndNchInfo_call__prio__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_call__prio__presence == bs_0){ if (force_omit != NULL && (*force_omit)(3)) { field_call__prio = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_3_force_omit(3, force_omit, PchAndNchInfo_call__prio_descr_.raw->forceomit); decoded_field_length = field_call__prio().RAW_decode(PchAndNchInfo_call__prio_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_3_force_omit); if (decoded_field_length < 1) { field_call__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_call__prio=OMIT_VALUE; RAW_Force_Omit field_4_force_omit(4, force_omit, PchAndNchInfo_nln__status__sacch_descr_.raw->forceomit); decoded_field_length = field_nln__status__sacch.RAW_decode(PchAndNchInfo_nln__status__sacch_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 PchAndNchInfo::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, PchAndNchInfo_pag__chan__restruct_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, PchAndNchInfo_nln__sacch_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, PchAndNchInfo_call__prio__presence_descr_.raw); if (field_call__prio.ispresent()) { myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, PchAndNchInfo_call__prio_descr_.raw); } else myleaf.body.node.nodes[3] = NULL; myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, PchAndNchInfo_nln__status__sacch_descr_.raw); encoded_length += field_pag__chan__restruct.RAW_encode(PchAndNchInfo_pag__chan__restruct_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_nln__sacch.RAW_encode(PchAndNchInfo_nln__sacch_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_call__prio__presence.RAW_encode(PchAndNchInfo_call__prio__presence_descr_, *myleaf.body.node.nodes[2]); if (field_call__prio.ispresent()) { encoded_length += field_call__prio().RAW_encode(PchAndNchInfo_call__prio_descr_, *myleaf.body.node.nodes[3]); } encoded_length += field_nln__status__sacch.RAW_encode(PchAndNchInfo_nln__status__sacch_descr_, *myleaf.body.node.nodes[4]); if (field_call__prio.ispresent() && (field_call__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[]={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(PchAndNchInfo_call__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); } } return myleaf.length = encoded_length; } struct PchAndNchInfo_template::single_value_struct { BITSTRING_template field_pag__chan__restruct; INTEGER_template field_nln__sacch; BITSTRING_template field_call__prio__presence; INTEGER_template field_call__prio; BITSTRING_template field_nln__status__sacch; }; void PchAndNchInfo_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_pag__chan__restruct = ANY_VALUE; single_value->field_nln__sacch = ANY_VALUE; single_value->field_call__prio__presence = ANY_VALUE; single_value->field_call__prio = ANY_OR_OMIT; single_value->field_nln__status__sacch = ANY_VALUE; } } } void PchAndNchInfo_template::copy_value(const PchAndNchInfo& other_value) { single_value = new single_value_struct; if (other_value.pag__chan__restruct().is_bound()) { single_value->field_pag__chan__restruct = other_value.pag__chan__restruct(); } else { single_value->field_pag__chan__restruct.clean_up(); } if (other_value.nln__sacch().is_bound()) { single_value->field_nln__sacch = other_value.nln__sacch(); } else { single_value->field_nln__sacch.clean_up(); } if (other_value.call__prio__presence().is_bound()) { single_value->field_call__prio__presence = other_value.call__prio__presence(); } else { single_value->field_call__prio__presence.clean_up(); } if (other_value.call__prio().is_bound()) { if (other_value.call__prio().ispresent()) single_value->field_call__prio = other_value.call__prio()(); else single_value->field_call__prio = OMIT_VALUE; } else { single_value->field_call__prio.clean_up(); } if (other_value.nln__status__sacch().is_bound()) { single_value->field_nln__status__sacch = other_value.nln__status__sacch(); } else { single_value->field_nln__status__sacch.clean_up(); } set_selection(SPECIFIC_VALUE); } void PchAndNchInfo_template::copy_template(const PchAndNchInfo_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.pag__chan__restruct().get_selection()) { single_value->field_pag__chan__restruct = other_value.pag__chan__restruct(); } else { single_value->field_pag__chan__restruct.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.nln__sacch().get_selection()) { single_value->field_nln__sacch = other_value.nln__sacch(); } else { single_value->field_nln__sacch.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.call__prio__presence().get_selection()) { single_value->field_call__prio__presence = other_value.call__prio__presence(); } else { single_value->field_call__prio__presence.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.call__prio().get_selection()) { single_value->field_call__prio = other_value.call__prio(); } else { single_value->field_call__prio.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.nln__status__sacch().get_selection()) { single_value->field_nln__status__sacch = other_value.nln__status__sacch(); } else { single_value->field_nln__status__sacch.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 PchAndNchInfo_template[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 PchAndNchInfo_template(*other_value.implication_.precondition); implication_.implied_template = new PchAndNchInfo_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.PchAndNchInfo."); break; } set_selection(other_value); } PchAndNchInfo_template::PchAndNchInfo_template() { } PchAndNchInfo_template::PchAndNchInfo_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } PchAndNchInfo_template::PchAndNchInfo_template(const PchAndNchInfo& other_value) { copy_value(other_value); } PchAndNchInfo_template::PchAndNchInfo_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PchAndNchInfo&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.PchAndNchInfo from an unbound optional field."); } } PchAndNchInfo_template::PchAndNchInfo_template(PchAndNchInfo_template* p_precondition, PchAndNchInfo_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } PchAndNchInfo_template::PchAndNchInfo_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; } PchAndNchInfo_template::PchAndNchInfo_template(const PchAndNchInfo_template& other_value) : Base_Template() { copy_template(other_value); } PchAndNchInfo_template::~PchAndNchInfo_template() { clean_up(); } PchAndNchInfo_template& PchAndNchInfo_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } PchAndNchInfo_template& PchAndNchInfo_template::operator=(const PchAndNchInfo& other_value) { clean_up(); copy_value(other_value); return *this; } PchAndNchInfo_template& PchAndNchInfo_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const PchAndNchInfo&)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.PchAndNchInfo."); } return *this; } PchAndNchInfo_template& PchAndNchInfo_template::operator=(const PchAndNchInfo_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean PchAndNchInfo_template::match(const PchAndNchInfo& 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.pag__chan__restruct().is_bound()) return FALSE; if(!single_value->field_pag__chan__restruct.match(other_value.pag__chan__restruct(), legacy))return FALSE; if(!other_value.nln__sacch().is_bound()) return FALSE; if(!single_value->field_nln__sacch.match(other_value.nln__sacch(), legacy))return FALSE; if(!other_value.call__prio__presence().is_bound()) return FALSE; if(!single_value->field_call__prio__presence.match(other_value.call__prio__presence(), legacy))return FALSE; if(!other_value.call__prio().is_bound()) return FALSE; if((other_value.call__prio().ispresent() ? !single_value->field_call__prio.match((const INTEGER&)other_value.call__prio(), legacy) : !single_value->field_call__prio.match_omit(legacy)))return FALSE; if(!other_value.nln__status__sacch().is_bound()) return FALSE; if(!single_value->field_nln__status__sacch.match(other_value.nln__status__sacch(), 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.PchAndNchInfo."); } return FALSE; } boolean PchAndNchInfo_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_pag__chan__restruct.is_bound() || single_value->field_nln__sacch.is_bound() || single_value->field_call__prio__presence.is_bound() || (single_value->field_call__prio.is_omit() || single_value->field_call__prio.is_bound()) || single_value->field_nln__status__sacch.is_bound(); } boolean PchAndNchInfo_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_pag__chan__restruct.is_value() && single_value->field_nln__sacch.is_value() && single_value->field_call__prio__presence.is_value() && (single_value->field_call__prio.is_omit() || single_value->field_call__prio.is_value()) && single_value->field_nln__status__sacch.is_value(); } void PchAndNchInfo_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; } PchAndNchInfo PchAndNchInfo_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.PchAndNchInfo."); PchAndNchInfo ret_val; if (single_value->field_pag__chan__restruct.is_bound()) { ret_val.pag__chan__restruct() = single_value->field_pag__chan__restruct.valueof(); } if (single_value->field_nln__sacch.is_bound()) { ret_val.nln__sacch() = single_value->field_nln__sacch.valueof(); } if (single_value->field_call__prio__presence.is_bound()) { ret_val.call__prio__presence() = single_value->field_call__prio__presence.valueof(); } if (single_value->field_call__prio.is_omit()) ret_val.call__prio() = OMIT_VALUE; else if (single_value->field_call__prio.is_bound()) { ret_val.call__prio() = single_value->field_call__prio.valueof(); } if (single_value->field_nln__status__sacch.is_bound()) { ret_val.nln__status__sacch() = single_value->field_nln__status__sacch.valueof(); } return ret_val; } void PchAndNchInfo_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.PchAndNchInfo."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new PchAndNchInfo_template[list_length]; } PchAndNchInfo_template& PchAndNchInfo_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.PchAndNchInfo."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.PchAndNchInfo."); return value_list.list_value[list_index]; } BITSTRING_template& PchAndNchInfo_template::pag__chan__restruct() { set_specific(); return single_value->field_pag__chan__restruct; } const BITSTRING_template& PchAndNchInfo_template::pag__chan__restruct() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field pag_chan_restruct of a non-specific template of type @GSM_RestOctets.PchAndNchInfo."); return single_value->field_pag__chan__restruct; } INTEGER_template& PchAndNchInfo_template::nln__sacch() { set_specific(); return single_value->field_nln__sacch; } const INTEGER_template& PchAndNchInfo_template::nln__sacch() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nln_sacch of a non-specific template of type @GSM_RestOctets.PchAndNchInfo."); return single_value->field_nln__sacch; } BITSTRING_template& PchAndNchInfo_template::call__prio__presence() { set_specific(); return single_value->field_call__prio__presence; } const BITSTRING_template& PchAndNchInfo_template::call__prio__presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field call_prio_presence of a non-specific template of type @GSM_RestOctets.PchAndNchInfo."); return single_value->field_call__prio__presence; } INTEGER_template& PchAndNchInfo_template::call__prio() { set_specific(); return single_value->field_call__prio; } const INTEGER_template& PchAndNchInfo_template::call__prio() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field call_prio of a non-specific template of type @GSM_RestOctets.PchAndNchInfo."); return single_value->field_call__prio; } BITSTRING_template& PchAndNchInfo_template::nln__status__sacch() { set_specific(); return single_value->field_nln__status__sacch; } const BITSTRING_template& PchAndNchInfo_template::nln__status__sacch() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field nln_status_sacch of a non-specific template of type @GSM_RestOctets.PchAndNchInfo."); return single_value->field_nln__status__sacch; } int PchAndNchInfo_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.PchAndNchInfo which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 4; if (single_value->field_call__prio.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.PchAndNchInfo 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.PchAndNchInfo 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.PchAndNchInfo containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.PchAndNchInfo containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.PchAndNchInfo containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.PchAndNchInfo containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.PchAndNchInfo containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.PchAndNchInfo containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.PchAndNchInfo."); } return 0; } void PchAndNchInfo_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ pag_chan_restruct := "); single_value->field_pag__chan__restruct.log(); TTCN_Logger::log_event_str(", nln_sacch := "); single_value->field_nln__sacch.log(); TTCN_Logger::log_event_str(", call_prio_presence := "); single_value->field_call__prio__presence.log(); TTCN_Logger::log_event_str(", call_prio := "); single_value->field_call__prio.log(); TTCN_Logger::log_event_str(", nln_status_sacch := "); single_value->field_nln__status__sacch.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 PchAndNchInfo_template::log_match(const PchAndNchInfo& 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_pag__chan__restruct.match(match_value.pag__chan__restruct(), legacy)){ TTCN_Logger::log_logmatch_info(".pag_chan_restruct"); single_value->field_pag__chan__restruct.log_match(match_value.pag__chan__restruct(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_nln__sacch.match(match_value.nln__sacch(), legacy)){ TTCN_Logger::log_logmatch_info(".nln_sacch"); single_value->field_nln__sacch.log_match(match_value.nln__sacch(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_call__prio__presence.match(match_value.call__prio__presence(), legacy)){ TTCN_Logger::log_logmatch_info(".call_prio_presence"); single_value->field_call__prio__presence.log_match(match_value.call__prio__presence(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.call__prio().ispresent()){ if(!single_value->field_call__prio.match(match_value.call__prio(), legacy)){ TTCN_Logger::log_logmatch_info(".call_prio"); single_value->field_call__prio.log_match(match_value.call__prio(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_call__prio.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".call_prio := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_call__prio.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if(!single_value->field_nln__status__sacch.match(match_value.nln__status__sacch(), legacy)){ TTCN_Logger::log_logmatch_info(".nln_status_sacch"); single_value->field_nln__status__sacch.log_match(match_value.nln__status__sacch(), 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("{ pag_chan_restruct := "); single_value->field_pag__chan__restruct.log_match(match_value.pag__chan__restruct(), legacy); TTCN_Logger::log_event_str(", nln_sacch := "); single_value->field_nln__sacch.log_match(match_value.nln__sacch(), legacy); TTCN_Logger::log_event_str(", call_prio_presence := "); single_value->field_call__prio__presence.log_match(match_value.call__prio__presence(), legacy); TTCN_Logger::log_event_str(", call_prio := "); if (match_value.call__prio().ispresent()) { single_value->field_call__prio.log_match(match_value.call__prio(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_call__prio.log(); if (single_value->field_call__prio.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", nln_status_sacch := "); single_value->field_nln__status__sacch.log_match(match_value.nln__status__sacch(), 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 PchAndNchInfo_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (pag__chan__restruct().is_bound()) pag__chan__restruct().set_implicit_omit(); if (nln__sacch().is_bound()) nln__sacch().set_implicit_omit(); if (call__prio__presence().is_bound()) call__prio__presence().set_implicit_omit(); if (!call__prio().is_bound()) call__prio() = OMIT_VALUE; else call__prio().set_implicit_omit(); if (nln__status__sacch().is_bound()) nln__status__sacch().set_implicit_omit(); } void PchAndNchInfo_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_pag__chan__restruct.encode_text(text_buf); single_value->field_nln__sacch.encode_text(text_buf); single_value->field_call__prio__presence.encode_text(text_buf); single_value->field_call__prio.encode_text(text_buf); single_value->field_nln__status__sacch.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.PchAndNchInfo."); } } void PchAndNchInfo_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_pag__chan__restruct.decode_text(text_buf); single_value->field_nln__sacch.decode_text(text_buf); single_value->field_call__prio__presence.decode_text(text_buf); single_value->field_call__prio.decode_text(text_buf); single_value->field_nln__status__sacch.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 PchAndNchInfo_template[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.PchAndNchInfo."); } } void PchAndNchInfo_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: { PchAndNchInfo_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) pag__chan__restruct().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) nln__sacch().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) call__prio__presence().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) call__prio().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) nln__status__sacch().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(), "pag_chan_restruct")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { pag__chan__restruct().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nln_sacch")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nln__sacch().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "call_prio_presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { call__prio__presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "call_prio")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { call__prio().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "nln_status_sacch")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { nln__status__sacch().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.PchAndNchInfo: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { PchAndNchInfo_template* precondition = new PchAndNchInfo_template; precondition->set_param(*param.get_elem(0)); PchAndNchInfo_template* implied_template = new PchAndNchInfo_template; implied_template->set_param(*param.get_elem(1)); *this = PchAndNchInfo_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.PchAndNchInfo"); } is_ifpresent = param.get_ifpresent(); } void PchAndNchInfo_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_pag__chan__restruct.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.PchAndNchInfo"); single_value->field_nln__sacch.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.PchAndNchInfo"); single_value->field_call__prio__presence.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.PchAndNchInfo"); single_value->field_call__prio.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.PchAndNchInfo"); single_value->field_nln__status__sacch.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.PchAndNchInfo"); 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.PchAndNchInfo"); } boolean PchAndNchInfo_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean PchAndNchInfo_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_options) : field_presence(par_presence), field_options(par_options) { } VbsVgcsOptionsOpt::VbsVgcsOptionsOpt(const VbsVgcsOptionsOpt& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.VbsVgcsOptionsOpt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.options().is_bound()) field_options = other_value.options(); else field_options.clean_up(); } void VbsVgcsOptionsOpt::clean_up() { field_presence.clean_up(); field_options.clean_up(); } const TTCN_Typedescriptor_t* VbsVgcsOptionsOpt::get_descriptor() const { return &VbsVgcsOptionsOpt_descr_; } VbsVgcsOptionsOpt& VbsVgcsOptionsOpt::operator=(const VbsVgcsOptionsOpt& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.VbsVgcsOptionsOpt."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.options().is_bound()) field_options = other_value.options(); else field_options.clean_up(); } return *this; } boolean VbsVgcsOptionsOpt::operator==(const VbsVgcsOptionsOpt& other_value) const { return field_presence==other_value.field_presence && field_options==other_value.field_options; } boolean VbsVgcsOptionsOpt::is_bound() const { return (field_presence.is_bound()) || (OPTIONAL_OMIT == field_options.get_selection() || field_options.is_bound()); } boolean VbsVgcsOptionsOpt::is_value() const { return field_presence.is_value() && (OPTIONAL_OMIT == field_options.get_selection() || field_options.is_value()); } int VbsVgcsOptionsOpt::size_of() const { int ret_val = 1; if (field_options.ispresent()) ret_val++; return ret_val; } void VbsVgcsOptionsOpt::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(", options := "); field_options.log(); TTCN_Logger::log_event_str(" }"); } void VbsVgcsOptionsOpt::set_implicit_omit() { if (presence().is_bound()) presence().set_implicit_omit(); if (!options().is_bound()) options() = OMIT_VALUE; else options().set_implicit_omit(); } void VbsVgcsOptionsOpt::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) options().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(), "options")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { options().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.VbsVgcsOptionsOpt: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.VbsVgcsOptionsOpt"); } } void VbsVgcsOptionsOpt::encode_text(Text_Buf& text_buf) const { field_presence.encode_text(text_buf); field_options.encode_text(text_buf); } void VbsVgcsOptionsOpt::decode_text(Text_Buf& text_buf) { field_presence.decode_text(text_buf); field_options.decode_text(text_buf); } void VbsVgcsOptionsOpt::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 VbsVgcsOptionsOpt::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 VbsVgcsOptionsOpt::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, VbsVgcsOptionsOpt_presence_descr_.raw->forceomit); decoded_field_length = field_presence.RAW_decode(VbsVgcsOptionsOpt_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_options = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_1_force_omit(1, force_omit, VbsVgcsOptionsOpt_options_descr_.raw->forceomit); decoded_field_length = field_options().RAW_decode(VbsVgcsOptionsOpt_options_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 1) { field_options = 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_options=OMIT_VALUE; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int VbsVgcsOptionsOpt::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, VbsVgcsOptionsOpt_presence_descr_.raw); if (field_options.ispresent()) { myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, VbsVgcsOptionsOpt_options_descr_.raw); } else myleaf.body.node.nodes[1] = NULL; encoded_length += field_presence.RAW_encode(VbsVgcsOptionsOpt_presence_descr_, *myleaf.body.node.nodes[0]); if (field_options.ispresent()) { encoded_length += field_options().RAW_encode(VbsVgcsOptionsOpt_options_descr_, *myleaf.body.node.nodes[1]); } if (field_options.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(VbsVgcsOptionsOpt_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 VbsVgcsOptionsOpt_template::single_value_struct { BITSTRING_template field_presence; BITSTRING_template field_options; }; void VbsVgcsOptionsOpt_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_options = ANY_OR_OMIT; } } } void VbsVgcsOptionsOpt_template::copy_value(const VbsVgcsOptionsOpt& 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.options().is_bound()) { if (other_value.options().ispresent()) single_value->field_options = other_value.options()(); else single_value->field_options = OMIT_VALUE; } else { single_value->field_options.clean_up(); } set_selection(SPECIFIC_VALUE); } void VbsVgcsOptionsOpt_template::copy_template(const VbsVgcsOptionsOpt_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.options().get_selection()) { single_value->field_options = other_value.options(); } else { single_value->field_options.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 VbsVgcsOptionsOpt_template[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 VbsVgcsOptionsOpt_template(*other_value.implication_.precondition); implication_.implied_template = new VbsVgcsOptionsOpt_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.VbsVgcsOptionsOpt."); break; } set_selection(other_value); } VbsVgcsOptionsOpt_template::VbsVgcsOptionsOpt_template() { } VbsVgcsOptionsOpt_template::VbsVgcsOptionsOpt_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } VbsVgcsOptionsOpt_template::VbsVgcsOptionsOpt_template(const VbsVgcsOptionsOpt& other_value) { copy_value(other_value); } VbsVgcsOptionsOpt_template::VbsVgcsOptionsOpt_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const VbsVgcsOptionsOpt&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.VbsVgcsOptionsOpt from an unbound optional field."); } } VbsVgcsOptionsOpt_template::VbsVgcsOptionsOpt_template(VbsVgcsOptionsOpt_template* p_precondition, VbsVgcsOptionsOpt_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } VbsVgcsOptionsOpt_template::VbsVgcsOptionsOpt_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; } VbsVgcsOptionsOpt_template::VbsVgcsOptionsOpt_template(const VbsVgcsOptionsOpt_template& other_value) : Base_Template() { copy_template(other_value); } VbsVgcsOptionsOpt_template::~VbsVgcsOptionsOpt_template() { clean_up(); } VbsVgcsOptionsOpt_template& VbsVgcsOptionsOpt_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } VbsVgcsOptionsOpt_template& VbsVgcsOptionsOpt_template::operator=(const VbsVgcsOptionsOpt& other_value) { clean_up(); copy_value(other_value); return *this; } VbsVgcsOptionsOpt_template& VbsVgcsOptionsOpt_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const VbsVgcsOptionsOpt&)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.VbsVgcsOptionsOpt."); } return *this; } VbsVgcsOptionsOpt_template& VbsVgcsOptionsOpt_template::operator=(const VbsVgcsOptionsOpt_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean VbsVgcsOptionsOpt_template::match(const VbsVgcsOptionsOpt& 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.options().is_bound()) return FALSE; if((other_value.options().ispresent() ? !single_value->field_options.match((const BITSTRING&)other_value.options(), legacy) : !single_value->field_options.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.VbsVgcsOptionsOpt."); } return FALSE; } boolean VbsVgcsOptionsOpt_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_options.is_omit() || single_value->field_options.is_bound()); } boolean VbsVgcsOptionsOpt_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_presence.is_value() && (single_value->field_options.is_omit() || single_value->field_options.is_value()); } void VbsVgcsOptionsOpt_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; } VbsVgcsOptionsOpt VbsVgcsOptionsOpt_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.VbsVgcsOptionsOpt."); VbsVgcsOptionsOpt ret_val; if (single_value->field_presence.is_bound()) { ret_val.presence() = single_value->field_presence.valueof(); } if (single_value->field_options.is_omit()) ret_val.options() = OMIT_VALUE; else if (single_value->field_options.is_bound()) { ret_val.options() = single_value->field_options.valueof(); } return ret_val; } void VbsVgcsOptionsOpt_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.VbsVgcsOptionsOpt."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new VbsVgcsOptionsOpt_template[list_length]; } VbsVgcsOptionsOpt_template& VbsVgcsOptionsOpt_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.VbsVgcsOptionsOpt."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.VbsVgcsOptionsOpt."); return value_list.list_value[list_index]; } BITSTRING_template& VbsVgcsOptionsOpt_template::presence() { set_specific(); return single_value->field_presence; } const BITSTRING_template& VbsVgcsOptionsOpt_template::presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field presence of a non-specific template of type @GSM_RestOctets.VbsVgcsOptionsOpt."); return single_value->field_presence; } BITSTRING_template& VbsVgcsOptionsOpt_template::options() { set_specific(); return single_value->field_options; } const BITSTRING_template& VbsVgcsOptionsOpt_template::options() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field options of a non-specific template of type @GSM_RestOctets.VbsVgcsOptionsOpt."); return single_value->field_options; } int VbsVgcsOptionsOpt_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.VbsVgcsOptionsOpt which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 1; if (single_value->field_options.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.VbsVgcsOptionsOpt 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.VbsVgcsOptionsOpt 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.VbsVgcsOptionsOpt containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.VbsVgcsOptionsOpt containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.VbsVgcsOptionsOpt containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.VbsVgcsOptionsOpt containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.VbsVgcsOptionsOpt containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.VbsVgcsOptionsOpt containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.VbsVgcsOptionsOpt."); } return 0; } void VbsVgcsOptionsOpt_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(", options := "); single_value->field_options.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 VbsVgcsOptionsOpt_template::log_match(const VbsVgcsOptionsOpt& 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.options().ispresent()){ if(!single_value->field_options.match(match_value.options(), legacy)){ TTCN_Logger::log_logmatch_info(".options"); single_value->field_options.log_match(match_value.options(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_options.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".options := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_options.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(", options := "); if (match_value.options().ispresent()) { single_value->field_options.log_match(match_value.options(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_options.log(); if (single_value->field_options.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 VbsVgcsOptionsOpt_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (presence().is_bound()) presence().set_implicit_omit(); if (!options().is_bound()) options() = OMIT_VALUE; else options().set_implicit_omit(); } void VbsVgcsOptionsOpt_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_options.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.VbsVgcsOptionsOpt."); } } void VbsVgcsOptionsOpt_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_options.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 VbsVgcsOptionsOpt_template[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.VbsVgcsOptionsOpt."); } } void VbsVgcsOptionsOpt_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: { VbsVgcsOptionsOpt_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) options().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(), "options")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { options().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.VbsVgcsOptionsOpt: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { VbsVgcsOptionsOpt_template* precondition = new VbsVgcsOptionsOpt_template; precondition->set_param(*param.get_elem(0)); VbsVgcsOptionsOpt_template* implied_template = new VbsVgcsOptionsOpt_template; implied_template->set_param(*param.get_elem(1)); *this = VbsVgcsOptionsOpt_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.VbsVgcsOptionsOpt"); } is_ifpresent = param.get_ifpresent(); } void VbsVgcsOptionsOpt_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.VbsVgcsOptionsOpt"); single_value->field_options.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.VbsVgcsOptionsOpt"); 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.VbsVgcsOptionsOpt"); } boolean VbsVgcsOptionsOpt_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean VbsVgcsOptionsOpt_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_rac, const OPTIONAL< INTEGER >& par_max__lapdm, const BITSTRING& par_band__ind) : field_pch__nch__info(par_pch__nch__info), field_vbs__vgcs__options(par_vbs__vgcs__options), field_dtm__support(par_dtm__support), field_rac(par_rac), field_max__lapdm(par_max__lapdm), field_band__ind(par_band__ind) { } SI6RestOctets::SI6RestOctets(const SI6RestOctets& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.SI6RestOctets."); if (other_value.pch__nch__info().is_bound()) field_pch__nch__info = other_value.pch__nch__info(); else field_pch__nch__info.clean_up(); if (other_value.vbs__vgcs__options().is_bound()) field_vbs__vgcs__options = other_value.vbs__vgcs__options(); else field_vbs__vgcs__options.clean_up(); if (other_value.dtm__support().is_bound()) field_dtm__support = other_value.dtm__support(); else field_dtm__support.clean_up(); if (other_value.rac().is_bound()) field_rac = other_value.rac(); else field_rac.clean_up(); if (other_value.max__lapdm().is_bound()) field_max__lapdm = other_value.max__lapdm(); else field_max__lapdm.clean_up(); if (other_value.band__ind().is_bound()) field_band__ind = other_value.band__ind(); else field_band__ind.clean_up(); } void SI6RestOctets::clean_up() { field_pch__nch__info.clean_up(); field_vbs__vgcs__options.clean_up(); field_dtm__support.clean_up(); field_rac.clean_up(); field_max__lapdm.clean_up(); field_band__ind.clean_up(); } const TTCN_Typedescriptor_t* SI6RestOctets::get_descriptor() const { return &SI6RestOctets_descr_; } SI6RestOctets& SI6RestOctets::operator=(const SI6RestOctets& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.SI6RestOctets."); if (other_value.pch__nch__info().is_bound()) field_pch__nch__info = other_value.pch__nch__info(); else field_pch__nch__info.clean_up(); if (other_value.vbs__vgcs__options().is_bound()) field_vbs__vgcs__options = other_value.vbs__vgcs__options(); else field_vbs__vgcs__options.clean_up(); if (other_value.dtm__support().is_bound()) field_dtm__support = other_value.dtm__support(); else field_dtm__support.clean_up(); if (other_value.rac().is_bound()) field_rac = other_value.rac(); else field_rac.clean_up(); if (other_value.max__lapdm().is_bound()) field_max__lapdm = other_value.max__lapdm(); else field_max__lapdm.clean_up(); if (other_value.band__ind().is_bound()) field_band__ind = other_value.band__ind(); else field_band__ind.clean_up(); } return *this; } boolean SI6RestOctets::operator==(const SI6RestOctets& other_value) const { return field_pch__nch__info==other_value.field_pch__nch__info && field_vbs__vgcs__options==other_value.field_vbs__vgcs__options && field_dtm__support==other_value.field_dtm__support && field_rac==other_value.field_rac && field_max__lapdm==other_value.field_max__lapdm && field_band__ind==other_value.field_band__ind; } boolean SI6RestOctets::is_bound() const { return (field_pch__nch__info.is_bound()) || (field_vbs__vgcs__options.is_bound()) || (field_dtm__support.is_bound()) || (OPTIONAL_OMIT == field_rac.get_selection() || field_rac.is_bound()) || (OPTIONAL_OMIT == field_max__lapdm.get_selection() || field_max__lapdm.is_bound()) || (field_band__ind.is_bound()); } boolean SI6RestOctets::is_value() const { return field_pch__nch__info.is_value() && field_vbs__vgcs__options.is_value() && field_dtm__support.is_value() && (OPTIONAL_OMIT == field_rac.get_selection() || field_rac.is_value()) && (OPTIONAL_OMIT == field_max__lapdm.get_selection() || field_max__lapdm.is_value()) && field_band__ind.is_value(); } int SI6RestOctets::size_of() const { int ret_val = 4; if (field_rac.ispresent()) ret_val++; if (field_max__lapdm.ispresent()) ret_val++; return ret_val; } void SI6RestOctets::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ pch_nch_info := "); field_pch__nch__info.log(); TTCN_Logger::log_event_str(", vbs_vgcs_options := "); field_vbs__vgcs__options.log(); TTCN_Logger::log_event_str(", dtm_support := "); field_dtm__support.log(); TTCN_Logger::log_event_str(", rac := "); field_rac.log(); TTCN_Logger::log_event_str(", max_lapdm := "); field_max__lapdm.log(); TTCN_Logger::log_event_str(", band_ind := "); field_band__ind.log(); TTCN_Logger::log_event_str(" }"); } void SI6RestOctets::set_implicit_omit() { if (pch__nch__info().is_bound()) pch__nch__info().set_implicit_omit(); if (vbs__vgcs__options().is_bound()) vbs__vgcs__options().set_implicit_omit(); if (dtm__support().is_bound()) dtm__support().set_implicit_omit(); if (!rac().is_bound()) rac() = OMIT_VALUE; else rac().set_implicit_omit(); if (!max__lapdm().is_bound()) max__lapdm() = OMIT_VALUE; else max__lapdm().set_implicit_omit(); if (band__ind().is_bound()) band__ind().set_implicit_omit(); } void SI6RestOctets::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) pch__nch__info().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) vbs__vgcs__options().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) dtm__support().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) rac().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) max__lapdm().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) band__ind().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(), "pch_nch_info")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { pch__nch__info().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "vbs_vgcs_options")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { vbs__vgcs__options().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "dtm_support")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { dtm__support().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "rac")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rac().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "max_lapdm")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { max__lapdm().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "band_ind")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { band__ind().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.SI6RestOctets: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.SI6RestOctets"); } } void SI6RestOctets::encode_text(Text_Buf& text_buf) const { field_pch__nch__info.encode_text(text_buf); field_vbs__vgcs__options.encode_text(text_buf); field_dtm__support.encode_text(text_buf); field_rac.encode_text(text_buf); field_max__lapdm.encode_text(text_buf); field_band__ind.encode_text(text_buf); } void SI6RestOctets::decode_text(Text_Buf& text_buf) { field_pch__nch__info.decode_text(text_buf); field_vbs__vgcs__options.decode_text(text_buf); field_dtm__support.decode_text(text_buf); field_rac.decode_text(text_buf); field_max__lapdm.decode_text(text_buf); field_band__ind.decode_text(text_buf); } void SI6RestOctets::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 SI6RestOctets::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 SI6RestOctets::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, SI6RestOctets_pch__nch__info_descr_.raw->forceomit); decoded_field_length = field_pch__nch__info.RAW_decode(SI6RestOctets_pch__nch__info_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, SI6RestOctets_vbs__vgcs__options_descr_.raw->forceomit); decoded_field_length = field_vbs__vgcs__options.RAW_decode(SI6RestOctets_vbs__vgcs__options_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, SI6RestOctets_dtm__support_descr_.raw->forceomit); decoded_field_length = field_dtm__support.RAW_decode(SI6RestOctets_dtm__support_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_dtm__support == bs_0){ if (force_omit != NULL && (*force_omit)(3)) { field_rac = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_3_force_omit(3, force_omit, SI6RestOctets_rac_descr_.raw->forceomit); decoded_field_length = field_rac().RAW_decode(SI6RestOctets_rac_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_3_force_omit); if (decoded_field_length < 1) { field_rac = 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_rac=OMIT_VALUE; if (limit > 0 && field_dtm__support == bs_0){ if (force_omit != NULL && (*force_omit)(4)) { field_max__lapdm = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_4_force_omit(4, force_omit, SI6RestOctets_max__lapdm_descr_.raw->forceomit); decoded_field_length = field_max__lapdm().RAW_decode(SI6RestOctets_max__lapdm_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_4_force_omit); if (decoded_field_length < 1) { field_max__lapdm = 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_max__lapdm=OMIT_VALUE; RAW_Force_Omit field_5_force_omit(5, force_omit, SI6RestOctets_band__ind_descr_.raw->forceomit); decoded_field_length = field_band__ind.RAW_decode(SI6RestOctets_band__ind_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 SI6RestOctets::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, SI6RestOctets_pch__nch__info_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, SI6RestOctets_vbs__vgcs__options_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, SI6RestOctets_dtm__support_descr_.raw); if (field_rac.ispresent()) { myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, SI6RestOctets_rac_descr_.raw); } else myleaf.body.node.nodes[3] = NULL; if (field_max__lapdm.ispresent()) { myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, SI6RestOctets_max__lapdm_descr_.raw); } else myleaf.body.node.nodes[4] = NULL; myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, SI6RestOctets_band__ind_descr_.raw); encoded_length += field_pch__nch__info.RAW_encode(SI6RestOctets_pch__nch__info_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_vbs__vgcs__options.RAW_encode(SI6RestOctets_vbs__vgcs__options_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_dtm__support.RAW_encode(SI6RestOctets_dtm__support_descr_, *myleaf.body.node.nodes[2]); if (field_rac.ispresent()) { encoded_length += field_rac().RAW_encode(SI6RestOctets_rac_descr_, *myleaf.body.node.nodes[3]); } if (field_max__lapdm.ispresent()) { encoded_length += field_max__lapdm().RAW_encode(SI6RestOctets_max__lapdm_descr_, *myleaf.body.node.nodes[4]); } encoded_length += field_band__ind.RAW_encode(SI6RestOctets_band__ind_descr_, *myleaf.body.node.nodes[5]); if (field_rac.ispresent() && (field_dtm__support != 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(SI6RestOctets_dtm__support_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_max__lapdm.ispresent() && (field_dtm__support != 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(SI6RestOctets_dtm__support_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 SI6RestOctets_template::single_value_struct { PchAndNchInfoOpt_template field_pch__nch__info; VbsVgcsOptionsOpt_template field_vbs__vgcs__options; BITSTRING_template field_dtm__support; INTEGER_template field_rac; INTEGER_template field_max__lapdm; BITSTRING_template field_band__ind; }; void SI6RestOctets_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_pch__nch__info = ANY_VALUE; single_value->field_vbs__vgcs__options = ANY_VALUE; single_value->field_dtm__support = ANY_VALUE; single_value->field_rac = ANY_OR_OMIT; single_value->field_max__lapdm = ANY_OR_OMIT; single_value->field_band__ind = ANY_VALUE; } } } void SI6RestOctets_template::copy_value(const SI6RestOctets& other_value) { single_value = new single_value_struct; if (other_value.pch__nch__info().is_bound()) { single_value->field_pch__nch__info = other_value.pch__nch__info(); } else { single_value->field_pch__nch__info.clean_up(); } if (other_value.vbs__vgcs__options().is_bound()) { single_value->field_vbs__vgcs__options = other_value.vbs__vgcs__options(); } else { single_value->field_vbs__vgcs__options.clean_up(); } if (other_value.dtm__support().is_bound()) { single_value->field_dtm__support = other_value.dtm__support(); } else { single_value->field_dtm__support.clean_up(); } if (other_value.rac().is_bound()) { if (other_value.rac().ispresent()) single_value->field_rac = other_value.rac()(); else single_value->field_rac = OMIT_VALUE; } else { single_value->field_rac.clean_up(); } if (other_value.max__lapdm().is_bound()) { if (other_value.max__lapdm().ispresent()) single_value->field_max__lapdm = other_value.max__lapdm()(); else single_value->field_max__lapdm = OMIT_VALUE; } else { single_value->field_max__lapdm.clean_up(); } if (other_value.band__ind().is_bound()) { single_value->field_band__ind = other_value.band__ind(); } else { single_value->field_band__ind.clean_up(); } set_selection(SPECIFIC_VALUE); } void SI6RestOctets_template::copy_template(const SI6RestOctets_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.pch__nch__info().get_selection()) { single_value->field_pch__nch__info = other_value.pch__nch__info(); } else { single_value->field_pch__nch__info.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.vbs__vgcs__options().get_selection()) { single_value->field_vbs__vgcs__options = other_value.vbs__vgcs__options(); } else { single_value->field_vbs__vgcs__options.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.dtm__support().get_selection()) { single_value->field_dtm__support = other_value.dtm__support(); } else { single_value->field_dtm__support.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.rac().get_selection()) { single_value->field_rac = other_value.rac(); } else { single_value->field_rac.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.max__lapdm().get_selection()) { single_value->field_max__lapdm = other_value.max__lapdm(); } else { single_value->field_max__lapdm.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.band__ind().get_selection()) { single_value->field_band__ind = other_value.band__ind(); } else { single_value->field_band__ind.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 SI6RestOctets_template[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 SI6RestOctets_template(*other_value.implication_.precondition); implication_.implied_template = new SI6RestOctets_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.SI6RestOctets."); break; } set_selection(other_value); } SI6RestOctets_template::SI6RestOctets_template() { } SI6RestOctets_template::SI6RestOctets_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } SI6RestOctets_template::SI6RestOctets_template(const SI6RestOctets& other_value) { copy_value(other_value); } SI6RestOctets_template::SI6RestOctets_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI6RestOctets&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.SI6RestOctets from an unbound optional field."); } } SI6RestOctets_template::SI6RestOctets_template(SI6RestOctets_template* p_precondition, SI6RestOctets_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } SI6RestOctets_template::SI6RestOctets_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; } SI6RestOctets_template::SI6RestOctets_template(const SI6RestOctets_template& other_value) : Base_Template() { copy_template(other_value); } SI6RestOctets_template::~SI6RestOctets_template() { clean_up(); } SI6RestOctets_template& SI6RestOctets_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } SI6RestOctets_template& SI6RestOctets_template::operator=(const SI6RestOctets& other_value) { clean_up(); copy_value(other_value); return *this; } SI6RestOctets_template& SI6RestOctets_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI6RestOctets&)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.SI6RestOctets."); } return *this; } SI6RestOctets_template& SI6RestOctets_template::operator=(const SI6RestOctets_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean SI6RestOctets_template::match(const SI6RestOctets& 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.pch__nch__info().is_bound()) return FALSE; if(!single_value->field_pch__nch__info.match(other_value.pch__nch__info(), legacy))return FALSE; if(!other_value.vbs__vgcs__options().is_bound()) return FALSE; if(!single_value->field_vbs__vgcs__options.match(other_value.vbs__vgcs__options(), legacy))return FALSE; if(!other_value.dtm__support().is_bound()) return FALSE; if(!single_value->field_dtm__support.match(other_value.dtm__support(), legacy))return FALSE; if(!other_value.rac().is_bound()) return FALSE; if((other_value.rac().ispresent() ? !single_value->field_rac.match((const INTEGER&)other_value.rac(), legacy) : !single_value->field_rac.match_omit(legacy)))return FALSE; if(!other_value.max__lapdm().is_bound()) return FALSE; if((other_value.max__lapdm().ispresent() ? !single_value->field_max__lapdm.match((const INTEGER&)other_value.max__lapdm(), legacy) : !single_value->field_max__lapdm.match_omit(legacy)))return FALSE; if(!other_value.band__ind().is_bound()) return FALSE; if(!single_value->field_band__ind.match(other_value.band__ind(), 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.SI6RestOctets."); } return FALSE; } boolean SI6RestOctets_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_pch__nch__info.is_bound() || single_value->field_vbs__vgcs__options.is_bound() || single_value->field_dtm__support.is_bound() || (single_value->field_rac.is_omit() || single_value->field_rac.is_bound()) || (single_value->field_max__lapdm.is_omit() || single_value->field_max__lapdm.is_bound()) || single_value->field_band__ind.is_bound(); } boolean SI6RestOctets_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_pch__nch__info.is_value() && single_value->field_vbs__vgcs__options.is_value() && single_value->field_dtm__support.is_value() && (single_value->field_rac.is_omit() || single_value->field_rac.is_value()) && (single_value->field_max__lapdm.is_omit() || single_value->field_max__lapdm.is_value()) && single_value->field_band__ind.is_value(); } void SI6RestOctets_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; } SI6RestOctets SI6RestOctets_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.SI6RestOctets."); SI6RestOctets ret_val; if (single_value->field_pch__nch__info.is_bound()) { ret_val.pch__nch__info() = single_value->field_pch__nch__info.valueof(); } if (single_value->field_vbs__vgcs__options.is_bound()) { ret_val.vbs__vgcs__options() = single_value->field_vbs__vgcs__options.valueof(); } if (single_value->field_dtm__support.is_bound()) { ret_val.dtm__support() = single_value->field_dtm__support.valueof(); } if (single_value->field_rac.is_omit()) ret_val.rac() = OMIT_VALUE; else if (single_value->field_rac.is_bound()) { ret_val.rac() = single_value->field_rac.valueof(); } if (single_value->field_max__lapdm.is_omit()) ret_val.max__lapdm() = OMIT_VALUE; else if (single_value->field_max__lapdm.is_bound()) { ret_val.max__lapdm() = single_value->field_max__lapdm.valueof(); } if (single_value->field_band__ind.is_bound()) { ret_val.band__ind() = single_value->field_band__ind.valueof(); } return ret_val; } void SI6RestOctets_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.SI6RestOctets."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new SI6RestOctets_template[list_length]; } SI6RestOctets_template& SI6RestOctets_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.SI6RestOctets."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.SI6RestOctets."); return value_list.list_value[list_index]; } PchAndNchInfoOpt_template& SI6RestOctets_template::pch__nch__info() { set_specific(); return single_value->field_pch__nch__info; } const PchAndNchInfoOpt_template& SI6RestOctets_template::pch__nch__info() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field pch_nch_info of a non-specific template of type @GSM_RestOctets.SI6RestOctets."); return single_value->field_pch__nch__info; } VbsVgcsOptionsOpt_template& SI6RestOctets_template::vbs__vgcs__options() { set_specific(); return single_value->field_vbs__vgcs__options; } const VbsVgcsOptionsOpt_template& SI6RestOctets_template::vbs__vgcs__options() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field vbs_vgcs_options of a non-specific template of type @GSM_RestOctets.SI6RestOctets."); return single_value->field_vbs__vgcs__options; } BITSTRING_template& SI6RestOctets_template::dtm__support() { set_specific(); return single_value->field_dtm__support; } const BITSTRING_template& SI6RestOctets_template::dtm__support() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field dtm_support of a non-specific template of type @GSM_RestOctets.SI6RestOctets."); return single_value->field_dtm__support; } INTEGER_template& SI6RestOctets_template::rac() { set_specific(); return single_value->field_rac; } const INTEGER_template& SI6RestOctets_template::rac() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field rac of a non-specific template of type @GSM_RestOctets.SI6RestOctets."); return single_value->field_rac; } INTEGER_template& SI6RestOctets_template::max__lapdm() { set_specific(); return single_value->field_max__lapdm; } const INTEGER_template& SI6RestOctets_template::max__lapdm() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field max_lapdm of a non-specific template of type @GSM_RestOctets.SI6RestOctets."); return single_value->field_max__lapdm; } BITSTRING_template& SI6RestOctets_template::band__ind() { set_specific(); return single_value->field_band__ind; } const BITSTRING_template& SI6RestOctets_template::band__ind() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field band_ind of a non-specific template of type @GSM_RestOctets.SI6RestOctets."); return single_value->field_band__ind; } int SI6RestOctets_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI6RestOctets which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 4; if (single_value->field_rac.is_present()) ret_val++; if (single_value->field_max__lapdm.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.SI6RestOctets 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.SI6RestOctets 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.SI6RestOctets containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI6RestOctets containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI6RestOctets containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI6RestOctets containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI6RestOctets containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI6RestOctets containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.SI6RestOctets."); } return 0; } void SI6RestOctets_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ pch_nch_info := "); single_value->field_pch__nch__info.log(); TTCN_Logger::log_event_str(", vbs_vgcs_options := "); single_value->field_vbs__vgcs__options.log(); TTCN_Logger::log_event_str(", dtm_support := "); single_value->field_dtm__support.log(); TTCN_Logger::log_event_str(", rac := "); single_value->field_rac.log(); TTCN_Logger::log_event_str(", max_lapdm := "); single_value->field_max__lapdm.log(); TTCN_Logger::log_event_str(", band_ind := "); single_value->field_band__ind.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 SI6RestOctets_template::log_match(const SI6RestOctets& 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_pch__nch__info.match(match_value.pch__nch__info(), legacy)){ TTCN_Logger::log_logmatch_info(".pch_nch_info"); single_value->field_pch__nch__info.log_match(match_value.pch__nch__info(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_vbs__vgcs__options.match(match_value.vbs__vgcs__options(), legacy)){ TTCN_Logger::log_logmatch_info(".vbs_vgcs_options"); single_value->field_vbs__vgcs__options.log_match(match_value.vbs__vgcs__options(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_dtm__support.match(match_value.dtm__support(), legacy)){ TTCN_Logger::log_logmatch_info(".dtm_support"); single_value->field_dtm__support.log_match(match_value.dtm__support(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.rac().ispresent()){ if(!single_value->field_rac.match(match_value.rac(), legacy)){ TTCN_Logger::log_logmatch_info(".rac"); single_value->field_rac.log_match(match_value.rac(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_rac.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".rac := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_rac.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if (match_value.max__lapdm().ispresent()){ if(!single_value->field_max__lapdm.match(match_value.max__lapdm(), legacy)){ TTCN_Logger::log_logmatch_info(".max_lapdm"); single_value->field_max__lapdm.log_match(match_value.max__lapdm(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_max__lapdm.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".max_lapdm := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_max__lapdm.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if(!single_value->field_band__ind.match(match_value.band__ind(), legacy)){ TTCN_Logger::log_logmatch_info(".band_ind"); single_value->field_band__ind.log_match(match_value.band__ind(), 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("{ pch_nch_info := "); single_value->field_pch__nch__info.log_match(match_value.pch__nch__info(), legacy); TTCN_Logger::log_event_str(", vbs_vgcs_options := "); single_value->field_vbs__vgcs__options.log_match(match_value.vbs__vgcs__options(), legacy); TTCN_Logger::log_event_str(", dtm_support := "); single_value->field_dtm__support.log_match(match_value.dtm__support(), legacy); TTCN_Logger::log_event_str(", rac := "); if (match_value.rac().ispresent()) { single_value->field_rac.log_match(match_value.rac(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_rac.log(); if (single_value->field_rac.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", max_lapdm := "); if (match_value.max__lapdm().ispresent()) { single_value->field_max__lapdm.log_match(match_value.max__lapdm(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_max__lapdm.log(); if (single_value->field_max__lapdm.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", band_ind := "); single_value->field_band__ind.log_match(match_value.band__ind(), 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 SI6RestOctets_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (pch__nch__info().is_bound()) pch__nch__info().set_implicit_omit(); if (vbs__vgcs__options().is_bound()) vbs__vgcs__options().set_implicit_omit(); if (dtm__support().is_bound()) dtm__support().set_implicit_omit(); if (!rac().is_bound()) rac() = OMIT_VALUE; else rac().set_implicit_omit(); if (!max__lapdm().is_bound()) max__lapdm() = OMIT_VALUE; else max__lapdm().set_implicit_omit(); if (band__ind().is_bound()) band__ind().set_implicit_omit(); } void SI6RestOctets_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_pch__nch__info.encode_text(text_buf); single_value->field_vbs__vgcs__options.encode_text(text_buf); single_value->field_dtm__support.encode_text(text_buf); single_value->field_rac.encode_text(text_buf); single_value->field_max__lapdm.encode_text(text_buf); single_value->field_band__ind.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.SI6RestOctets."); } } void SI6RestOctets_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_pch__nch__info.decode_text(text_buf); single_value->field_vbs__vgcs__options.decode_text(text_buf); single_value->field_dtm__support.decode_text(text_buf); single_value->field_rac.decode_text(text_buf); single_value->field_max__lapdm.decode_text(text_buf); single_value->field_band__ind.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 SI6RestOctets_template[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.SI6RestOctets."); } } void SI6RestOctets_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: { SI6RestOctets_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) pch__nch__info().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) vbs__vgcs__options().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) dtm__support().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) rac().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) max__lapdm().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) band__ind().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(), "pch_nch_info")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { pch__nch__info().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "vbs_vgcs_options")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { vbs__vgcs__options().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "dtm_support")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { dtm__support().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "rac")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rac().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "max_lapdm")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { max__lapdm().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "band_ind")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { band__ind().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.SI6RestOctets: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { SI6RestOctets_template* precondition = new SI6RestOctets_template; precondition->set_param(*param.get_elem(0)); SI6RestOctets_template* implied_template = new SI6RestOctets_template; implied_template->set_param(*param.get_elem(1)); *this = SI6RestOctets_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.SI6RestOctets"); } is_ifpresent = param.get_ifpresent(); } void SI6RestOctets_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_pch__nch__info.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI6RestOctets"); single_value->field_vbs__vgcs__options.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI6RestOctets"); single_value->field_dtm__support.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI6RestOctets"); single_value->field_rac.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI6RestOctets"); single_value->field_max__lapdm.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI6RestOctets"); single_value->field_band__ind.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI6RestOctets"); 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.SI6RestOctets"); } boolean SI6RestOctets_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean SI6RestOctets_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_si13__change__mark, const OPTIONAL< RLCMAC__CSN1__Types::GprsMobileAllocation >& par_gprs__ma, const BITSTRING& par_zero, const INTEGER& par_rac, const BITSTRING& par_spgc__ccch__sup, const BITSTRING& par_priority__access__thr, const BITSTRING& par_network__control__order, const RLCMAC__CSN1__Types::GprsCellOptions& par_gprs__cell__opts, const RLCMAC__CSN1__Types::GprsPowerControlParameters& par_gprs__pwr__ctrl__params) : field_presence(par_presence), field_bcch__change__mark(par_bcch__change__mark), field_si__change__field(par_si__change__field), field_presence2(par_presence2), field_si13__change__mark(par_si13__change__mark), field_gprs__ma(par_gprs__ma), field_zero(par_zero), field_rac(par_rac), field_spgc__ccch__sup(par_spgc__ccch__sup), field_priority__access__thr(par_priority__access__thr), field_network__control__order(par_network__control__order), field_gprs__cell__opts(par_gprs__cell__opts), field_gprs__pwr__ctrl__params(par_gprs__pwr__ctrl__params) { } SI13RestOctets::SI13RestOctets(const SI13RestOctets& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.SI13RestOctets."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.bcch__change__mark().is_bound()) field_bcch__change__mark = other_value.bcch__change__mark(); else field_bcch__change__mark.clean_up(); if (other_value.si__change__field().is_bound()) field_si__change__field = other_value.si__change__field(); else field_si__change__field.clean_up(); if (other_value.presence2().is_bound()) field_presence2 = other_value.presence2(); else field_presence2.clean_up(); if (other_value.si13__change__mark().is_bound()) field_si13__change__mark = other_value.si13__change__mark(); else field_si13__change__mark.clean_up(); if (other_value.gprs__ma().is_bound()) field_gprs__ma = other_value.gprs__ma(); else field_gprs__ma.clean_up(); if (other_value.zero().is_bound()) field_zero = other_value.zero(); else field_zero.clean_up(); if (other_value.rac().is_bound()) field_rac = other_value.rac(); else field_rac.clean_up(); if (other_value.spgc__ccch__sup().is_bound()) field_spgc__ccch__sup = other_value.spgc__ccch__sup(); else field_spgc__ccch__sup.clean_up(); if (other_value.priority__access__thr().is_bound()) field_priority__access__thr = other_value.priority__access__thr(); else field_priority__access__thr.clean_up(); if (other_value.network__control__order().is_bound()) field_network__control__order = other_value.network__control__order(); else field_network__control__order.clean_up(); if (other_value.gprs__cell__opts().is_bound()) field_gprs__cell__opts = other_value.gprs__cell__opts(); else field_gprs__cell__opts.clean_up(); if (other_value.gprs__pwr__ctrl__params().is_bound()) field_gprs__pwr__ctrl__params = other_value.gprs__pwr__ctrl__params(); else field_gprs__pwr__ctrl__params.clean_up(); } void SI13RestOctets::clean_up() { field_presence.clean_up(); field_bcch__change__mark.clean_up(); field_si__change__field.clean_up(); field_presence2.clean_up(); field_si13__change__mark.clean_up(); field_gprs__ma.clean_up(); field_zero.clean_up(); field_rac.clean_up(); field_spgc__ccch__sup.clean_up(); field_priority__access__thr.clean_up(); field_network__control__order.clean_up(); field_gprs__cell__opts.clean_up(); field_gprs__pwr__ctrl__params.clean_up(); } const TTCN_Typedescriptor_t* SI13RestOctets::get_descriptor() const { return &SI13RestOctets_descr_; } SI13RestOctets& SI13RestOctets::operator=(const SI13RestOctets& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.SI13RestOctets."); if (other_value.presence().is_bound()) field_presence = other_value.presence(); else field_presence.clean_up(); if (other_value.bcch__change__mark().is_bound()) field_bcch__change__mark = other_value.bcch__change__mark(); else field_bcch__change__mark.clean_up(); if (other_value.si__change__field().is_bound()) field_si__change__field = other_value.si__change__field(); else field_si__change__field.clean_up(); if (other_value.presence2().is_bound()) field_presence2 = other_value.presence2(); else field_presence2.clean_up(); if (other_value.si13__change__mark().is_bound()) field_si13__change__mark = other_value.si13__change__mark(); else field_si13__change__mark.clean_up(); if (other_value.gprs__ma().is_bound()) field_gprs__ma = other_value.gprs__ma(); else field_gprs__ma.clean_up(); if (other_value.zero().is_bound()) field_zero = other_value.zero(); else field_zero.clean_up(); if (other_value.rac().is_bound()) field_rac = other_value.rac(); else field_rac.clean_up(); if (other_value.spgc__ccch__sup().is_bound()) field_spgc__ccch__sup = other_value.spgc__ccch__sup(); else field_spgc__ccch__sup.clean_up(); if (other_value.priority__access__thr().is_bound()) field_priority__access__thr = other_value.priority__access__thr(); else field_priority__access__thr.clean_up(); if (other_value.network__control__order().is_bound()) field_network__control__order = other_value.network__control__order(); else field_network__control__order.clean_up(); if (other_value.gprs__cell__opts().is_bound()) field_gprs__cell__opts = other_value.gprs__cell__opts(); else field_gprs__cell__opts.clean_up(); if (other_value.gprs__pwr__ctrl__params().is_bound()) field_gprs__pwr__ctrl__params = other_value.gprs__pwr__ctrl__params(); else field_gprs__pwr__ctrl__params.clean_up(); } return *this; } boolean SI13RestOctets::operator==(const SI13RestOctets& other_value) const { return field_presence==other_value.field_presence && field_bcch__change__mark==other_value.field_bcch__change__mark && field_si__change__field==other_value.field_si__change__field && field_presence2==other_value.field_presence2 && field_si13__change__mark==other_value.field_si13__change__mark && field_gprs__ma==other_value.field_gprs__ma && field_zero==other_value.field_zero && field_rac==other_value.field_rac && field_spgc__ccch__sup==other_value.field_spgc__ccch__sup && field_priority__access__thr==other_value.field_priority__access__thr && field_network__control__order==other_value.field_network__control__order && field_gprs__cell__opts==other_value.field_gprs__cell__opts && field_gprs__pwr__ctrl__params==other_value.field_gprs__pwr__ctrl__params; } boolean SI13RestOctets::is_bound() const { return (field_presence.is_bound()) || (field_bcch__change__mark.is_bound()) || (field_si__change__field.is_bound()) || (field_presence2.is_bound()) || (OPTIONAL_OMIT == field_si13__change__mark.get_selection() || field_si13__change__mark.is_bound()) || (OPTIONAL_OMIT == field_gprs__ma.get_selection() || field_gprs__ma.is_bound()) || (field_zero.is_bound()) || (field_rac.is_bound()) || (field_spgc__ccch__sup.is_bound()) || (field_priority__access__thr.is_bound()) || (field_network__control__order.is_bound()) || (field_gprs__cell__opts.is_bound()) || (field_gprs__pwr__ctrl__params.is_bound()); } boolean SI13RestOctets::is_value() const { return field_presence.is_value() && field_bcch__change__mark.is_value() && field_si__change__field.is_value() && field_presence2.is_value() && (OPTIONAL_OMIT == field_si13__change__mark.get_selection() || field_si13__change__mark.is_value()) && (OPTIONAL_OMIT == field_gprs__ma.get_selection() || field_gprs__ma.is_value()) && field_zero.is_value() && field_rac.is_value() && field_spgc__ccch__sup.is_value() && field_priority__access__thr.is_value() && field_network__control__order.is_value() && field_gprs__cell__opts.is_value() && field_gprs__pwr__ctrl__params.is_value(); } int SI13RestOctets::size_of() const { int ret_val = 11; if (field_si13__change__mark.ispresent()) ret_val++; if (field_gprs__ma.ispresent()) ret_val++; return ret_val; } void SI13RestOctets::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(", bcch_change_mark := "); field_bcch__change__mark.log(); TTCN_Logger::log_event_str(", si_change_field := "); field_si__change__field.log(); TTCN_Logger::log_event_str(", presence2 := "); field_presence2.log(); TTCN_Logger::log_event_str(", si13_change_mark := "); field_si13__change__mark.log(); TTCN_Logger::log_event_str(", gprs_ma := "); field_gprs__ma.log(); TTCN_Logger::log_event_str(", zero := "); field_zero.log(); TTCN_Logger::log_event_str(", rac := "); field_rac.log(); TTCN_Logger::log_event_str(", spgc_ccch_sup := "); field_spgc__ccch__sup.log(); TTCN_Logger::log_event_str(", priority_access_thr := "); field_priority__access__thr.log(); TTCN_Logger::log_event_str(", network_control_order := "); field_network__control__order.log(); TTCN_Logger::log_event_str(", gprs_cell_opts := "); field_gprs__cell__opts.log(); TTCN_Logger::log_event_str(", gprs_pwr_ctrl_params := "); field_gprs__pwr__ctrl__params.log(); TTCN_Logger::log_event_str(" }"); } void SI13RestOctets::set_implicit_omit() { if (presence().is_bound()) presence().set_implicit_omit(); if (bcch__change__mark().is_bound()) bcch__change__mark().set_implicit_omit(); if (si__change__field().is_bound()) si__change__field().set_implicit_omit(); if (presence2().is_bound()) presence2().set_implicit_omit(); if (!si13__change__mark().is_bound()) si13__change__mark() = OMIT_VALUE; else si13__change__mark().set_implicit_omit(); if (!gprs__ma().is_bound()) gprs__ma() = OMIT_VALUE; else gprs__ma().set_implicit_omit(); if (zero().is_bound()) zero().set_implicit_omit(); if (rac().is_bound()) rac().set_implicit_omit(); if (spgc__ccch__sup().is_bound()) spgc__ccch__sup().set_implicit_omit(); if (priority__access__thr().is_bound()) priority__access__thr().set_implicit_omit(); if (network__control__order().is_bound()) network__control__order().set_implicit_omit(); if (gprs__cell__opts().is_bound()) gprs__cell__opts().set_implicit_omit(); if (gprs__pwr__ctrl__params().is_bound()) gprs__pwr__ctrl__params().set_implicit_omit(); } void SI13RestOctets::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 (130 && 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) bcch__change__mark().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) si__change__field().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) presence2().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) si13__change__mark().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) gprs__ma().set_param(*param.get_elem(5)); if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) zero().set_param(*param.get_elem(6)); if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) rac().set_param(*param.get_elem(7)); if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) spgc__ccch__sup().set_param(*param.get_elem(8)); if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) priority__access__thr().set_param(*param.get_elem(9)); if (param.get_size()>10 && param.get_elem(10)->get_type()!=Module_Param::MP_NotUsed) network__control__order().set_param(*param.get_elem(10)); if (param.get_size()>11 && param.get_elem(11)->get_type()!=Module_Param::MP_NotUsed) gprs__cell__opts().set_param(*param.get_elem(11)); if (param.get_size()>12 && param.get_elem(12)->get_type()!=Module_Param::MP_NotUsed) gprs__pwr__ctrl__params().set_param(*param.get_elem(12)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "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(), "bcch_change_mark")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { bcch__change__mark().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "si_change_field")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { si__change__field().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "presence2")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { presence2().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "si13_change_mark")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { si13__change__mark().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "gprs_ma")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { gprs__ma().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "zero")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { zero().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "rac")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rac().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "spgc_ccch_sup")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spgc__ccch__sup().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "priority_access_thr")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { priority__access__thr().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "network_control_order")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { network__control__order().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "gprs_cell_opts")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { gprs__cell__opts().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "gprs_pwr_ctrl_params")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { gprs__pwr__ctrl__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.SI13RestOctets: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.SI13RestOctets"); } } void SI13RestOctets::encode_text(Text_Buf& text_buf) const { field_presence.encode_text(text_buf); field_bcch__change__mark.encode_text(text_buf); field_si__change__field.encode_text(text_buf); field_presence2.encode_text(text_buf); field_si13__change__mark.encode_text(text_buf); field_gprs__ma.encode_text(text_buf); field_zero.encode_text(text_buf); field_rac.encode_text(text_buf); field_spgc__ccch__sup.encode_text(text_buf); field_priority__access__thr.encode_text(text_buf); field_network__control__order.encode_text(text_buf); field_gprs__cell__opts.encode_text(text_buf); field_gprs__pwr__ctrl__params.encode_text(text_buf); } void SI13RestOctets::decode_text(Text_Buf& text_buf) { field_presence.decode_text(text_buf); field_bcch__change__mark.decode_text(text_buf); field_si__change__field.decode_text(text_buf); field_presence2.decode_text(text_buf); field_si13__change__mark.decode_text(text_buf); field_gprs__ma.decode_text(text_buf); field_zero.decode_text(text_buf); field_rac.decode_text(text_buf); field_spgc__ccch__sup.decode_text(text_buf); field_priority__access__thr.decode_text(text_buf); field_network__control__order.decode_text(text_buf); field_gprs__cell__opts.decode_text(text_buf); field_gprs__pwr__ctrl__params.decode_text(text_buf); } void SI13RestOctets::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 SI13RestOctets::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 SI13RestOctets::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, SI13RestOctets_presence_descr_.raw->forceomit); decoded_field_length = field_presence.RAW_decode(SI13RestOctets_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()); RAW_Force_Omit field_1_force_omit(1, force_omit, SI13RestOctets_bcch__change__mark_descr_.raw->forceomit); decoded_field_length = field_bcch__change__mark.RAW_decode(SI13RestOctets_bcch__change__mark_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, SI13RestOctets_si__change__field_descr_.raw->forceomit); decoded_field_length = field_si__change__field.RAW_decode(SI13RestOctets_si__change__field_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, SI13RestOctets_presence2_descr_.raw->forceomit); decoded_field_length = field_presence2.RAW_decode(SI13RestOctets_presence2_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_presence2 == bs_0){ if (force_omit != NULL && (*force_omit)(4)) { field_si13__change__mark = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_4_force_omit(4, force_omit, SI13RestOctets_si13__change__mark_descr_.raw->forceomit); decoded_field_length = field_si13__change__mark().RAW_decode(SI13RestOctets_si13__change__mark_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_4_force_omit); if (decoded_field_length < 1) { field_si13__change__mark = 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_si13__change__mark=OMIT_VALUE; if (limit > 0 && field_presence2 == bs_0){ if (force_omit != NULL && (*force_omit)(5)) { field_gprs__ma = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_5_force_omit(5, force_omit, SI13RestOctets_gprs__ma_descr_.raw->forceomit); decoded_field_length = field_gprs__ma().RAW_decode(SI13RestOctets_gprs__ma_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_5_force_omit); if (decoded_field_length < 1) { field_gprs__ma = 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_gprs__ma=OMIT_VALUE; RAW_Force_Omit field_6_force_omit(6, force_omit, SI13RestOctets_zero_descr_.raw->forceomit); decoded_field_length = field_zero.RAW_decode(SI13RestOctets_zero_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_6_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); RAW_Force_Omit field_7_force_omit(7, force_omit, SI13RestOctets_rac_descr_.raw->forceomit); decoded_field_length = field_rac.RAW_decode(SI13RestOctets_rac_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_7_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); RAW_Force_Omit field_8_force_omit(8, force_omit, SI13RestOctets_spgc__ccch__sup_descr_.raw->forceomit); decoded_field_length = field_spgc__ccch__sup.RAW_decode(SI13RestOctets_spgc__ccch__sup_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()); RAW_Force_Omit field_9_force_omit(9, force_omit, SI13RestOctets_priority__access__thr_descr_.raw->forceomit); decoded_field_length = field_priority__access__thr.RAW_decode(SI13RestOctets_priority__access__thr_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_9_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); RAW_Force_Omit field_10_force_omit(10, force_omit, SI13RestOctets_network__control__order_descr_.raw->forceomit); decoded_field_length = field_network__control__order.RAW_decode(SI13RestOctets_network__control__order_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()); RAW_Force_Omit field_11_force_omit(11, force_omit, SI13RestOctets_gprs__cell__opts_descr_.raw->forceomit); decoded_field_length = field_gprs__cell__opts.RAW_decode(SI13RestOctets_gprs__cell__opts_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_11_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); RAW_Force_Omit field_12_force_omit(12, force_omit, SI13RestOctets_gprs__pwr__ctrl__params_descr_.raw->forceomit); decoded_field_length = field_gprs__pwr__ctrl__params.RAW_decode(SI13RestOctets_gprs__pwr__ctrl__params_descr_, p_buf, limit, local_top_order, no_err, -1, TRUE, &field_12_force_omit); if (decoded_field_length < 0) return decoded_field_length; decoded_length+=decoded_field_length; limit-=decoded_field_length; last_decoded_pos=bigger(last_decoded_pos, p_buf.get_pos_bit()); p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int SI13RestOctets::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const { if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value."); int encoded_length = 0; myleaf.isleaf = FALSE; myleaf.body.node.num_of_nodes = 13; myleaf.body.node.nodes = init_nodes_of_enc_tree(13); myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, SI13RestOctets_presence_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, SI13RestOctets_bcch__change__mark_descr_.raw); myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, SI13RestOctets_si__change__field_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, SI13RestOctets_presence2_descr_.raw); if (field_si13__change__mark.ispresent()) { myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, SI13RestOctets_si13__change__mark_descr_.raw); } else myleaf.body.node.nodes[4] = NULL; if (field_gprs__ma.ispresent()) { myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, SI13RestOctets_gprs__ma_descr_.raw); } else myleaf.body.node.nodes[5] = NULL; myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, SI13RestOctets_zero_descr_.raw); myleaf.body.node.nodes[7] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 7, SI13RestOctets_rac_descr_.raw); myleaf.body.node.nodes[8] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 8, SI13RestOctets_spgc__ccch__sup_descr_.raw); myleaf.body.node.nodes[9] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 9, SI13RestOctets_priority__access__thr_descr_.raw); myleaf.body.node.nodes[10] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 10, SI13RestOctets_network__control__order_descr_.raw); myleaf.body.node.nodes[11] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 11, SI13RestOctets_gprs__cell__opts_descr_.raw); myleaf.body.node.nodes[12] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 12, SI13RestOctets_gprs__pwr__ctrl__params_descr_.raw); encoded_length += field_presence.RAW_encode(SI13RestOctets_presence_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_bcch__change__mark.RAW_encode(SI13RestOctets_bcch__change__mark_descr_, *myleaf.body.node.nodes[1]); encoded_length += field_si__change__field.RAW_encode(SI13RestOctets_si__change__field_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_presence2.RAW_encode(SI13RestOctets_presence2_descr_, *myleaf.body.node.nodes[3]); if (field_si13__change__mark.ispresent()) { encoded_length += field_si13__change__mark().RAW_encode(SI13RestOctets_si13__change__mark_descr_, *myleaf.body.node.nodes[4]); } if (field_gprs__ma.ispresent()) { encoded_length += field_gprs__ma().RAW_encode(SI13RestOctets_gprs__ma_descr_, *myleaf.body.node.nodes[5]); } encoded_length += field_zero.RAW_encode(SI13RestOctets_zero_descr_, *myleaf.body.node.nodes[6]); encoded_length += field_rac.RAW_encode(SI13RestOctets_rac_descr_, *myleaf.body.node.nodes[7]); encoded_length += field_spgc__ccch__sup.RAW_encode(SI13RestOctets_spgc__ccch__sup_descr_, *myleaf.body.node.nodes[8]); encoded_length += field_priority__access__thr.RAW_encode(SI13RestOctets_priority__access__thr_descr_, *myleaf.body.node.nodes[9]); encoded_length += field_network__control__order.RAW_encode(SI13RestOctets_network__control__order_descr_, *myleaf.body.node.nodes[10]); encoded_length += field_gprs__cell__opts.RAW_encode(SI13RestOctets_gprs__cell__opts_descr_, *myleaf.body.node.nodes[11]); encoded_length += field_gprs__pwr__ctrl__params.RAW_encode(SI13RestOctets_gprs__pwr__ctrl__params_descr_, *myleaf.body.node.nodes[12]); if (field_si13__change__mark.ispresent() && (field_presence2 != 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(SI13RestOctets_presence2_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_gprs__ma.ispresent() && (field_presence2 != 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(SI13RestOctets_presence2_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 SI13RestOctets_template::single_value_struct { BITSTRING_template field_presence; INTEGER_template field_bcch__change__mark; BITSTRING_template field_si__change__field; BITSTRING_template field_presence2; BITSTRING_template field_si13__change__mark; RLCMAC__CSN1__Types::GprsMobileAllocation_template field_gprs__ma; BITSTRING_template field_zero; INTEGER_template field_rac; BITSTRING_template field_spgc__ccch__sup; BITSTRING_template field_priority__access__thr; BITSTRING_template field_network__control__order; RLCMAC__CSN1__Types::GprsCellOptions_template field_gprs__cell__opts; RLCMAC__CSN1__Types::GprsPowerControlParameters_template field_gprs__pwr__ctrl__params; }; void SI13RestOctets_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_bcch__change__mark = ANY_VALUE; single_value->field_si__change__field = ANY_VALUE; single_value->field_presence2 = ANY_VALUE; single_value->field_si13__change__mark = ANY_OR_OMIT; single_value->field_gprs__ma = ANY_OR_OMIT; single_value->field_zero = ANY_VALUE; single_value->field_rac = ANY_VALUE; single_value->field_spgc__ccch__sup = ANY_VALUE; single_value->field_priority__access__thr = ANY_VALUE; single_value->field_network__control__order = ANY_VALUE; single_value->field_gprs__cell__opts = ANY_VALUE; single_value->field_gprs__pwr__ctrl__params = ANY_VALUE; } } } void SI13RestOctets_template::copy_value(const SI13RestOctets& 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.bcch__change__mark().is_bound()) { single_value->field_bcch__change__mark = other_value.bcch__change__mark(); } else { single_value->field_bcch__change__mark.clean_up(); } if (other_value.si__change__field().is_bound()) { single_value->field_si__change__field = other_value.si__change__field(); } else { single_value->field_si__change__field.clean_up(); } if (other_value.presence2().is_bound()) { single_value->field_presence2 = other_value.presence2(); } else { single_value->field_presence2.clean_up(); } if (other_value.si13__change__mark().is_bound()) { if (other_value.si13__change__mark().ispresent()) single_value->field_si13__change__mark = other_value.si13__change__mark()(); else single_value->field_si13__change__mark = OMIT_VALUE; } else { single_value->field_si13__change__mark.clean_up(); } if (other_value.gprs__ma().is_bound()) { if (other_value.gprs__ma().ispresent()) single_value->field_gprs__ma = other_value.gprs__ma()(); else single_value->field_gprs__ma = OMIT_VALUE; } else { single_value->field_gprs__ma.clean_up(); } if (other_value.zero().is_bound()) { single_value->field_zero = other_value.zero(); } else { single_value->field_zero.clean_up(); } if (other_value.rac().is_bound()) { single_value->field_rac = other_value.rac(); } else { single_value->field_rac.clean_up(); } if (other_value.spgc__ccch__sup().is_bound()) { single_value->field_spgc__ccch__sup = other_value.spgc__ccch__sup(); } else { single_value->field_spgc__ccch__sup.clean_up(); } if (other_value.priority__access__thr().is_bound()) { single_value->field_priority__access__thr = other_value.priority__access__thr(); } else { single_value->field_priority__access__thr.clean_up(); } if (other_value.network__control__order().is_bound()) { single_value->field_network__control__order = other_value.network__control__order(); } else { single_value->field_network__control__order.clean_up(); } if (other_value.gprs__cell__opts().is_bound()) { single_value->field_gprs__cell__opts = other_value.gprs__cell__opts(); } else { single_value->field_gprs__cell__opts.clean_up(); } if (other_value.gprs__pwr__ctrl__params().is_bound()) { single_value->field_gprs__pwr__ctrl__params = other_value.gprs__pwr__ctrl__params(); } else { single_value->field_gprs__pwr__ctrl__params.clean_up(); } set_selection(SPECIFIC_VALUE); } void SI13RestOctets_template::copy_template(const SI13RestOctets_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.bcch__change__mark().get_selection()) { single_value->field_bcch__change__mark = other_value.bcch__change__mark(); } else { single_value->field_bcch__change__mark.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.si__change__field().get_selection()) { single_value->field_si__change__field = other_value.si__change__field(); } else { single_value->field_si__change__field.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.presence2().get_selection()) { single_value->field_presence2 = other_value.presence2(); } else { single_value->field_presence2.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.si13__change__mark().get_selection()) { single_value->field_si13__change__mark = other_value.si13__change__mark(); } else { single_value->field_si13__change__mark.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.gprs__ma().get_selection()) { single_value->field_gprs__ma = other_value.gprs__ma(); } else { single_value->field_gprs__ma.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.zero().get_selection()) { single_value->field_zero = other_value.zero(); } else { single_value->field_zero.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.rac().get_selection()) { single_value->field_rac = other_value.rac(); } else { single_value->field_rac.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.spgc__ccch__sup().get_selection()) { single_value->field_spgc__ccch__sup = other_value.spgc__ccch__sup(); } else { single_value->field_spgc__ccch__sup.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.priority__access__thr().get_selection()) { single_value->field_priority__access__thr = other_value.priority__access__thr(); } else { single_value->field_priority__access__thr.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.network__control__order().get_selection()) { single_value->field_network__control__order = other_value.network__control__order(); } else { single_value->field_network__control__order.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.gprs__cell__opts().get_selection()) { single_value->field_gprs__cell__opts = other_value.gprs__cell__opts(); } else { single_value->field_gprs__cell__opts.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.gprs__pwr__ctrl__params().get_selection()) { single_value->field_gprs__pwr__ctrl__params = other_value.gprs__pwr__ctrl__params(); } else { single_value->field_gprs__pwr__ctrl__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 SI13RestOctets_template[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 SI13RestOctets_template(*other_value.implication_.precondition); implication_.implied_template = new SI13RestOctets_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.SI13RestOctets."); break; } set_selection(other_value); } SI13RestOctets_template::SI13RestOctets_template() { } SI13RestOctets_template::SI13RestOctets_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } SI13RestOctets_template::SI13RestOctets_template(const SI13RestOctets& other_value) { copy_value(other_value); } SI13RestOctets_template::SI13RestOctets_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI13RestOctets&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.SI13RestOctets from an unbound optional field."); } } SI13RestOctets_template::SI13RestOctets_template(SI13RestOctets_template* p_precondition, SI13RestOctets_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } SI13RestOctets_template::SI13RestOctets_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; } SI13RestOctets_template::SI13RestOctets_template(const SI13RestOctets_template& other_value) : Base_Template() { copy_template(other_value); } SI13RestOctets_template::~SI13RestOctets_template() { clean_up(); } SI13RestOctets_template& SI13RestOctets_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } SI13RestOctets_template& SI13RestOctets_template::operator=(const SI13RestOctets& other_value) { clean_up(); copy_value(other_value); return *this; } SI13RestOctets_template& SI13RestOctets_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI13RestOctets&)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.SI13RestOctets."); } return *this; } SI13RestOctets_template& SI13RestOctets_template::operator=(const SI13RestOctets_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean SI13RestOctets_template::match(const SI13RestOctets& 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.bcch__change__mark().is_bound()) return FALSE; if(!single_value->field_bcch__change__mark.match(other_value.bcch__change__mark(), legacy))return FALSE; if(!other_value.si__change__field().is_bound()) return FALSE; if(!single_value->field_si__change__field.match(other_value.si__change__field(), legacy))return FALSE; if(!other_value.presence2().is_bound()) return FALSE; if(!single_value->field_presence2.match(other_value.presence2(), legacy))return FALSE; if(!other_value.si13__change__mark().is_bound()) return FALSE; if((other_value.si13__change__mark().ispresent() ? !single_value->field_si13__change__mark.match((const BITSTRING&)other_value.si13__change__mark(), legacy) : !single_value->field_si13__change__mark.match_omit(legacy)))return FALSE; if(!other_value.gprs__ma().is_bound()) return FALSE; if((other_value.gprs__ma().ispresent() ? !single_value->field_gprs__ma.match((const RLCMAC__CSN1__Types::GprsMobileAllocation&)other_value.gprs__ma(), legacy) : !single_value->field_gprs__ma.match_omit(legacy)))return FALSE; if(!other_value.zero().is_bound()) return FALSE; if(!single_value->field_zero.match(other_value.zero(), legacy))return FALSE; if(!other_value.rac().is_bound()) return FALSE; if(!single_value->field_rac.match(other_value.rac(), legacy))return FALSE; if(!other_value.spgc__ccch__sup().is_bound()) return FALSE; if(!single_value->field_spgc__ccch__sup.match(other_value.spgc__ccch__sup(), legacy))return FALSE; if(!other_value.priority__access__thr().is_bound()) return FALSE; if(!single_value->field_priority__access__thr.match(other_value.priority__access__thr(), legacy))return FALSE; if(!other_value.network__control__order().is_bound()) return FALSE; if(!single_value->field_network__control__order.match(other_value.network__control__order(), legacy))return FALSE; if(!other_value.gprs__cell__opts().is_bound()) return FALSE; if(!single_value->field_gprs__cell__opts.match(other_value.gprs__cell__opts(), legacy))return FALSE; if(!other_value.gprs__pwr__ctrl__params().is_bound()) return FALSE; if(!single_value->field_gprs__pwr__ctrl__params.match(other_value.gprs__pwr__ctrl__params(), 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.SI13RestOctets."); } return FALSE; } boolean SI13RestOctets_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_bcch__change__mark.is_bound() || single_value->field_si__change__field.is_bound() || single_value->field_presence2.is_bound() || (single_value->field_si13__change__mark.is_omit() || single_value->field_si13__change__mark.is_bound()) || (single_value->field_gprs__ma.is_omit() || single_value->field_gprs__ma.is_bound()) || single_value->field_zero.is_bound() || single_value->field_rac.is_bound() || single_value->field_spgc__ccch__sup.is_bound() || single_value->field_priority__access__thr.is_bound() || single_value->field_network__control__order.is_bound() || single_value->field_gprs__cell__opts.is_bound() || single_value->field_gprs__pwr__ctrl__params.is_bound(); } boolean SI13RestOctets_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_presence.is_value() && single_value->field_bcch__change__mark.is_value() && single_value->field_si__change__field.is_value() && single_value->field_presence2.is_value() && (single_value->field_si13__change__mark.is_omit() || single_value->field_si13__change__mark.is_value()) && (single_value->field_gprs__ma.is_omit() || single_value->field_gprs__ma.is_value()) && single_value->field_zero.is_value() && single_value->field_rac.is_value() && single_value->field_spgc__ccch__sup.is_value() && single_value->field_priority__access__thr.is_value() && single_value->field_network__control__order.is_value() && single_value->field_gprs__cell__opts.is_value() && single_value->field_gprs__pwr__ctrl__params.is_value(); } void SI13RestOctets_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; } SI13RestOctets SI13RestOctets_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.SI13RestOctets."); SI13RestOctets ret_val; if (single_value->field_presence.is_bound()) { ret_val.presence() = single_value->field_presence.valueof(); } if (single_value->field_bcch__change__mark.is_bound()) { ret_val.bcch__change__mark() = single_value->field_bcch__change__mark.valueof(); } if (single_value->field_si__change__field.is_bound()) { ret_val.si__change__field() = single_value->field_si__change__field.valueof(); } if (single_value->field_presence2.is_bound()) { ret_val.presence2() = single_value->field_presence2.valueof(); } if (single_value->field_si13__change__mark.is_omit()) ret_val.si13__change__mark() = OMIT_VALUE; else if (single_value->field_si13__change__mark.is_bound()) { ret_val.si13__change__mark() = single_value->field_si13__change__mark.valueof(); } if (single_value->field_gprs__ma.is_omit()) ret_val.gprs__ma() = OMIT_VALUE; else if (single_value->field_gprs__ma.is_bound()) { ret_val.gprs__ma() = single_value->field_gprs__ma.valueof(); } if (single_value->field_zero.is_bound()) { ret_val.zero() = single_value->field_zero.valueof(); } if (single_value->field_rac.is_bound()) { ret_val.rac() = single_value->field_rac.valueof(); } if (single_value->field_spgc__ccch__sup.is_bound()) { ret_val.spgc__ccch__sup() = single_value->field_spgc__ccch__sup.valueof(); } if (single_value->field_priority__access__thr.is_bound()) { ret_val.priority__access__thr() = single_value->field_priority__access__thr.valueof(); } if (single_value->field_network__control__order.is_bound()) { ret_val.network__control__order() = single_value->field_network__control__order.valueof(); } if (single_value->field_gprs__cell__opts.is_bound()) { ret_val.gprs__cell__opts() = single_value->field_gprs__cell__opts.valueof(); } if (single_value->field_gprs__pwr__ctrl__params.is_bound()) { ret_val.gprs__pwr__ctrl__params() = single_value->field_gprs__pwr__ctrl__params.valueof(); } return ret_val; } void SI13RestOctets_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.SI13RestOctets."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new SI13RestOctets_template[list_length]; } SI13RestOctets_template& SI13RestOctets_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.SI13RestOctets."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.SI13RestOctets."); return value_list.list_value[list_index]; } BITSTRING_template& SI13RestOctets_template::presence() { set_specific(); return single_value->field_presence; } const BITSTRING_template& SI13RestOctets_template::presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field presence of a non-specific template of type @GSM_RestOctets.SI13RestOctets."); return single_value->field_presence; } INTEGER_template& SI13RestOctets_template::bcch__change__mark() { set_specific(); return single_value->field_bcch__change__mark; } const INTEGER_template& SI13RestOctets_template::bcch__change__mark() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field bcch_change_mark of a non-specific template of type @GSM_RestOctets.SI13RestOctets."); return single_value->field_bcch__change__mark; } BITSTRING_template& SI13RestOctets_template::si__change__field() { set_specific(); return single_value->field_si__change__field; } const BITSTRING_template& SI13RestOctets_template::si__change__field() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field si_change_field of a non-specific template of type @GSM_RestOctets.SI13RestOctets."); return single_value->field_si__change__field; } BITSTRING_template& SI13RestOctets_template::presence2() { set_specific(); return single_value->field_presence2; } const BITSTRING_template& SI13RestOctets_template::presence2() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field presence2 of a non-specific template of type @GSM_RestOctets.SI13RestOctets."); return single_value->field_presence2; } BITSTRING_template& SI13RestOctets_template::si13__change__mark() { set_specific(); return single_value->field_si13__change__mark; } const BITSTRING_template& SI13RestOctets_template::si13__change__mark() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field si13_change_mark of a non-specific template of type @GSM_RestOctets.SI13RestOctets."); return single_value->field_si13__change__mark; } RLCMAC__CSN1__Types::GprsMobileAllocation_template& SI13RestOctets_template::gprs__ma() { set_specific(); return single_value->field_gprs__ma; } const RLCMAC__CSN1__Types::GprsMobileAllocation_template& SI13RestOctets_template::gprs__ma() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field gprs_ma of a non-specific template of type @GSM_RestOctets.SI13RestOctets."); return single_value->field_gprs__ma; } BITSTRING_template& SI13RestOctets_template::zero() { set_specific(); return single_value->field_zero; } const BITSTRING_template& SI13RestOctets_template::zero() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field zero of a non-specific template of type @GSM_RestOctets.SI13RestOctets."); return single_value->field_zero; } INTEGER_template& SI13RestOctets_template::rac() { set_specific(); return single_value->field_rac; } const INTEGER_template& SI13RestOctets_template::rac() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field rac of a non-specific template of type @GSM_RestOctets.SI13RestOctets."); return single_value->field_rac; } BITSTRING_template& SI13RestOctets_template::spgc__ccch__sup() { set_specific(); return single_value->field_spgc__ccch__sup; } const BITSTRING_template& SI13RestOctets_template::spgc__ccch__sup() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field spgc_ccch_sup of a non-specific template of type @GSM_RestOctets.SI13RestOctets."); return single_value->field_spgc__ccch__sup; } BITSTRING_template& SI13RestOctets_template::priority__access__thr() { set_specific(); return single_value->field_priority__access__thr; } const BITSTRING_template& SI13RestOctets_template::priority__access__thr() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field priority_access_thr of a non-specific template of type @GSM_RestOctets.SI13RestOctets."); return single_value->field_priority__access__thr; } BITSTRING_template& SI13RestOctets_template::network__control__order() { set_specific(); return single_value->field_network__control__order; } const BITSTRING_template& SI13RestOctets_template::network__control__order() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field network_control_order of a non-specific template of type @GSM_RestOctets.SI13RestOctets."); return single_value->field_network__control__order; } RLCMAC__CSN1__Types::GprsCellOptions_template& SI13RestOctets_template::gprs__cell__opts() { set_specific(); return single_value->field_gprs__cell__opts; } const RLCMAC__CSN1__Types::GprsCellOptions_template& SI13RestOctets_template::gprs__cell__opts() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field gprs_cell_opts of a non-specific template of type @GSM_RestOctets.SI13RestOctets."); return single_value->field_gprs__cell__opts; } RLCMAC__CSN1__Types::GprsPowerControlParameters_template& SI13RestOctets_template::gprs__pwr__ctrl__params() { set_specific(); return single_value->field_gprs__pwr__ctrl__params; } const RLCMAC__CSN1__Types::GprsPowerControlParameters_template& SI13RestOctets_template::gprs__pwr__ctrl__params() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field gprs_pwr_ctrl_params of a non-specific template of type @GSM_RestOctets.SI13RestOctets."); return single_value->field_gprs__pwr__ctrl__params; } int SI13RestOctets_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI13RestOctets which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 11; if (single_value->field_si13__change__mark.is_present()) ret_val++; if (single_value->field_gprs__ma.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.SI13RestOctets 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.SI13RestOctets 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.SI13RestOctets containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI13RestOctets containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI13RestOctets containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI13RestOctets containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI13RestOctets containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI13RestOctets containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.SI13RestOctets."); } return 0; } void SI13RestOctets_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(", bcch_change_mark := "); single_value->field_bcch__change__mark.log(); TTCN_Logger::log_event_str(", si_change_field := "); single_value->field_si__change__field.log(); TTCN_Logger::log_event_str(", presence2 := "); single_value->field_presence2.log(); TTCN_Logger::log_event_str(", si13_change_mark := "); single_value->field_si13__change__mark.log(); TTCN_Logger::log_event_str(", gprs_ma := "); single_value->field_gprs__ma.log(); TTCN_Logger::log_event_str(", zero := "); single_value->field_zero.log(); TTCN_Logger::log_event_str(", rac := "); single_value->field_rac.log(); TTCN_Logger::log_event_str(", spgc_ccch_sup := "); single_value->field_spgc__ccch__sup.log(); TTCN_Logger::log_event_str(", priority_access_thr := "); single_value->field_priority__access__thr.log(); TTCN_Logger::log_event_str(", network_control_order := "); single_value->field_network__control__order.log(); TTCN_Logger::log_event_str(", gprs_cell_opts := "); single_value->field_gprs__cell__opts.log(); TTCN_Logger::log_event_str(", gprs_pwr_ctrl_params := "); single_value->field_gprs__pwr__ctrl__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 SI13RestOctets_template::log_match(const SI13RestOctets& 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(!single_value->field_bcch__change__mark.match(match_value.bcch__change__mark(), legacy)){ TTCN_Logger::log_logmatch_info(".bcch_change_mark"); single_value->field_bcch__change__mark.log_match(match_value.bcch__change__mark(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_si__change__field.match(match_value.si__change__field(), legacy)){ TTCN_Logger::log_logmatch_info(".si_change_field"); single_value->field_si__change__field.log_match(match_value.si__change__field(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_presence2.match(match_value.presence2(), legacy)){ TTCN_Logger::log_logmatch_info(".presence2"); single_value->field_presence2.log_match(match_value.presence2(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.si13__change__mark().ispresent()){ if(!single_value->field_si13__change__mark.match(match_value.si13__change__mark(), legacy)){ TTCN_Logger::log_logmatch_info(".si13_change_mark"); single_value->field_si13__change__mark.log_match(match_value.si13__change__mark(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_si13__change__mark.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".si13_change_mark := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_si13__change__mark.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if (match_value.gprs__ma().ispresent()){ if(!single_value->field_gprs__ma.match(match_value.gprs__ma(), legacy)){ TTCN_Logger::log_logmatch_info(".gprs_ma"); single_value->field_gprs__ma.log_match(match_value.gprs__ma(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_gprs__ma.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".gprs_ma := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_gprs__ma.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if(!single_value->field_zero.match(match_value.zero(), legacy)){ TTCN_Logger::log_logmatch_info(".zero"); single_value->field_zero.log_match(match_value.zero(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_rac.match(match_value.rac(), legacy)){ TTCN_Logger::log_logmatch_info(".rac"); single_value->field_rac.log_match(match_value.rac(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_spgc__ccch__sup.match(match_value.spgc__ccch__sup(), legacy)){ TTCN_Logger::log_logmatch_info(".spgc_ccch_sup"); single_value->field_spgc__ccch__sup.log_match(match_value.spgc__ccch__sup(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_priority__access__thr.match(match_value.priority__access__thr(), legacy)){ TTCN_Logger::log_logmatch_info(".priority_access_thr"); single_value->field_priority__access__thr.log_match(match_value.priority__access__thr(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_network__control__order.match(match_value.network__control__order(), legacy)){ TTCN_Logger::log_logmatch_info(".network_control_order"); single_value->field_network__control__order.log_match(match_value.network__control__order(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_gprs__cell__opts.match(match_value.gprs__cell__opts(), legacy)){ TTCN_Logger::log_logmatch_info(".gprs_cell_opts"); single_value->field_gprs__cell__opts.log_match(match_value.gprs__cell__opts(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_gprs__pwr__ctrl__params.match(match_value.gprs__pwr__ctrl__params(), legacy)){ TTCN_Logger::log_logmatch_info(".gprs_pwr_ctrl_params"); single_value->field_gprs__pwr__ctrl__params.log_match(match_value.gprs__pwr__ctrl__params(), 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("{ presence := "); single_value->field_presence.log_match(match_value.presence(), legacy); TTCN_Logger::log_event_str(", bcch_change_mark := "); single_value->field_bcch__change__mark.log_match(match_value.bcch__change__mark(), legacy); TTCN_Logger::log_event_str(", si_change_field := "); single_value->field_si__change__field.log_match(match_value.si__change__field(), legacy); TTCN_Logger::log_event_str(", presence2 := "); single_value->field_presence2.log_match(match_value.presence2(), legacy); TTCN_Logger::log_event_str(", si13_change_mark := "); if (match_value.si13__change__mark().ispresent()) { single_value->field_si13__change__mark.log_match(match_value.si13__change__mark(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_si13__change__mark.log(); if (single_value->field_si13__change__mark.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", gprs_ma := "); if (match_value.gprs__ma().ispresent()) { single_value->field_gprs__ma.log_match(match_value.gprs__ma(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_gprs__ma.log(); if (single_value->field_gprs__ma.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", zero := "); single_value->field_zero.log_match(match_value.zero(), legacy); TTCN_Logger::log_event_str(", rac := "); single_value->field_rac.log_match(match_value.rac(), legacy); TTCN_Logger::log_event_str(", spgc_ccch_sup := "); single_value->field_spgc__ccch__sup.log_match(match_value.spgc__ccch__sup(), legacy); TTCN_Logger::log_event_str(", priority_access_thr := "); single_value->field_priority__access__thr.log_match(match_value.priority__access__thr(), legacy); TTCN_Logger::log_event_str(", network_control_order := "); single_value->field_network__control__order.log_match(match_value.network__control__order(), legacy); TTCN_Logger::log_event_str(", gprs_cell_opts := "); single_value->field_gprs__cell__opts.log_match(match_value.gprs__cell__opts(), legacy); TTCN_Logger::log_event_str(", gprs_pwr_ctrl_params := "); single_value->field_gprs__pwr__ctrl__params.log_match(match_value.gprs__pwr__ctrl__params(), 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 SI13RestOctets_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (presence().is_bound()) presence().set_implicit_omit(); if (bcch__change__mark().is_bound()) bcch__change__mark().set_implicit_omit(); if (si__change__field().is_bound()) si__change__field().set_implicit_omit(); if (presence2().is_bound()) presence2().set_implicit_omit(); if (!si13__change__mark().is_bound()) si13__change__mark() = OMIT_VALUE; else si13__change__mark().set_implicit_omit(); if (!gprs__ma().is_bound()) gprs__ma() = OMIT_VALUE; else gprs__ma().set_implicit_omit(); if (zero().is_bound()) zero().set_implicit_omit(); if (rac().is_bound()) rac().set_implicit_omit(); if (spgc__ccch__sup().is_bound()) spgc__ccch__sup().set_implicit_omit(); if (priority__access__thr().is_bound()) priority__access__thr().set_implicit_omit(); if (network__control__order().is_bound()) network__control__order().set_implicit_omit(); if (gprs__cell__opts().is_bound()) gprs__cell__opts().set_implicit_omit(); if (gprs__pwr__ctrl__params().is_bound()) gprs__pwr__ctrl__params().set_implicit_omit(); } void SI13RestOctets_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_bcch__change__mark.encode_text(text_buf); single_value->field_si__change__field.encode_text(text_buf); single_value->field_presence2.encode_text(text_buf); single_value->field_si13__change__mark.encode_text(text_buf); single_value->field_gprs__ma.encode_text(text_buf); single_value->field_zero.encode_text(text_buf); single_value->field_rac.encode_text(text_buf); single_value->field_spgc__ccch__sup.encode_text(text_buf); single_value->field_priority__access__thr.encode_text(text_buf); single_value->field_network__control__order.encode_text(text_buf); single_value->field_gprs__cell__opts.encode_text(text_buf); single_value->field_gprs__pwr__ctrl__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.SI13RestOctets."); } } void SI13RestOctets_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_bcch__change__mark.decode_text(text_buf); single_value->field_si__change__field.decode_text(text_buf); single_value->field_presence2.decode_text(text_buf); single_value->field_si13__change__mark.decode_text(text_buf); single_value->field_gprs__ma.decode_text(text_buf); single_value->field_zero.decode_text(text_buf); single_value->field_rac.decode_text(text_buf); single_value->field_spgc__ccch__sup.decode_text(text_buf); single_value->field_priority__access__thr.decode_text(text_buf); single_value->field_network__control__order.decode_text(text_buf); single_value->field_gprs__cell__opts.decode_text(text_buf); single_value->field_gprs__pwr__ctrl__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 SI13RestOctets_template[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.SI13RestOctets."); } } void SI13RestOctets_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: { SI13RestOctets_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) bcch__change__mark().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) si__change__field().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) presence2().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) si13__change__mark().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) gprs__ma().set_param(*param.get_elem(5)); if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) zero().set_param(*param.get_elem(6)); if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) rac().set_param(*param.get_elem(7)); if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) spgc__ccch__sup().set_param(*param.get_elem(8)); if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) priority__access__thr().set_param(*param.get_elem(9)); if (param.get_size()>10 && param.get_elem(10)->get_type()!=Module_Param::MP_NotUsed) network__control__order().set_param(*param.get_elem(10)); if (param.get_size()>11 && param.get_elem(11)->get_type()!=Module_Param::MP_NotUsed) gprs__cell__opts().set_param(*param.get_elem(11)); if (param.get_size()>12 && param.get_elem(12)->get_type()!=Module_Param::MP_NotUsed) gprs__pwr__ctrl__params().set_param(*param.get_elem(12)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "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(), "bcch_change_mark")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { bcch__change__mark().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "si_change_field")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { si__change__field().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "presence2")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { presence2().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "si13_change_mark")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { si13__change__mark().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "gprs_ma")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { gprs__ma().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "zero")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { zero().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "rac")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rac().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "spgc_ccch_sup")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { spgc__ccch__sup().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "priority_access_thr")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { priority__access__thr().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "network_control_order")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { network__control__order().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "gprs_cell_opts")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { gprs__cell__opts().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "gprs_pwr_ctrl_params")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { gprs__pwr__ctrl__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.SI13RestOctets: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { SI13RestOctets_template* precondition = new SI13RestOctets_template; precondition->set_param(*param.get_elem(0)); SI13RestOctets_template* implied_template = new SI13RestOctets_template; implied_template->set_param(*param.get_elem(1)); *this = SI13RestOctets_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.SI13RestOctets"); } is_ifpresent = param.get_ifpresent(); } void SI13RestOctets_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.SI13RestOctets"); single_value->field_bcch__change__mark.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI13RestOctets"); single_value->field_si__change__field.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI13RestOctets"); single_value->field_presence2.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI13RestOctets"); single_value->field_si13__change__mark.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI13RestOctets"); single_value->field_gprs__ma.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI13RestOctets"); single_value->field_zero.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI13RestOctets"); single_value->field_rac.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI13RestOctets"); single_value->field_spgc__ccch__sup.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI13RestOctets"); single_value->field_priority__access__thr.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI13RestOctets"); single_value->field_network__control__order.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI13RestOctets"); single_value->field_gprs__cell__opts.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI13RestOctets"); single_value->field_gprs__pwr__ctrl__params.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI13RestOctets"); 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.SI13RestOctets"); } boolean SI13RestOctets_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean SI13RestOctets_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_neigh__info) : field_ba__ind(par_ba__ind), field_neigh__info__presence(par_neigh__info__presence), field_neigh__info(par_neigh__info) { } SI10RestOctets::SI10RestOctets(const SI10RestOctets& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.SI10RestOctets."); if (other_value.ba__ind().is_bound()) field_ba__ind = other_value.ba__ind(); else field_ba__ind.clean_up(); if (other_value.neigh__info__presence().is_bound()) field_neigh__info__presence = other_value.neigh__info__presence(); else field_neigh__info__presence.clean_up(); if (other_value.neigh__info().is_bound()) field_neigh__info = other_value.neigh__info(); else field_neigh__info.clean_up(); } void SI10RestOctets::clean_up() { field_ba__ind.clean_up(); field_neigh__info__presence.clean_up(); field_neigh__info.clean_up(); } const TTCN_Typedescriptor_t* SI10RestOctets::get_descriptor() const { return &SI10RestOctets_descr_; } SI10RestOctets& SI10RestOctets::operator=(const SI10RestOctets& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.SI10RestOctets."); if (other_value.ba__ind().is_bound()) field_ba__ind = other_value.ba__ind(); else field_ba__ind.clean_up(); if (other_value.neigh__info__presence().is_bound()) field_neigh__info__presence = other_value.neigh__info__presence(); else field_neigh__info__presence.clean_up(); if (other_value.neigh__info().is_bound()) field_neigh__info = other_value.neigh__info(); else field_neigh__info.clean_up(); } return *this; } boolean SI10RestOctets::operator==(const SI10RestOctets& other_value) const { return field_ba__ind==other_value.field_ba__ind && field_neigh__info__presence==other_value.field_neigh__info__presence && field_neigh__info==other_value.field_neigh__info; } boolean SI10RestOctets::is_bound() const { return (field_ba__ind.is_bound()) || (field_neigh__info__presence.is_bound()) || (OPTIONAL_OMIT == field_neigh__info.get_selection() || field_neigh__info.is_bound()); } boolean SI10RestOctets::is_value() const { return field_ba__ind.is_value() && field_neigh__info__presence.is_value() && (OPTIONAL_OMIT == field_neigh__info.get_selection() || field_neigh__info.is_value()); } int SI10RestOctets::size_of() const { int ret_val = 2; if (field_neigh__info.ispresent()) ret_val++; return ret_val; } void SI10RestOctets::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ ba_ind := "); field_ba__ind.log(); TTCN_Logger::log_event_str(", neigh_info_presence := "); field_neigh__info__presence.log(); TTCN_Logger::log_event_str(", neigh_info := "); field_neigh__info.log(); TTCN_Logger::log_event_str(" }"); } void SI10RestOctets::set_implicit_omit() { if (ba__ind().is_bound()) ba__ind().set_implicit_omit(); if (neigh__info__presence().is_bound()) neigh__info__presence().set_implicit_omit(); if (!neigh__info().is_bound()) neigh__info() = OMIT_VALUE; else neigh__info().set_implicit_omit(); } void SI10RestOctets::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) ba__ind().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) neigh__info__presence().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) neigh__info().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(), "ba_ind")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ba__ind().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "neigh_info_presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { neigh__info__presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "neigh_info")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { neigh__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.SI10RestOctets: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.SI10RestOctets"); } } void SI10RestOctets::encode_text(Text_Buf& text_buf) const { field_ba__ind.encode_text(text_buf); field_neigh__info__presence.encode_text(text_buf); field_neigh__info.encode_text(text_buf); } void SI10RestOctets::decode_text(Text_Buf& text_buf) { field_ba__ind.decode_text(text_buf); field_neigh__info__presence.decode_text(text_buf); field_neigh__info.decode_text(text_buf); } void SI10RestOctets::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 SI10RestOctets::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 SI10RestOctets::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, SI10RestOctets_ba__ind_descr_.raw->forceomit); decoded_field_length = field_ba__ind.RAW_decode(SI10RestOctets_ba__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, SI10RestOctets_neigh__info__presence_descr_.raw->forceomit); decoded_field_length = field_neigh__info__presence.RAW_decode(SI10RestOctets_neigh__info__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_neigh__info__presence == bs_0){ if (force_omit != NULL && (*force_omit)(2)) { field_neigh__info = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_2_force_omit(2, force_omit, SI10RestOctets_neigh__info_descr_.raw->forceomit); decoded_field_length = field_neigh__info().RAW_decode(SI10RestOctets_neigh__info_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_2_force_omit); if (decoded_field_length < 1) { field_neigh__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_neigh__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 SI10RestOctets::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, SI10RestOctets_ba__ind_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, SI10RestOctets_neigh__info__presence_descr_.raw); if (field_neigh__info.ispresent()) { myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, SI10RestOctets_neigh__info_descr_.raw); } else myleaf.body.node.nodes[2] = NULL; encoded_length += field_ba__ind.RAW_encode(SI10RestOctets_ba__ind_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_neigh__info__presence.RAW_encode(SI10RestOctets_neigh__info__presence_descr_, *myleaf.body.node.nodes[1]); if (field_neigh__info.ispresent()) { encoded_length += field_neigh__info().RAW_encode(SI10RestOctets_neigh__info_descr_, *myleaf.body.node.nodes[2]); } if (field_neigh__info.ispresent() && (field_neigh__info__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(SI10RestOctets_neigh__info__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 SI10RestOctets_template::single_value_struct { BITSTRING_template field_ba__ind; BITSTRING_template field_neigh__info__presence; SI10NeighInfo_template field_neigh__info; }; void SI10RestOctets_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_ba__ind = ANY_VALUE; single_value->field_neigh__info__presence = ANY_VALUE; single_value->field_neigh__info = ANY_OR_OMIT; } } } void SI10RestOctets_template::copy_value(const SI10RestOctets& other_value) { single_value = new single_value_struct; if (other_value.ba__ind().is_bound()) { single_value->field_ba__ind = other_value.ba__ind(); } else { single_value->field_ba__ind.clean_up(); } if (other_value.neigh__info__presence().is_bound()) { single_value->field_neigh__info__presence = other_value.neigh__info__presence(); } else { single_value->field_neigh__info__presence.clean_up(); } if (other_value.neigh__info().is_bound()) { if (other_value.neigh__info().ispresent()) single_value->field_neigh__info = other_value.neigh__info()(); else single_value->field_neigh__info = OMIT_VALUE; } else { single_value->field_neigh__info.clean_up(); } set_selection(SPECIFIC_VALUE); } void SI10RestOctets_template::copy_template(const SI10RestOctets_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.ba__ind().get_selection()) { single_value->field_ba__ind = other_value.ba__ind(); } else { single_value->field_ba__ind.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.neigh__info__presence().get_selection()) { single_value->field_neigh__info__presence = other_value.neigh__info__presence(); } else { single_value->field_neigh__info__presence.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.neigh__info().get_selection()) { single_value->field_neigh__info = other_value.neigh__info(); } else { single_value->field_neigh__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 SI10RestOctets_template[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 SI10RestOctets_template(*other_value.implication_.precondition); implication_.implied_template = new SI10RestOctets_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.SI10RestOctets."); break; } set_selection(other_value); } SI10RestOctets_template::SI10RestOctets_template() { } SI10RestOctets_template::SI10RestOctets_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } SI10RestOctets_template::SI10RestOctets_template(const SI10RestOctets& other_value) { copy_value(other_value); } SI10RestOctets_template::SI10RestOctets_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI10RestOctets&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.SI10RestOctets from an unbound optional field."); } } SI10RestOctets_template::SI10RestOctets_template(SI10RestOctets_template* p_precondition, SI10RestOctets_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } SI10RestOctets_template::SI10RestOctets_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; } SI10RestOctets_template::SI10RestOctets_template(const SI10RestOctets_template& other_value) : Base_Template() { copy_template(other_value); } SI10RestOctets_template::~SI10RestOctets_template() { clean_up(); } SI10RestOctets_template& SI10RestOctets_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } SI10RestOctets_template& SI10RestOctets_template::operator=(const SI10RestOctets& other_value) { clean_up(); copy_value(other_value); return *this; } SI10RestOctets_template& SI10RestOctets_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI10RestOctets&)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.SI10RestOctets."); } return *this; } SI10RestOctets_template& SI10RestOctets_template::operator=(const SI10RestOctets_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean SI10RestOctets_template::match(const SI10RestOctets& 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.ba__ind().is_bound()) return FALSE; if(!single_value->field_ba__ind.match(other_value.ba__ind(), legacy))return FALSE; if(!other_value.neigh__info__presence().is_bound()) return FALSE; if(!single_value->field_neigh__info__presence.match(other_value.neigh__info__presence(), legacy))return FALSE; if(!other_value.neigh__info().is_bound()) return FALSE; if((other_value.neigh__info().ispresent() ? !single_value->field_neigh__info.match((const SI10NeighInfo&)other_value.neigh__info(), legacy) : !single_value->field_neigh__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.SI10RestOctets."); } return FALSE; } boolean SI10RestOctets_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_ba__ind.is_bound() || single_value->field_neigh__info__presence.is_bound() || (single_value->field_neigh__info.is_omit() || single_value->field_neigh__info.is_bound()); } boolean SI10RestOctets_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_ba__ind.is_value() && single_value->field_neigh__info__presence.is_value() && (single_value->field_neigh__info.is_omit() || single_value->field_neigh__info.is_value()); } void SI10RestOctets_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; } SI10RestOctets SI10RestOctets_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.SI10RestOctets."); SI10RestOctets ret_val; if (single_value->field_ba__ind.is_bound()) { ret_val.ba__ind() = single_value->field_ba__ind.valueof(); } if (single_value->field_neigh__info__presence.is_bound()) { ret_val.neigh__info__presence() = single_value->field_neigh__info__presence.valueof(); } if (single_value->field_neigh__info.is_omit()) ret_val.neigh__info() = OMIT_VALUE; else if (single_value->field_neigh__info.is_bound()) { ret_val.neigh__info() = single_value->field_neigh__info.valueof(); } return ret_val; } void SI10RestOctets_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.SI10RestOctets."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new SI10RestOctets_template[list_length]; } SI10RestOctets_template& SI10RestOctets_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.SI10RestOctets."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.SI10RestOctets."); return value_list.list_value[list_index]; } BITSTRING_template& SI10RestOctets_template::ba__ind() { set_specific(); return single_value->field_ba__ind; } const BITSTRING_template& SI10RestOctets_template::ba__ind() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ba_ind of a non-specific template of type @GSM_RestOctets.SI10RestOctets."); return single_value->field_ba__ind; } BITSTRING_template& SI10RestOctets_template::neigh__info__presence() { set_specific(); return single_value->field_neigh__info__presence; } const BITSTRING_template& SI10RestOctets_template::neigh__info__presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field neigh_info_presence of a non-specific template of type @GSM_RestOctets.SI10RestOctets."); return single_value->field_neigh__info__presence; } SI10NeighInfo_template& SI10RestOctets_template::neigh__info() { set_specific(); return single_value->field_neigh__info; } const SI10NeighInfo_template& SI10RestOctets_template::neigh__info() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field neigh_info of a non-specific template of type @GSM_RestOctets.SI10RestOctets."); return single_value->field_neigh__info; } int SI10RestOctets_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10RestOctets which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 2; if (single_value->field_neigh__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.SI10RestOctets 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.SI10RestOctets 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.SI10RestOctets containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10RestOctets containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10RestOctets containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10RestOctets containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10RestOctets containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10RestOctets containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.SI10RestOctets."); } return 0; } void SI10RestOctets_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ ba_ind := "); single_value->field_ba__ind.log(); TTCN_Logger::log_event_str(", neigh_info_presence := "); single_value->field_neigh__info__presence.log(); TTCN_Logger::log_event_str(", neigh_info := "); single_value->field_neigh__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 SI10RestOctets_template::log_match(const SI10RestOctets& 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_ba__ind.match(match_value.ba__ind(), legacy)){ TTCN_Logger::log_logmatch_info(".ba_ind"); single_value->field_ba__ind.log_match(match_value.ba__ind(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_neigh__info__presence.match(match_value.neigh__info__presence(), legacy)){ TTCN_Logger::log_logmatch_info(".neigh_info_presence"); single_value->field_neigh__info__presence.log_match(match_value.neigh__info__presence(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.neigh__info().ispresent()){ if(!single_value->field_neigh__info.match(match_value.neigh__info(), legacy)){ TTCN_Logger::log_logmatch_info(".neigh_info"); single_value->field_neigh__info.log_match(match_value.neigh__info(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_neigh__info.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".neigh_info := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_neigh__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("{ ba_ind := "); single_value->field_ba__ind.log_match(match_value.ba__ind(), legacy); TTCN_Logger::log_event_str(", neigh_info_presence := "); single_value->field_neigh__info__presence.log_match(match_value.neigh__info__presence(), legacy); TTCN_Logger::log_event_str(", neigh_info := "); if (match_value.neigh__info().ispresent()) { single_value->field_neigh__info.log_match(match_value.neigh__info(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_neigh__info.log(); if (single_value->field_neigh__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 SI10RestOctets_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (ba__ind().is_bound()) ba__ind().set_implicit_omit(); if (neigh__info__presence().is_bound()) neigh__info__presence().set_implicit_omit(); if (!neigh__info().is_bound()) neigh__info() = OMIT_VALUE; else neigh__info().set_implicit_omit(); } void SI10RestOctets_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_ba__ind.encode_text(text_buf); single_value->field_neigh__info__presence.encode_text(text_buf); single_value->field_neigh__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.SI10RestOctets."); } } void SI10RestOctets_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_ba__ind.decode_text(text_buf); single_value->field_neigh__info__presence.decode_text(text_buf); single_value->field_neigh__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 SI10RestOctets_template[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.SI10RestOctets."); } } void SI10RestOctets_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: { SI10RestOctets_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) ba__ind().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) neigh__info__presence().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) neigh__info().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(), "ba_ind")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ba__ind().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "neigh_info_presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { neigh__info__presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "neigh_info")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { neigh__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.SI10RestOctets: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { SI10RestOctets_template* precondition = new SI10RestOctets_template; precondition->set_param(*param.get_elem(0)); SI10RestOctets_template* implied_template = new SI10RestOctets_template; implied_template->set_param(*param.get_elem(1)); *this = SI10RestOctets_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.SI10RestOctets"); } is_ifpresent = param.get_ifpresent(); } void SI10RestOctets_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_ba__ind.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI10RestOctets"); single_value->field_neigh__info__presence.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI10RestOctets"); single_value->field_neigh__info.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI10RestOctets"); 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.SI10RestOctets"); } boolean SI10RestOctets_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean SI10RestOctets_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_cell__params) : field_bsic(par_bsic), field_cell__params__presence(par_cell__params__presence), field_cell__params(par_cell__params) { } SI10CellInfo::SI10CellInfo(const SI10CellInfo& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.SI10CellInfo."); if (other_value.bsic().is_bound()) field_bsic = other_value.bsic(); else field_bsic.clean_up(); if (other_value.cell__params__presence().is_bound()) field_cell__params__presence = other_value.cell__params__presence(); else field_cell__params__presence.clean_up(); if (other_value.cell__params().is_bound()) field_cell__params = other_value.cell__params(); else field_cell__params.clean_up(); } void SI10CellInfo::clean_up() { field_bsic.clean_up(); field_cell__params__presence.clean_up(); field_cell__params.clean_up(); } const TTCN_Typedescriptor_t* SI10CellInfo::get_descriptor() const { return &SI10CellInfo_descr_; } SI10CellInfo& SI10CellInfo::operator=(const SI10CellInfo& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.SI10CellInfo."); if (other_value.bsic().is_bound()) field_bsic = other_value.bsic(); else field_bsic.clean_up(); if (other_value.cell__params__presence().is_bound()) field_cell__params__presence = other_value.cell__params__presence(); else field_cell__params__presence.clean_up(); if (other_value.cell__params().is_bound()) field_cell__params = other_value.cell__params(); else field_cell__params.clean_up(); } return *this; } boolean SI10CellInfo::operator==(const SI10CellInfo& other_value) const { return field_bsic==other_value.field_bsic && field_cell__params__presence==other_value.field_cell__params__presence && field_cell__params==other_value.field_cell__params; } boolean SI10CellInfo::is_bound() const { return (field_bsic.is_bound()) || (field_cell__params__presence.is_bound()) || (OPTIONAL_OMIT == field_cell__params.get_selection() || field_cell__params.is_bound()); } boolean SI10CellInfo::is_value() const { return field_bsic.is_value() && field_cell__params__presence.is_value() && (OPTIONAL_OMIT == field_cell__params.get_selection() || field_cell__params.is_value()); } int SI10CellInfo::size_of() const { int ret_val = 2; if (field_cell__params.ispresent()) ret_val++; return ret_val; } void SI10CellInfo::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ bsic := "); field_bsic.log(); TTCN_Logger::log_event_str(", cell_params_presence := "); field_cell__params__presence.log(); TTCN_Logger::log_event_str(", cell_params := "); field_cell__params.log(); TTCN_Logger::log_event_str(" }"); } void SI10CellInfo::set_implicit_omit() { if (bsic().is_bound()) bsic().set_implicit_omit(); if (cell__params__presence().is_bound()) cell__params__presence().set_implicit_omit(); if (!cell__params().is_bound()) cell__params() = OMIT_VALUE; else cell__params().set_implicit_omit(); } void SI10CellInfo::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) bsic().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) cell__params__presence().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) cell__params().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(), "bsic")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { bsic().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "cell_params_presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cell__params__presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "cell_params")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cell__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.SI10CellInfo: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.SI10CellInfo"); } } void SI10CellInfo::encode_text(Text_Buf& text_buf) const { field_bsic.encode_text(text_buf); field_cell__params__presence.encode_text(text_buf); field_cell__params.encode_text(text_buf); } void SI10CellInfo::decode_text(Text_Buf& text_buf) { field_bsic.decode_text(text_buf); field_cell__params__presence.decode_text(text_buf); field_cell__params.decode_text(text_buf); } void SI10CellInfo::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 SI10CellInfo::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 SI10CellInfo::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, SI10CellInfo_bsic_descr_.raw->forceomit); decoded_field_length = field_bsic.RAW_decode(SI10CellInfo_bsic_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, SI10CellInfo_cell__params__presence_descr_.raw->forceomit); decoded_field_length = field_cell__params__presence.RAW_decode(SI10CellInfo_cell__params__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_cell__params__presence == bs_0){ if (force_omit != NULL && (*force_omit)(2)) { field_cell__params = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_2_force_omit(2, force_omit, SI10CellInfo_cell__params_descr_.raw->forceomit); decoded_field_length = field_cell__params().RAW_decode(SI10CellInfo_cell__params_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_2_force_omit); if (decoded_field_length < 1) { field_cell__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_cell__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 SI10CellInfo::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, SI10CellInfo_bsic_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, SI10CellInfo_cell__params__presence_descr_.raw); if (field_cell__params.ispresent()) { myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, SI10CellInfo_cell__params_descr_.raw); } else myleaf.body.node.nodes[2] = NULL; encoded_length += field_bsic.RAW_encode(SI10CellInfo_bsic_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_cell__params__presence.RAW_encode(SI10CellInfo_cell__params__presence_descr_, *myleaf.body.node.nodes[1]); if (field_cell__params.ispresent()) { encoded_length += field_cell__params().RAW_encode(SI10CellInfo_cell__params_descr_, *myleaf.body.node.nodes[2]); } if (field_cell__params.ispresent() && (field_cell__params__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(SI10CellInfo_cell__params__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 SI10CellInfo_template::single_value_struct { INTEGER_template field_bsic; BITSTRING_template field_cell__params__presence; SI10CellParams_template field_cell__params; }; void SI10CellInfo_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_bsic = ANY_VALUE; single_value->field_cell__params__presence = ANY_VALUE; single_value->field_cell__params = ANY_OR_OMIT; } } } void SI10CellInfo_template::copy_value(const SI10CellInfo& other_value) { single_value = new single_value_struct; if (other_value.bsic().is_bound()) { single_value->field_bsic = other_value.bsic(); } else { single_value->field_bsic.clean_up(); } if (other_value.cell__params__presence().is_bound()) { single_value->field_cell__params__presence = other_value.cell__params__presence(); } else { single_value->field_cell__params__presence.clean_up(); } if (other_value.cell__params().is_bound()) { if (other_value.cell__params().ispresent()) single_value->field_cell__params = other_value.cell__params()(); else single_value->field_cell__params = OMIT_VALUE; } else { single_value->field_cell__params.clean_up(); } set_selection(SPECIFIC_VALUE); } void SI10CellInfo_template::copy_template(const SI10CellInfo_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.bsic().get_selection()) { single_value->field_bsic = other_value.bsic(); } else { single_value->field_bsic.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.cell__params__presence().get_selection()) { single_value->field_cell__params__presence = other_value.cell__params__presence(); } else { single_value->field_cell__params__presence.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.cell__params().get_selection()) { single_value->field_cell__params = other_value.cell__params(); } else { single_value->field_cell__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 SI10CellInfo_template[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 SI10CellInfo_template(*other_value.implication_.precondition); implication_.implied_template = new SI10CellInfo_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.SI10CellInfo."); break; } set_selection(other_value); } SI10CellInfo_template::SI10CellInfo_template() { } SI10CellInfo_template::SI10CellInfo_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } SI10CellInfo_template::SI10CellInfo_template(const SI10CellInfo& other_value) { copy_value(other_value); } SI10CellInfo_template::SI10CellInfo_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI10CellInfo&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.SI10CellInfo from an unbound optional field."); } } SI10CellInfo_template::SI10CellInfo_template(SI10CellInfo_template* p_precondition, SI10CellInfo_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } SI10CellInfo_template::SI10CellInfo_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; } SI10CellInfo_template::SI10CellInfo_template(const SI10CellInfo_template& other_value) : Base_Template() { copy_template(other_value); } SI10CellInfo_template::~SI10CellInfo_template() { clean_up(); } SI10CellInfo_template& SI10CellInfo_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } SI10CellInfo_template& SI10CellInfo_template::operator=(const SI10CellInfo& other_value) { clean_up(); copy_value(other_value); return *this; } SI10CellInfo_template& SI10CellInfo_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI10CellInfo&)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.SI10CellInfo."); } return *this; } SI10CellInfo_template& SI10CellInfo_template::operator=(const SI10CellInfo_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean SI10CellInfo_template::match(const SI10CellInfo& 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.bsic().is_bound()) return FALSE; if(!single_value->field_bsic.match(other_value.bsic(), legacy))return FALSE; if(!other_value.cell__params__presence().is_bound()) return FALSE; if(!single_value->field_cell__params__presence.match(other_value.cell__params__presence(), legacy))return FALSE; if(!other_value.cell__params().is_bound()) return FALSE; if((other_value.cell__params().ispresent() ? !single_value->field_cell__params.match((const SI10CellParams&)other_value.cell__params(), legacy) : !single_value->field_cell__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.SI10CellInfo."); } return FALSE; } boolean SI10CellInfo_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_bsic.is_bound() || single_value->field_cell__params__presence.is_bound() || (single_value->field_cell__params.is_omit() || single_value->field_cell__params.is_bound()); } boolean SI10CellInfo_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_bsic.is_value() && single_value->field_cell__params__presence.is_value() && (single_value->field_cell__params.is_omit() || single_value->field_cell__params.is_value()); } void SI10CellInfo_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; } SI10CellInfo SI10CellInfo_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.SI10CellInfo."); SI10CellInfo ret_val; if (single_value->field_bsic.is_bound()) { ret_val.bsic() = single_value->field_bsic.valueof(); } if (single_value->field_cell__params__presence.is_bound()) { ret_val.cell__params__presence() = single_value->field_cell__params__presence.valueof(); } if (single_value->field_cell__params.is_omit()) ret_val.cell__params() = OMIT_VALUE; else if (single_value->field_cell__params.is_bound()) { ret_val.cell__params() = single_value->field_cell__params.valueof(); } return ret_val; } void SI10CellInfo_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.SI10CellInfo."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new SI10CellInfo_template[list_length]; } SI10CellInfo_template& SI10CellInfo_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.SI10CellInfo."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.SI10CellInfo."); return value_list.list_value[list_index]; } INTEGER_template& SI10CellInfo_template::bsic() { set_specific(); return single_value->field_bsic; } const INTEGER_template& SI10CellInfo_template::bsic() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field bsic of a non-specific template of type @GSM_RestOctets.SI10CellInfo."); return single_value->field_bsic; } BITSTRING_template& SI10CellInfo_template::cell__params__presence() { set_specific(); return single_value->field_cell__params__presence; } const BITSTRING_template& SI10CellInfo_template::cell__params__presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field cell_params_presence of a non-specific template of type @GSM_RestOctets.SI10CellInfo."); return single_value->field_cell__params__presence; } SI10CellParams_template& SI10CellInfo_template::cell__params() { set_specific(); return single_value->field_cell__params; } const SI10CellParams_template& SI10CellInfo_template::cell__params() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field cell_params of a non-specific template of type @GSM_RestOctets.SI10CellInfo."); return single_value->field_cell__params; } int SI10CellInfo_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10CellInfo which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 2; if (single_value->field_cell__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.SI10CellInfo 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.SI10CellInfo 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.SI10CellInfo containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10CellInfo containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10CellInfo containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10CellInfo containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10CellInfo containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10CellInfo containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.SI10CellInfo."); } return 0; } void SI10CellInfo_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ bsic := "); single_value->field_bsic.log(); TTCN_Logger::log_event_str(", cell_params_presence := "); single_value->field_cell__params__presence.log(); TTCN_Logger::log_event_str(", cell_params := "); single_value->field_cell__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 SI10CellInfo_template::log_match(const SI10CellInfo& 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_bsic.match(match_value.bsic(), legacy)){ TTCN_Logger::log_logmatch_info(".bsic"); single_value->field_bsic.log_match(match_value.bsic(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_cell__params__presence.match(match_value.cell__params__presence(), legacy)){ TTCN_Logger::log_logmatch_info(".cell_params_presence"); single_value->field_cell__params__presence.log_match(match_value.cell__params__presence(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.cell__params().ispresent()){ if(!single_value->field_cell__params.match(match_value.cell__params(), legacy)){ TTCN_Logger::log_logmatch_info(".cell_params"); single_value->field_cell__params.log_match(match_value.cell__params(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_cell__params.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".cell_params := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_cell__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("{ bsic := "); single_value->field_bsic.log_match(match_value.bsic(), legacy); TTCN_Logger::log_event_str(", cell_params_presence := "); single_value->field_cell__params__presence.log_match(match_value.cell__params__presence(), legacy); TTCN_Logger::log_event_str(", cell_params := "); if (match_value.cell__params().ispresent()) { single_value->field_cell__params.log_match(match_value.cell__params(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_cell__params.log(); if (single_value->field_cell__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 SI10CellInfo_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (bsic().is_bound()) bsic().set_implicit_omit(); if (cell__params__presence().is_bound()) cell__params__presence().set_implicit_omit(); if (!cell__params().is_bound()) cell__params() = OMIT_VALUE; else cell__params().set_implicit_omit(); } void SI10CellInfo_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_bsic.encode_text(text_buf); single_value->field_cell__params__presence.encode_text(text_buf); single_value->field_cell__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.SI10CellInfo."); } } void SI10CellInfo_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_bsic.decode_text(text_buf); single_value->field_cell__params__presence.decode_text(text_buf); single_value->field_cell__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 SI10CellInfo_template[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.SI10CellInfo."); } } void SI10CellInfo_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: { SI10CellInfo_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) bsic().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) cell__params__presence().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) cell__params().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(), "bsic")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { bsic().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "cell_params_presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cell__params__presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "cell_params")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cell__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.SI10CellInfo: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { SI10CellInfo_template* precondition = new SI10CellInfo_template; precondition->set_param(*param.get_elem(0)); SI10CellInfo_template* implied_template = new SI10CellInfo_template; implied_template->set_param(*param.get_elem(1)); *this = SI10CellInfo_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.SI10CellInfo"); } is_ifpresent = param.get_ifpresent(); } void SI10CellInfo_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_bsic.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI10CellInfo"); single_value->field_cell__params__presence.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI10CellInfo"); single_value->field_cell__params.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI10CellInfo"); 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.SI10CellInfo"); } boolean SI10CellInfo_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean SI10CellInfo_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_further__cell__info) : field_cell__barred(par_cell__barred), field_further__cell__info(par_further__cell__info) { } SI10CellParams::SI10CellParams(const SI10CellParams& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.SI10CellParams."); if (other_value.cell__barred().is_bound()) field_cell__barred = other_value.cell__barred(); else field_cell__barred.clean_up(); if (other_value.further__cell__info().is_bound()) field_further__cell__info = other_value.further__cell__info(); else field_further__cell__info.clean_up(); } void SI10CellParams::clean_up() { field_cell__barred.clean_up(); field_further__cell__info.clean_up(); } const TTCN_Typedescriptor_t* SI10CellParams::get_descriptor() const { return &SI10CellParams_descr_; } SI10CellParams& SI10CellParams::operator=(const SI10CellParams& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.SI10CellParams."); if (other_value.cell__barred().is_bound()) field_cell__barred = other_value.cell__barred(); else field_cell__barred.clean_up(); if (other_value.further__cell__info().is_bound()) field_further__cell__info = other_value.further__cell__info(); else field_further__cell__info.clean_up(); } return *this; } boolean SI10CellParams::operator==(const SI10CellParams& other_value) const { return field_cell__barred==other_value.field_cell__barred && field_further__cell__info==other_value.field_further__cell__info; } boolean SI10CellParams::is_bound() const { return (field_cell__barred.is_bound()) || (OPTIONAL_OMIT == field_further__cell__info.get_selection() || field_further__cell__info.is_bound()); } boolean SI10CellParams::is_value() const { return field_cell__barred.is_value() && (OPTIONAL_OMIT == field_further__cell__info.get_selection() || field_further__cell__info.is_value()); } int SI10CellParams::size_of() const { int ret_val = 1; if (field_further__cell__info.ispresent()) ret_val++; return ret_val; } void SI10CellParams::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ cell_barred := "); field_cell__barred.log(); TTCN_Logger::log_event_str(", further_cell_info := "); field_further__cell__info.log(); TTCN_Logger::log_event_str(" }"); } void SI10CellParams::set_implicit_omit() { if (cell__barred().is_bound()) cell__barred().set_implicit_omit(); if (!further__cell__info().is_bound()) further__cell__info() = OMIT_VALUE; else further__cell__info().set_implicit_omit(); } void SI10CellParams::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) cell__barred().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) further__cell__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(), "cell_barred")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cell__barred().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "further_cell_info")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { further__cell__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.SI10CellParams: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.SI10CellParams"); } } void SI10CellParams::encode_text(Text_Buf& text_buf) const { field_cell__barred.encode_text(text_buf); field_further__cell__info.encode_text(text_buf); } void SI10CellParams::decode_text(Text_Buf& text_buf) { field_cell__barred.decode_text(text_buf); field_further__cell__info.decode_text(text_buf); } void SI10CellParams::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 SI10CellParams::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 SI10CellParams::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, SI10CellParams_cell__barred_descr_.raw->forceomit); decoded_field_length = field_cell__barred.RAW_decode(SI10CellParams_cell__barred_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_cell__barred == bs_1){ if (force_omit != NULL && (*force_omit)(1)) { field_further__cell__info = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_1_force_omit(1, force_omit, SI10CellParams_further__cell__info_descr_.raw->forceomit); decoded_field_length = field_further__cell__info().RAW_decode(SI10CellParams_further__cell__info_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 1) { field_further__cell__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_further__cell__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 SI10CellParams::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, SI10CellParams_cell__barred_descr_.raw); if (field_further__cell__info.ispresent()) { myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, SI10CellParams_further__cell__info_descr_.raw); } else myleaf.body.node.nodes[1] = NULL; encoded_length += field_cell__barred.RAW_encode(SI10CellParams_cell__barred_descr_, *myleaf.body.node.nodes[0]); if (field_further__cell__info.ispresent()) { encoded_length += field_further__cell__info().RAW_encode(SI10CellParams_further__cell__info_descr_, *myleaf.body.node.nodes[1]); } if (field_further__cell__info.ispresent() && (field_cell__barred != bs_1)) { 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_1.RAW_encode(SI10CellParams_cell__barred_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 SI10CellParams_template::single_value_struct { BITSTRING_template field_cell__barred; SI10FurtherCellInfo_template field_further__cell__info; }; void SI10CellParams_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_cell__barred = ANY_VALUE; single_value->field_further__cell__info = ANY_OR_OMIT; } } } void SI10CellParams_template::copy_value(const SI10CellParams& other_value) { single_value = new single_value_struct; if (other_value.cell__barred().is_bound()) { single_value->field_cell__barred = other_value.cell__barred(); } else { single_value->field_cell__barred.clean_up(); } if (other_value.further__cell__info().is_bound()) { if (other_value.further__cell__info().ispresent()) single_value->field_further__cell__info = other_value.further__cell__info()(); else single_value->field_further__cell__info = OMIT_VALUE; } else { single_value->field_further__cell__info.clean_up(); } set_selection(SPECIFIC_VALUE); } void SI10CellParams_template::copy_template(const SI10CellParams_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.cell__barred().get_selection()) { single_value->field_cell__barred = other_value.cell__barred(); } else { single_value->field_cell__barred.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.further__cell__info().get_selection()) { single_value->field_further__cell__info = other_value.further__cell__info(); } else { single_value->field_further__cell__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 SI10CellParams_template[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 SI10CellParams_template(*other_value.implication_.precondition); implication_.implied_template = new SI10CellParams_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.SI10CellParams."); break; } set_selection(other_value); } SI10CellParams_template::SI10CellParams_template() { } SI10CellParams_template::SI10CellParams_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } SI10CellParams_template::SI10CellParams_template(const SI10CellParams& other_value) { copy_value(other_value); } SI10CellParams_template::SI10CellParams_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI10CellParams&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.SI10CellParams from an unbound optional field."); } } SI10CellParams_template::SI10CellParams_template(SI10CellParams_template* p_precondition, SI10CellParams_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } SI10CellParams_template::SI10CellParams_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; } SI10CellParams_template::SI10CellParams_template(const SI10CellParams_template& other_value) : Base_Template() { copy_template(other_value); } SI10CellParams_template::~SI10CellParams_template() { clean_up(); } SI10CellParams_template& SI10CellParams_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } SI10CellParams_template& SI10CellParams_template::operator=(const SI10CellParams& other_value) { clean_up(); copy_value(other_value); return *this; } SI10CellParams_template& SI10CellParams_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI10CellParams&)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.SI10CellParams."); } return *this; } SI10CellParams_template& SI10CellParams_template::operator=(const SI10CellParams_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean SI10CellParams_template::match(const SI10CellParams& 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.cell__barred().is_bound()) return FALSE; if(!single_value->field_cell__barred.match(other_value.cell__barred(), legacy))return FALSE; if(!other_value.further__cell__info().is_bound()) return FALSE; if((other_value.further__cell__info().ispresent() ? !single_value->field_further__cell__info.match((const SI10FurtherCellInfo&)other_value.further__cell__info(), legacy) : !single_value->field_further__cell__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.SI10CellParams."); } return FALSE; } boolean SI10CellParams_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_cell__barred.is_bound() || (single_value->field_further__cell__info.is_omit() || single_value->field_further__cell__info.is_bound()); } boolean SI10CellParams_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_cell__barred.is_value() && (single_value->field_further__cell__info.is_omit() || single_value->field_further__cell__info.is_value()); } void SI10CellParams_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; } SI10CellParams SI10CellParams_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.SI10CellParams."); SI10CellParams ret_val; if (single_value->field_cell__barred.is_bound()) { ret_val.cell__barred() = single_value->field_cell__barred.valueof(); } if (single_value->field_further__cell__info.is_omit()) ret_val.further__cell__info() = OMIT_VALUE; else if (single_value->field_further__cell__info.is_bound()) { ret_val.further__cell__info() = single_value->field_further__cell__info.valueof(); } return ret_val; } void SI10CellParams_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.SI10CellParams."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new SI10CellParams_template[list_length]; } SI10CellParams_template& SI10CellParams_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.SI10CellParams."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.SI10CellParams."); return value_list.list_value[list_index]; } BITSTRING_template& SI10CellParams_template::cell__barred() { set_specific(); return single_value->field_cell__barred; } const BITSTRING_template& SI10CellParams_template::cell__barred() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field cell_barred of a non-specific template of type @GSM_RestOctets.SI10CellParams."); return single_value->field_cell__barred; } SI10FurtherCellInfo_template& SI10CellParams_template::further__cell__info() { set_specific(); return single_value->field_further__cell__info; } const SI10FurtherCellInfo_template& SI10CellParams_template::further__cell__info() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field further_cell_info of a non-specific template of type @GSM_RestOctets.SI10CellParams."); return single_value->field_further__cell__info; } int SI10CellParams_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10CellParams which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 1; if (single_value->field_further__cell__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.SI10CellParams 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.SI10CellParams 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.SI10CellParams containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10CellParams containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10CellParams containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10CellParams containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10CellParams containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10CellParams containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.SI10CellParams."); } return 0; } void SI10CellParams_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ cell_barred := "); single_value->field_cell__barred.log(); TTCN_Logger::log_event_str(", further_cell_info := "); single_value->field_further__cell__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 SI10CellParams_template::log_match(const SI10CellParams& 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_cell__barred.match(match_value.cell__barred(), legacy)){ TTCN_Logger::log_logmatch_info(".cell_barred"); single_value->field_cell__barred.log_match(match_value.cell__barred(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.further__cell__info().ispresent()){ if(!single_value->field_further__cell__info.match(match_value.further__cell__info(), legacy)){ TTCN_Logger::log_logmatch_info(".further_cell_info"); single_value->field_further__cell__info.log_match(match_value.further__cell__info(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_further__cell__info.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".further_cell_info := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_further__cell__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("{ cell_barred := "); single_value->field_cell__barred.log_match(match_value.cell__barred(), legacy); TTCN_Logger::log_event_str(", further_cell_info := "); if (match_value.further__cell__info().ispresent()) { single_value->field_further__cell__info.log_match(match_value.further__cell__info(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_further__cell__info.log(); if (single_value->field_further__cell__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 SI10CellParams_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (cell__barred().is_bound()) cell__barred().set_implicit_omit(); if (!further__cell__info().is_bound()) further__cell__info() = OMIT_VALUE; else further__cell__info().set_implicit_omit(); } void SI10CellParams_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_cell__barred.encode_text(text_buf); single_value->field_further__cell__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.SI10CellParams."); } } void SI10CellParams_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_cell__barred.decode_text(text_buf); single_value->field_further__cell__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 SI10CellParams_template[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.SI10CellParams."); } } void SI10CellParams_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: { SI10CellParams_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) cell__barred().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) further__cell__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(), "cell_barred")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cell__barred().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "further_cell_info")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { further__cell__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.SI10CellParams: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { SI10CellParams_template* precondition = new SI10CellParams_template; precondition->set_param(*param.get_elem(0)); SI10CellParams_template* implied_template = new SI10CellParams_template; implied_template->set_param(*param.get_elem(1)); *this = SI10CellParams_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.SI10CellParams"); } is_ifpresent = param.get_ifpresent(); } void SI10CellParams_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_cell__barred.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI10CellParams"); single_value->field_further__cell__info.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI10CellParams"); 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.SI10CellParams"); } boolean SI10CellParams_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean SI10CellParams_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_cell__resel__hyst, const INTEGER& par_ms__txpwr__max__cch, const INTEGER& par_rxlev__access__min, const INTEGER& par_cell__resel__offset, const INTEGER& par_temp__offset, const INTEGER& par_penalty__time) : field_la__different(par_la__different), field_cell__resel__hyst(par_cell__resel__hyst), field_ms__txpwr__max__cch(par_ms__txpwr__max__cch), field_rxlev__access__min(par_rxlev__access__min), field_cell__resel__offset(par_cell__resel__offset), field_temp__offset(par_temp__offset), field_penalty__time(par_penalty__time) { } SI10FurtherCellInfo::SI10FurtherCellInfo(const SI10FurtherCellInfo& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.SI10FurtherCellInfo."); if (other_value.la__different().is_bound()) field_la__different = other_value.la__different(); else field_la__different.clean_up(); if (other_value.cell__resel__hyst().is_bound()) field_cell__resel__hyst = other_value.cell__resel__hyst(); else field_cell__resel__hyst.clean_up(); if (other_value.ms__txpwr__max__cch().is_bound()) field_ms__txpwr__max__cch = other_value.ms__txpwr__max__cch(); else field_ms__txpwr__max__cch.clean_up(); if (other_value.rxlev__access__min().is_bound()) field_rxlev__access__min = other_value.rxlev__access__min(); else field_rxlev__access__min.clean_up(); if (other_value.cell__resel__offset().is_bound()) field_cell__resel__offset = other_value.cell__resel__offset(); else field_cell__resel__offset.clean_up(); if (other_value.temp__offset().is_bound()) field_temp__offset = other_value.temp__offset(); else field_temp__offset.clean_up(); if (other_value.penalty__time().is_bound()) field_penalty__time = other_value.penalty__time(); else field_penalty__time.clean_up(); } void SI10FurtherCellInfo::clean_up() { field_la__different.clean_up(); field_cell__resel__hyst.clean_up(); field_ms__txpwr__max__cch.clean_up(); field_rxlev__access__min.clean_up(); field_cell__resel__offset.clean_up(); field_temp__offset.clean_up(); field_penalty__time.clean_up(); } const TTCN_Typedescriptor_t* SI10FurtherCellInfo::get_descriptor() const { return &SI10FurtherCellInfo_descr_; } SI10FurtherCellInfo& SI10FurtherCellInfo::operator=(const SI10FurtherCellInfo& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.SI10FurtherCellInfo."); if (other_value.la__different().is_bound()) field_la__different = other_value.la__different(); else field_la__different.clean_up(); if (other_value.cell__resel__hyst().is_bound()) field_cell__resel__hyst = other_value.cell__resel__hyst(); else field_cell__resel__hyst.clean_up(); if (other_value.ms__txpwr__max__cch().is_bound()) field_ms__txpwr__max__cch = other_value.ms__txpwr__max__cch(); else field_ms__txpwr__max__cch.clean_up(); if (other_value.rxlev__access__min().is_bound()) field_rxlev__access__min = other_value.rxlev__access__min(); else field_rxlev__access__min.clean_up(); if (other_value.cell__resel__offset().is_bound()) field_cell__resel__offset = other_value.cell__resel__offset(); else field_cell__resel__offset.clean_up(); if (other_value.temp__offset().is_bound()) field_temp__offset = other_value.temp__offset(); else field_temp__offset.clean_up(); if (other_value.penalty__time().is_bound()) field_penalty__time = other_value.penalty__time(); else field_penalty__time.clean_up(); } return *this; } boolean SI10FurtherCellInfo::operator==(const SI10FurtherCellInfo& other_value) const { return field_la__different==other_value.field_la__different && field_cell__resel__hyst==other_value.field_cell__resel__hyst && field_ms__txpwr__max__cch==other_value.field_ms__txpwr__max__cch && field_rxlev__access__min==other_value.field_rxlev__access__min && field_cell__resel__offset==other_value.field_cell__resel__offset && field_temp__offset==other_value.field_temp__offset && field_penalty__time==other_value.field_penalty__time; } boolean SI10FurtherCellInfo::is_bound() const { return (field_la__different.is_bound()) || (OPTIONAL_OMIT == field_cell__resel__hyst.get_selection() || field_cell__resel__hyst.is_bound()) || (field_ms__txpwr__max__cch.is_bound()) || (field_rxlev__access__min.is_bound()) || (field_cell__resel__offset.is_bound()) || (field_temp__offset.is_bound()) || (field_penalty__time.is_bound()); } boolean SI10FurtherCellInfo::is_value() const { return field_la__different.is_value() && (OPTIONAL_OMIT == field_cell__resel__hyst.get_selection() || field_cell__resel__hyst.is_value()) && field_ms__txpwr__max__cch.is_value() && field_rxlev__access__min.is_value() && field_cell__resel__offset.is_value() && field_temp__offset.is_value() && field_penalty__time.is_value(); } int SI10FurtherCellInfo::size_of() const { int ret_val = 6; if (field_cell__resel__hyst.ispresent()) ret_val++; return ret_val; } void SI10FurtherCellInfo::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ la_different := "); field_la__different.log(); TTCN_Logger::log_event_str(", cell_resel_hyst := "); field_cell__resel__hyst.log(); TTCN_Logger::log_event_str(", ms_txpwr_max_cch := "); field_ms__txpwr__max__cch.log(); TTCN_Logger::log_event_str(", rxlev_access_min := "); field_rxlev__access__min.log(); TTCN_Logger::log_event_str(", cell_resel_offset := "); field_cell__resel__offset.log(); TTCN_Logger::log_event_str(", temp_offset := "); field_temp__offset.log(); TTCN_Logger::log_event_str(", penalty_time := "); field_penalty__time.log(); TTCN_Logger::log_event_str(" }"); } void SI10FurtherCellInfo::set_implicit_omit() { if (la__different().is_bound()) la__different().set_implicit_omit(); if (!cell__resel__hyst().is_bound()) cell__resel__hyst() = OMIT_VALUE; else cell__resel__hyst().set_implicit_omit(); if (ms__txpwr__max__cch().is_bound()) ms__txpwr__max__cch().set_implicit_omit(); if (rxlev__access__min().is_bound()) rxlev__access__min().set_implicit_omit(); if (cell__resel__offset().is_bound()) cell__resel__offset().set_implicit_omit(); if (temp__offset().is_bound()) temp__offset().set_implicit_omit(); if (penalty__time().is_bound()) penalty__time().set_implicit_omit(); } void SI10FurtherCellInfo::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "record value"); switch (param.get_type()) { case Module_Param::MP_Value_List: if (70 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) la__different().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) cell__resel__hyst().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) ms__txpwr__max__cch().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) rxlev__access__min().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) cell__resel__offset().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) temp__offset().set_param(*param.get_elem(5)); if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) penalty__time().set_param(*param.get_elem(6)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "la_different")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { la__different().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "cell_resel_hyst")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cell__resel__hyst().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ms_txpwr_max_cch")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ms__txpwr__max__cch().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "rxlev_access_min")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rxlev__access__min().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "cell_resel_offset")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cell__resel__offset().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "temp_offset")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { temp__offset().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "penalty_time")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { penalty__time().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.SI10FurtherCellInfo: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.SI10FurtherCellInfo"); } } void SI10FurtherCellInfo::encode_text(Text_Buf& text_buf) const { field_la__different.encode_text(text_buf); field_cell__resel__hyst.encode_text(text_buf); field_ms__txpwr__max__cch.encode_text(text_buf); field_rxlev__access__min.encode_text(text_buf); field_cell__resel__offset.encode_text(text_buf); field_temp__offset.encode_text(text_buf); field_penalty__time.encode_text(text_buf); } void SI10FurtherCellInfo::decode_text(Text_Buf& text_buf) { field_la__different.decode_text(text_buf); field_cell__resel__hyst.decode_text(text_buf); field_ms__txpwr__max__cch.decode_text(text_buf); field_rxlev__access__min.decode_text(text_buf); field_cell__resel__offset.decode_text(text_buf); field_temp__offset.decode_text(text_buf); field_penalty__time.decode_text(text_buf); } void SI10FurtherCellInfo::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 SI10FurtherCellInfo::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 SI10FurtherCellInfo::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, SI10FurtherCellInfo_la__different_descr_.raw->forceomit); decoded_field_length = field_la__different.RAW_decode(SI10FurtherCellInfo_la__different_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_la__different == bs_0){ if (force_omit != NULL && (*force_omit)(1)) { field_cell__resel__hyst = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_1_force_omit(1, force_omit, SI10FurtherCellInfo_cell__resel__hyst_descr_.raw->forceomit); decoded_field_length = field_cell__resel__hyst().RAW_decode(SI10FurtherCellInfo_cell__resel__hyst_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 1) { field_cell__resel__hyst = 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__resel__hyst=OMIT_VALUE; RAW_Force_Omit field_2_force_omit(2, force_omit, SI10FurtherCellInfo_ms__txpwr__max__cch_descr_.raw->forceomit); decoded_field_length = field_ms__txpwr__max__cch.RAW_decode(SI10FurtherCellInfo_ms__txpwr__max__cch_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, SI10FurtherCellInfo_rxlev__access__min_descr_.raw->forceomit); decoded_field_length = field_rxlev__access__min.RAW_decode(SI10FurtherCellInfo_rxlev__access__min_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, SI10FurtherCellInfo_cell__resel__offset_descr_.raw->forceomit); decoded_field_length = field_cell__resel__offset.RAW_decode(SI10FurtherCellInfo_cell__resel__offset_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, SI10FurtherCellInfo_temp__offset_descr_.raw->forceomit); decoded_field_length = field_temp__offset.RAW_decode(SI10FurtherCellInfo_temp__offset_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, SI10FurtherCellInfo_penalty__time_descr_.raw->forceomit); decoded_field_length = field_penalty__time.RAW_decode(SI10FurtherCellInfo_penalty__time_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()); p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int SI10FurtherCellInfo::RAW_encode(const TTCN_Typedescriptor_t&, RAW_enc_tree& myleaf) const { if (!is_bound()) TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value."); int encoded_length = 0; myleaf.isleaf = FALSE; myleaf.body.node.num_of_nodes = 7; myleaf.body.node.nodes = init_nodes_of_enc_tree(7); myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, SI10FurtherCellInfo_la__different_descr_.raw); if (field_cell__resel__hyst.ispresent()) { myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, SI10FurtherCellInfo_cell__resel__hyst_descr_.raw); } else myleaf.body.node.nodes[1] = NULL; myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, SI10FurtherCellInfo_ms__txpwr__max__cch_descr_.raw); myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, SI10FurtherCellInfo_rxlev__access__min_descr_.raw); myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, SI10FurtherCellInfo_cell__resel__offset_descr_.raw); myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, SI10FurtherCellInfo_temp__offset_descr_.raw); myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, SI10FurtherCellInfo_penalty__time_descr_.raw); encoded_length += field_la__different.RAW_encode(SI10FurtherCellInfo_la__different_descr_, *myleaf.body.node.nodes[0]); if (field_cell__resel__hyst.ispresent()) { encoded_length += field_cell__resel__hyst().RAW_encode(SI10FurtherCellInfo_cell__resel__hyst_descr_, *myleaf.body.node.nodes[1]); } encoded_length += field_ms__txpwr__max__cch.RAW_encode(SI10FurtherCellInfo_ms__txpwr__max__cch_descr_, *myleaf.body.node.nodes[2]); encoded_length += field_rxlev__access__min.RAW_encode(SI10FurtherCellInfo_rxlev__access__min_descr_, *myleaf.body.node.nodes[3]); encoded_length += field_cell__resel__offset.RAW_encode(SI10FurtherCellInfo_cell__resel__offset_descr_, *myleaf.body.node.nodes[4]); encoded_length += field_temp__offset.RAW_encode(SI10FurtherCellInfo_temp__offset_descr_, *myleaf.body.node.nodes[5]); encoded_length += field_penalty__time.RAW_encode(SI10FurtherCellInfo_penalty__time_descr_, *myleaf.body.node.nodes[6]); if (field_cell__resel__hyst.ispresent() && (field_la__different != 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(SI10FurtherCellInfo_la__different_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 SI10FurtherCellInfo_template::single_value_struct { BITSTRING_template field_la__different; INTEGER_template field_cell__resel__hyst; INTEGER_template field_ms__txpwr__max__cch; INTEGER_template field_rxlev__access__min; INTEGER_template field_cell__resel__offset; INTEGER_template field_temp__offset; INTEGER_template field_penalty__time; }; void SI10FurtherCellInfo_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_la__different = ANY_VALUE; single_value->field_cell__resel__hyst = ANY_OR_OMIT; single_value->field_ms__txpwr__max__cch = ANY_VALUE; single_value->field_rxlev__access__min = ANY_VALUE; single_value->field_cell__resel__offset = ANY_VALUE; single_value->field_temp__offset = ANY_VALUE; single_value->field_penalty__time = ANY_VALUE; } } } void SI10FurtherCellInfo_template::copy_value(const SI10FurtherCellInfo& other_value) { single_value = new single_value_struct; if (other_value.la__different().is_bound()) { single_value->field_la__different = other_value.la__different(); } else { single_value->field_la__different.clean_up(); } if (other_value.cell__resel__hyst().is_bound()) { if (other_value.cell__resel__hyst().ispresent()) single_value->field_cell__resel__hyst = other_value.cell__resel__hyst()(); else single_value->field_cell__resel__hyst = OMIT_VALUE; } else { single_value->field_cell__resel__hyst.clean_up(); } if (other_value.ms__txpwr__max__cch().is_bound()) { single_value->field_ms__txpwr__max__cch = other_value.ms__txpwr__max__cch(); } else { single_value->field_ms__txpwr__max__cch.clean_up(); } if (other_value.rxlev__access__min().is_bound()) { single_value->field_rxlev__access__min = other_value.rxlev__access__min(); } else { single_value->field_rxlev__access__min.clean_up(); } if (other_value.cell__resel__offset().is_bound()) { single_value->field_cell__resel__offset = other_value.cell__resel__offset(); } else { single_value->field_cell__resel__offset.clean_up(); } if (other_value.temp__offset().is_bound()) { single_value->field_temp__offset = other_value.temp__offset(); } else { single_value->field_temp__offset.clean_up(); } if (other_value.penalty__time().is_bound()) { single_value->field_penalty__time = other_value.penalty__time(); } else { single_value->field_penalty__time.clean_up(); } set_selection(SPECIFIC_VALUE); } void SI10FurtherCellInfo_template::copy_template(const SI10FurtherCellInfo_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.la__different().get_selection()) { single_value->field_la__different = other_value.la__different(); } else { single_value->field_la__different.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.cell__resel__hyst().get_selection()) { single_value->field_cell__resel__hyst = other_value.cell__resel__hyst(); } else { single_value->field_cell__resel__hyst.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.ms__txpwr__max__cch().get_selection()) { single_value->field_ms__txpwr__max__cch = other_value.ms__txpwr__max__cch(); } else { single_value->field_ms__txpwr__max__cch.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.rxlev__access__min().get_selection()) { single_value->field_rxlev__access__min = other_value.rxlev__access__min(); } else { single_value->field_rxlev__access__min.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.cell__resel__offset().get_selection()) { single_value->field_cell__resel__offset = other_value.cell__resel__offset(); } else { single_value->field_cell__resel__offset.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.temp__offset().get_selection()) { single_value->field_temp__offset = other_value.temp__offset(); } else { single_value->field_temp__offset.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.penalty__time().get_selection()) { single_value->field_penalty__time = other_value.penalty__time(); } else { single_value->field_penalty__time.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 SI10FurtherCellInfo_template[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 SI10FurtherCellInfo_template(*other_value.implication_.precondition); implication_.implied_template = new SI10FurtherCellInfo_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.SI10FurtherCellInfo."); break; } set_selection(other_value); } SI10FurtherCellInfo_template::SI10FurtherCellInfo_template() { } SI10FurtherCellInfo_template::SI10FurtherCellInfo_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } SI10FurtherCellInfo_template::SI10FurtherCellInfo_template(const SI10FurtherCellInfo& other_value) { copy_value(other_value); } SI10FurtherCellInfo_template::SI10FurtherCellInfo_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI10FurtherCellInfo&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.SI10FurtherCellInfo from an unbound optional field."); } } SI10FurtherCellInfo_template::SI10FurtherCellInfo_template(SI10FurtherCellInfo_template* p_precondition, SI10FurtherCellInfo_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } SI10FurtherCellInfo_template::SI10FurtherCellInfo_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; } SI10FurtherCellInfo_template::SI10FurtherCellInfo_template(const SI10FurtherCellInfo_template& other_value) : Base_Template() { copy_template(other_value); } SI10FurtherCellInfo_template::~SI10FurtherCellInfo_template() { clean_up(); } SI10FurtherCellInfo_template& SI10FurtherCellInfo_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } SI10FurtherCellInfo_template& SI10FurtherCellInfo_template::operator=(const SI10FurtherCellInfo& other_value) { clean_up(); copy_value(other_value); return *this; } SI10FurtherCellInfo_template& SI10FurtherCellInfo_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI10FurtherCellInfo&)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.SI10FurtherCellInfo."); } return *this; } SI10FurtherCellInfo_template& SI10FurtherCellInfo_template::operator=(const SI10FurtherCellInfo_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean SI10FurtherCellInfo_template::match(const SI10FurtherCellInfo& 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.la__different().is_bound()) return FALSE; if(!single_value->field_la__different.match(other_value.la__different(), legacy))return FALSE; if(!other_value.cell__resel__hyst().is_bound()) return FALSE; if((other_value.cell__resel__hyst().ispresent() ? !single_value->field_cell__resel__hyst.match((const INTEGER&)other_value.cell__resel__hyst(), legacy) : !single_value->field_cell__resel__hyst.match_omit(legacy)))return FALSE; if(!other_value.ms__txpwr__max__cch().is_bound()) return FALSE; if(!single_value->field_ms__txpwr__max__cch.match(other_value.ms__txpwr__max__cch(), legacy))return FALSE; if(!other_value.rxlev__access__min().is_bound()) return FALSE; if(!single_value->field_rxlev__access__min.match(other_value.rxlev__access__min(), legacy))return FALSE; if(!other_value.cell__resel__offset().is_bound()) return FALSE; if(!single_value->field_cell__resel__offset.match(other_value.cell__resel__offset(), legacy))return FALSE; if(!other_value.temp__offset().is_bound()) return FALSE; if(!single_value->field_temp__offset.match(other_value.temp__offset(), legacy))return FALSE; if(!other_value.penalty__time().is_bound()) return FALSE; if(!single_value->field_penalty__time.match(other_value.penalty__time(), 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.SI10FurtherCellInfo."); } return FALSE; } boolean SI10FurtherCellInfo_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_la__different.is_bound() || (single_value->field_cell__resel__hyst.is_omit() || single_value->field_cell__resel__hyst.is_bound()) || single_value->field_ms__txpwr__max__cch.is_bound() || single_value->field_rxlev__access__min.is_bound() || single_value->field_cell__resel__offset.is_bound() || single_value->field_temp__offset.is_bound() || single_value->field_penalty__time.is_bound(); } boolean SI10FurtherCellInfo_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_la__different.is_value() && (single_value->field_cell__resel__hyst.is_omit() || single_value->field_cell__resel__hyst.is_value()) && single_value->field_ms__txpwr__max__cch.is_value() && single_value->field_rxlev__access__min.is_value() && single_value->field_cell__resel__offset.is_value() && single_value->field_temp__offset.is_value() && single_value->field_penalty__time.is_value(); } void SI10FurtherCellInfo_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; } SI10FurtherCellInfo SI10FurtherCellInfo_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.SI10FurtherCellInfo."); SI10FurtherCellInfo ret_val; if (single_value->field_la__different.is_bound()) { ret_val.la__different() = single_value->field_la__different.valueof(); } if (single_value->field_cell__resel__hyst.is_omit()) ret_val.cell__resel__hyst() = OMIT_VALUE; else if (single_value->field_cell__resel__hyst.is_bound()) { ret_val.cell__resel__hyst() = single_value->field_cell__resel__hyst.valueof(); } if (single_value->field_ms__txpwr__max__cch.is_bound()) { ret_val.ms__txpwr__max__cch() = single_value->field_ms__txpwr__max__cch.valueof(); } if (single_value->field_rxlev__access__min.is_bound()) { ret_val.rxlev__access__min() = single_value->field_rxlev__access__min.valueof(); } if (single_value->field_cell__resel__offset.is_bound()) { ret_val.cell__resel__offset() = single_value->field_cell__resel__offset.valueof(); } if (single_value->field_temp__offset.is_bound()) { ret_val.temp__offset() = single_value->field_temp__offset.valueof(); } if (single_value->field_penalty__time.is_bound()) { ret_val.penalty__time() = single_value->field_penalty__time.valueof(); } return ret_val; } void SI10FurtherCellInfo_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.SI10FurtherCellInfo."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new SI10FurtherCellInfo_template[list_length]; } SI10FurtherCellInfo_template& SI10FurtherCellInfo_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.SI10FurtherCellInfo."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.SI10FurtherCellInfo."); return value_list.list_value[list_index]; } BITSTRING_template& SI10FurtherCellInfo_template::la__different() { set_specific(); return single_value->field_la__different; } const BITSTRING_template& SI10FurtherCellInfo_template::la__different() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field la_different of a non-specific template of type @GSM_RestOctets.SI10FurtherCellInfo."); return single_value->field_la__different; } INTEGER_template& SI10FurtherCellInfo_template::cell__resel__hyst() { set_specific(); return single_value->field_cell__resel__hyst; } const INTEGER_template& SI10FurtherCellInfo_template::cell__resel__hyst() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field cell_resel_hyst of a non-specific template of type @GSM_RestOctets.SI10FurtherCellInfo."); return single_value->field_cell__resel__hyst; } INTEGER_template& SI10FurtherCellInfo_template::ms__txpwr__max__cch() { set_specific(); return single_value->field_ms__txpwr__max__cch; } const INTEGER_template& SI10FurtherCellInfo_template::ms__txpwr__max__cch() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ms_txpwr_max_cch of a non-specific template of type @GSM_RestOctets.SI10FurtherCellInfo."); return single_value->field_ms__txpwr__max__cch; } INTEGER_template& SI10FurtherCellInfo_template::rxlev__access__min() { set_specific(); return single_value->field_rxlev__access__min; } const INTEGER_template& SI10FurtherCellInfo_template::rxlev__access__min() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field rxlev_access_min of a non-specific template of type @GSM_RestOctets.SI10FurtherCellInfo."); return single_value->field_rxlev__access__min; } INTEGER_template& SI10FurtherCellInfo_template::cell__resel__offset() { set_specific(); return single_value->field_cell__resel__offset; } const INTEGER_template& SI10FurtherCellInfo_template::cell__resel__offset() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field cell_resel_offset of a non-specific template of type @GSM_RestOctets.SI10FurtherCellInfo."); return single_value->field_cell__resel__offset; } INTEGER_template& SI10FurtherCellInfo_template::temp__offset() { set_specific(); return single_value->field_temp__offset; } const INTEGER_template& SI10FurtherCellInfo_template::temp__offset() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field temp_offset of a non-specific template of type @GSM_RestOctets.SI10FurtherCellInfo."); return single_value->field_temp__offset; } INTEGER_template& SI10FurtherCellInfo_template::penalty__time() { set_specific(); return single_value->field_penalty__time; } const INTEGER_template& SI10FurtherCellInfo_template::penalty__time() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field penalty_time of a non-specific template of type @GSM_RestOctets.SI10FurtherCellInfo."); return single_value->field_penalty__time; } int SI10FurtherCellInfo_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10FurtherCellInfo which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 6; if (single_value->field_cell__resel__hyst.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.SI10FurtherCellInfo 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.SI10FurtherCellInfo 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.SI10FurtherCellInfo containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10FurtherCellInfo containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10FurtherCellInfo containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10FurtherCellInfo containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10FurtherCellInfo containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10FurtherCellInfo containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.SI10FurtherCellInfo."); } return 0; } void SI10FurtherCellInfo_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ la_different := "); single_value->field_la__different.log(); TTCN_Logger::log_event_str(", cell_resel_hyst := "); single_value->field_cell__resel__hyst.log(); TTCN_Logger::log_event_str(", ms_txpwr_max_cch := "); single_value->field_ms__txpwr__max__cch.log(); TTCN_Logger::log_event_str(", rxlev_access_min := "); single_value->field_rxlev__access__min.log(); TTCN_Logger::log_event_str(", cell_resel_offset := "); single_value->field_cell__resel__offset.log(); TTCN_Logger::log_event_str(", temp_offset := "); single_value->field_temp__offset.log(); TTCN_Logger::log_event_str(", penalty_time := "); single_value->field_penalty__time.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 SI10FurtherCellInfo_template::log_match(const SI10FurtherCellInfo& 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_la__different.match(match_value.la__different(), legacy)){ TTCN_Logger::log_logmatch_info(".la_different"); single_value->field_la__different.log_match(match_value.la__different(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.cell__resel__hyst().ispresent()){ if(!single_value->field_cell__resel__hyst.match(match_value.cell__resel__hyst(), legacy)){ TTCN_Logger::log_logmatch_info(".cell_resel_hyst"); single_value->field_cell__resel__hyst.log_match(match_value.cell__resel__hyst(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_cell__resel__hyst.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".cell_resel_hyst := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_cell__resel__hyst.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if(!single_value->field_ms__txpwr__max__cch.match(match_value.ms__txpwr__max__cch(), legacy)){ TTCN_Logger::log_logmatch_info(".ms_txpwr_max_cch"); single_value->field_ms__txpwr__max__cch.log_match(match_value.ms__txpwr__max__cch(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_rxlev__access__min.match(match_value.rxlev__access__min(), legacy)){ TTCN_Logger::log_logmatch_info(".rxlev_access_min"); single_value->field_rxlev__access__min.log_match(match_value.rxlev__access__min(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_cell__resel__offset.match(match_value.cell__resel__offset(), legacy)){ TTCN_Logger::log_logmatch_info(".cell_resel_offset"); single_value->field_cell__resel__offset.log_match(match_value.cell__resel__offset(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_temp__offset.match(match_value.temp__offset(), legacy)){ TTCN_Logger::log_logmatch_info(".temp_offset"); single_value->field_temp__offset.log_match(match_value.temp__offset(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_penalty__time.match(match_value.penalty__time(), legacy)){ TTCN_Logger::log_logmatch_info(".penalty_time"); single_value->field_penalty__time.log_match(match_value.penalty__time(), 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("{ la_different := "); single_value->field_la__different.log_match(match_value.la__different(), legacy); TTCN_Logger::log_event_str(", cell_resel_hyst := "); if (match_value.cell__resel__hyst().ispresent()) { single_value->field_cell__resel__hyst.log_match(match_value.cell__resel__hyst(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_cell__resel__hyst.log(); if (single_value->field_cell__resel__hyst.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", ms_txpwr_max_cch := "); single_value->field_ms__txpwr__max__cch.log_match(match_value.ms__txpwr__max__cch(), legacy); TTCN_Logger::log_event_str(", rxlev_access_min := "); single_value->field_rxlev__access__min.log_match(match_value.rxlev__access__min(), legacy); TTCN_Logger::log_event_str(", cell_resel_offset := "); single_value->field_cell__resel__offset.log_match(match_value.cell__resel__offset(), legacy); TTCN_Logger::log_event_str(", temp_offset := "); single_value->field_temp__offset.log_match(match_value.temp__offset(), legacy); TTCN_Logger::log_event_str(", penalty_time := "); single_value->field_penalty__time.log_match(match_value.penalty__time(), 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 SI10FurtherCellInfo_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (la__different().is_bound()) la__different().set_implicit_omit(); if (!cell__resel__hyst().is_bound()) cell__resel__hyst() = OMIT_VALUE; else cell__resel__hyst().set_implicit_omit(); if (ms__txpwr__max__cch().is_bound()) ms__txpwr__max__cch().set_implicit_omit(); if (rxlev__access__min().is_bound()) rxlev__access__min().set_implicit_omit(); if (cell__resel__offset().is_bound()) cell__resel__offset().set_implicit_omit(); if (temp__offset().is_bound()) temp__offset().set_implicit_omit(); if (penalty__time().is_bound()) penalty__time().set_implicit_omit(); } void SI10FurtherCellInfo_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_la__different.encode_text(text_buf); single_value->field_cell__resel__hyst.encode_text(text_buf); single_value->field_ms__txpwr__max__cch.encode_text(text_buf); single_value->field_rxlev__access__min.encode_text(text_buf); single_value->field_cell__resel__offset.encode_text(text_buf); single_value->field_temp__offset.encode_text(text_buf); single_value->field_penalty__time.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.SI10FurtherCellInfo."); } } void SI10FurtherCellInfo_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_la__different.decode_text(text_buf); single_value->field_cell__resel__hyst.decode_text(text_buf); single_value->field_ms__txpwr__max__cch.decode_text(text_buf); single_value->field_rxlev__access__min.decode_text(text_buf); single_value->field_cell__resel__offset.decode_text(text_buf); single_value->field_temp__offset.decode_text(text_buf); single_value->field_penalty__time.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 SI10FurtherCellInfo_template[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.SI10FurtherCellInfo."); } } void SI10FurtherCellInfo_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: { SI10FurtherCellInfo_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) la__different().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) cell__resel__hyst().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) ms__txpwr__max__cch().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) rxlev__access__min().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) cell__resel__offset().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) temp__offset().set_param(*param.get_elem(5)); if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) penalty__time().set_param(*param.get_elem(6)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "la_different")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { la__different().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "cell_resel_hyst")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cell__resel__hyst().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ms_txpwr_max_cch")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ms__txpwr__max__cch().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "rxlev_access_min")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rxlev__access__min().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "cell_resel_offset")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cell__resel__offset().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "temp_offset")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { temp__offset().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "penalty_time")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { penalty__time().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.SI10FurtherCellInfo: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { SI10FurtherCellInfo_template* precondition = new SI10FurtherCellInfo_template; precondition->set_param(*param.get_elem(0)); SI10FurtherCellInfo_template* implied_template = new SI10FurtherCellInfo_template; implied_template->set_param(*param.get_elem(1)); *this = SI10FurtherCellInfo_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.SI10FurtherCellInfo"); } is_ifpresent = param.get_ifpresent(); } void SI10FurtherCellInfo_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_la__different.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI10FurtherCellInfo"); single_value->field_cell__resel__hyst.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI10FurtherCellInfo"); single_value->field_ms__txpwr__max__cch.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI10FurtherCellInfo"); single_value->field_rxlev__access__min.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI10FurtherCellInfo"); single_value->field_cell__resel__offset.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI10FurtherCellInfo"); single_value->field_temp__offset.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI10FurtherCellInfo"); single_value->field_penalty__time.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI10FurtherCellInfo"); 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.SI10FurtherCellInfo"); } boolean SI10FurtherCellInfo_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean SI10FurtherCellInfo_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, const BITSTRING& par_info__field__term) : field_first__freq(par_first__freq), field_cell__info(par_cell__info), field_info__field(par_info__field), field_info__field__term(par_info__field__term) { } SI10NeighInfo::SI10NeighInfo(const SI10NeighInfo& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.SI10NeighInfo."); if (other_value.first__freq().is_bound()) field_first__freq = other_value.first__freq(); else field_first__freq.clean_up(); if (other_value.cell__info().is_bound()) field_cell__info = other_value.cell__info(); else field_cell__info.clean_up(); if (other_value.info__field().is_bound()) field_info__field = other_value.info__field(); else field_info__field.clean_up(); if (other_value.info__field__term().is_bound()) field_info__field__term = other_value.info__field__term(); else field_info__field__term.clean_up(); } void SI10NeighInfo::clean_up() { field_first__freq.clean_up(); field_cell__info.clean_up(); field_info__field.clean_up(); field_info__field__term.clean_up(); } const TTCN_Typedescriptor_t* SI10NeighInfo::get_descriptor() const { return &SI10NeighInfo_descr_; } SI10NeighInfo& SI10NeighInfo::operator=(const SI10NeighInfo& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.SI10NeighInfo."); if (other_value.first__freq().is_bound()) field_first__freq = other_value.first__freq(); else field_first__freq.clean_up(); if (other_value.cell__info().is_bound()) field_cell__info = other_value.cell__info(); else field_cell__info.clean_up(); if (other_value.info__field().is_bound()) field_info__field = other_value.info__field(); else field_info__field.clean_up(); if (other_value.info__field__term().is_bound()) field_info__field__term = other_value.info__field__term(); else field_info__field__term.clean_up(); } return *this; } boolean SI10NeighInfo::operator==(const SI10NeighInfo& other_value) const { return field_first__freq==other_value.field_first__freq && field_cell__info==other_value.field_cell__info && field_info__field==other_value.field_info__field && field_info__field__term==other_value.field_info__field__term; } boolean SI10NeighInfo::is_bound() const { return (field_first__freq.is_bound()) || (field_cell__info.is_bound()) || (OPTIONAL_OMIT == field_info__field.get_selection() || field_info__field.is_bound()) || (field_info__field__term.is_bound()); } boolean SI10NeighInfo::is_value() const { return field_first__freq.is_value() && field_cell__info.is_value() && (OPTIONAL_OMIT == field_info__field.get_selection() || field_info__field.is_value()) && field_info__field__term.is_value(); } int SI10NeighInfo::size_of() const { int ret_val = 3; if (field_info__field.ispresent()) ret_val++; return ret_val; } void SI10NeighInfo::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ first_freq := "); field_first__freq.log(); TTCN_Logger::log_event_str(", cell_info := "); field_cell__info.log(); TTCN_Logger::log_event_str(", info_field := "); field_info__field.log(); TTCN_Logger::log_event_str(", info_field_term := "); field_info__field__term.log(); TTCN_Logger::log_event_str(" }"); } void SI10NeighInfo::set_implicit_omit() { if (first__freq().is_bound()) first__freq().set_implicit_omit(); if (cell__info().is_bound()) cell__info().set_implicit_omit(); if (!info__field().is_bound()) info__field() = OMIT_VALUE; else info__field().set_implicit_omit(); if (info__field__term().is_bound()) info__field__term().set_implicit_omit(); } void SI10NeighInfo::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) first__freq().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) cell__info().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) info__field().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) info__field__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(), "first_freq")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { first__freq().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "cell_info")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cell__info().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "info_field")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { info__field().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "info_field_term")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { info__field__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.SI10NeighInfo: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.SI10NeighInfo"); } } void SI10NeighInfo::encode_text(Text_Buf& text_buf) const { field_first__freq.encode_text(text_buf); field_cell__info.encode_text(text_buf); field_info__field.encode_text(text_buf); field_info__field__term.encode_text(text_buf); } void SI10NeighInfo::decode_text(Text_Buf& text_buf) { field_first__freq.decode_text(text_buf); field_cell__info.decode_text(text_buf); field_info__field.decode_text(text_buf); field_info__field__term.decode_text(text_buf); } void SI10NeighInfo::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 SI10NeighInfo::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 SI10NeighInfo::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, SI10NeighInfo_first__freq_descr_.raw->forceomit); decoded_field_length = field_first__freq.RAW_decode(SI10NeighInfo_first__freq_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, SI10NeighInfo_cell__info_descr_.raw->forceomit); decoded_field_length = field_cell__info.RAW_decode(SI10NeighInfo_cell__info_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_info__field = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_2_force_omit(2, force_omit, SI10NeighInfo_info__field_descr_.raw->forceomit); decoded_field_length = field_info__field().RAW_decode(SI10NeighInfo_info__field_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_2_force_omit); if (decoded_field_length < 1) { field_info__field = 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__field=OMIT_VALUE; RAW_Force_Omit field_3_force_omit(3, force_omit, SI10NeighInfo_info__field__term_descr_.raw->forceomit); decoded_field_length = field_info__field__term.RAW_decode(SI10NeighInfo_info__field__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()); p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int SI10NeighInfo::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, SI10NeighInfo_first__freq_descr_.raw); myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, SI10NeighInfo_cell__info_descr_.raw); if (field_info__field.ispresent()) { myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, SI10NeighInfo_info__field_descr_.raw); } else myleaf.body.node.nodes[2] = NULL; myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, SI10NeighInfo_info__field__term_descr_.raw); encoded_length += field_first__freq.RAW_encode(SI10NeighInfo_first__freq_descr_, *myleaf.body.node.nodes[0]); encoded_length += field_cell__info.RAW_encode(SI10NeighInfo_cell__info_descr_, *myleaf.body.node.nodes[1]); if (field_info__field.ispresent()) { encoded_length += field_info__field().RAW_encode(SI10NeighInfo_info__field_descr_, *myleaf.body.node.nodes[2]); } encoded_length += field_info__field__term.RAW_encode(SI10NeighInfo_info__field__term_descr_, *myleaf.body.node.nodes[3]); return myleaf.length = encoded_length; } struct SI10NeighInfo_template::single_value_struct { INTEGER_template field_first__freq; SI10CellInfo_template field_cell__info; SI10InfoFieldList_template field_info__field; BITSTRING_template field_info__field__term; }; void SI10NeighInfo_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_first__freq = ANY_VALUE; single_value->field_cell__info = ANY_VALUE; single_value->field_info__field = ANY_OR_OMIT; single_value->field_info__field__term = ANY_VALUE; } } } void SI10NeighInfo_template::copy_value(const SI10NeighInfo& other_value) { single_value = new single_value_struct; if (other_value.first__freq().is_bound()) { single_value->field_first__freq = other_value.first__freq(); } else { single_value->field_first__freq.clean_up(); } if (other_value.cell__info().is_bound()) { single_value->field_cell__info = other_value.cell__info(); } else { single_value->field_cell__info.clean_up(); } if (other_value.info__field().is_bound()) { if (other_value.info__field().ispresent()) single_value->field_info__field = other_value.info__field()(); else single_value->field_info__field = OMIT_VALUE; } else { single_value->field_info__field.clean_up(); } if (other_value.info__field__term().is_bound()) { single_value->field_info__field__term = other_value.info__field__term(); } else { single_value->field_info__field__term.clean_up(); } set_selection(SPECIFIC_VALUE); } void SI10NeighInfo_template::copy_template(const SI10NeighInfo_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.first__freq().get_selection()) { single_value->field_first__freq = other_value.first__freq(); } else { single_value->field_first__freq.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.cell__info().get_selection()) { single_value->field_cell__info = other_value.cell__info(); } else { single_value->field_cell__info.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.info__field().get_selection()) { single_value->field_info__field = other_value.info__field(); } else { single_value->field_info__field.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.info__field__term().get_selection()) { single_value->field_info__field__term = other_value.info__field__term(); } else { single_value->field_info__field__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 SI10NeighInfo_template[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 SI10NeighInfo_template(*other_value.implication_.precondition); implication_.implied_template = new SI10NeighInfo_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.SI10NeighInfo."); break; } set_selection(other_value); } SI10NeighInfo_template::SI10NeighInfo_template() { } SI10NeighInfo_template::SI10NeighInfo_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } SI10NeighInfo_template::SI10NeighInfo_template(const SI10NeighInfo& other_value) { copy_value(other_value); } SI10NeighInfo_template::SI10NeighInfo_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI10NeighInfo&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.SI10NeighInfo from an unbound optional field."); } } SI10NeighInfo_template::SI10NeighInfo_template(SI10NeighInfo_template* p_precondition, SI10NeighInfo_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } SI10NeighInfo_template::SI10NeighInfo_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; } SI10NeighInfo_template::SI10NeighInfo_template(const SI10NeighInfo_template& other_value) : Base_Template() { copy_template(other_value); } SI10NeighInfo_template::~SI10NeighInfo_template() { clean_up(); } SI10NeighInfo_template& SI10NeighInfo_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } SI10NeighInfo_template& SI10NeighInfo_template::operator=(const SI10NeighInfo& other_value) { clean_up(); copy_value(other_value); return *this; } SI10NeighInfo_template& SI10NeighInfo_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI10NeighInfo&)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.SI10NeighInfo."); } return *this; } SI10NeighInfo_template& SI10NeighInfo_template::operator=(const SI10NeighInfo_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean SI10NeighInfo_template::match(const SI10NeighInfo& 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.first__freq().is_bound()) return FALSE; if(!single_value->field_first__freq.match(other_value.first__freq(), legacy))return FALSE; if(!other_value.cell__info().is_bound()) return FALSE; if(!single_value->field_cell__info.match(other_value.cell__info(), legacy))return FALSE; if(!other_value.info__field().is_bound()) return FALSE; if((other_value.info__field().ispresent() ? !single_value->field_info__field.match((const SI10InfoFieldList&)other_value.info__field(), legacy) : !single_value->field_info__field.match_omit(legacy)))return FALSE; if(!other_value.info__field__term().is_bound()) return FALSE; if(!single_value->field_info__field__term.match(other_value.info__field__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.SI10NeighInfo."); } return FALSE; } boolean SI10NeighInfo_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_first__freq.is_bound() || single_value->field_cell__info.is_bound() || (single_value->field_info__field.is_omit() || single_value->field_info__field.is_bound()) || single_value->field_info__field__term.is_bound(); } boolean SI10NeighInfo_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_first__freq.is_value() && single_value->field_cell__info.is_value() && (single_value->field_info__field.is_omit() || single_value->field_info__field.is_value()) && single_value->field_info__field__term.is_value(); } void SI10NeighInfo_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; } SI10NeighInfo SI10NeighInfo_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.SI10NeighInfo."); SI10NeighInfo ret_val; if (single_value->field_first__freq.is_bound()) { ret_val.first__freq() = single_value->field_first__freq.valueof(); } if (single_value->field_cell__info.is_bound()) { ret_val.cell__info() = single_value->field_cell__info.valueof(); } if (single_value->field_info__field.is_omit()) ret_val.info__field() = OMIT_VALUE; else if (single_value->field_info__field.is_bound()) { ret_val.info__field() = single_value->field_info__field.valueof(); } if (single_value->field_info__field__term.is_bound()) { ret_val.info__field__term() = single_value->field_info__field__term.valueof(); } return ret_val; } void SI10NeighInfo_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.SI10NeighInfo."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new SI10NeighInfo_template[list_length]; } SI10NeighInfo_template& SI10NeighInfo_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.SI10NeighInfo."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.SI10NeighInfo."); return value_list.list_value[list_index]; } INTEGER_template& SI10NeighInfo_template::first__freq() { set_specific(); return single_value->field_first__freq; } const INTEGER_template& SI10NeighInfo_template::first__freq() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field first_freq of a non-specific template of type @GSM_RestOctets.SI10NeighInfo."); return single_value->field_first__freq; } SI10CellInfo_template& SI10NeighInfo_template::cell__info() { set_specific(); return single_value->field_cell__info; } const SI10CellInfo_template& SI10NeighInfo_template::cell__info() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field cell_info of a non-specific template of type @GSM_RestOctets.SI10NeighInfo."); return single_value->field_cell__info; } SI10InfoFieldList_template& SI10NeighInfo_template::info__field() { set_specific(); return single_value->field_info__field; } const SI10InfoFieldList_template& SI10NeighInfo_template::info__field() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field info_field of a non-specific template of type @GSM_RestOctets.SI10NeighInfo."); return single_value->field_info__field; } BITSTRING_template& SI10NeighInfo_template::info__field__term() { set_specific(); return single_value->field_info__field__term; } const BITSTRING_template& SI10NeighInfo_template::info__field__term() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field info_field_term of a non-specific template of type @GSM_RestOctets.SI10NeighInfo."); return single_value->field_info__field__term; } int SI10NeighInfo_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10NeighInfo which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 3; if (single_value->field_info__field.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.SI10NeighInfo 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.SI10NeighInfo 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.SI10NeighInfo containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10NeighInfo containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10NeighInfo containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10NeighInfo containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10NeighInfo containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10NeighInfo containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.SI10NeighInfo."); } return 0; } void SI10NeighInfo_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ first_freq := "); single_value->field_first__freq.log(); TTCN_Logger::log_event_str(", cell_info := "); single_value->field_cell__info.log(); TTCN_Logger::log_event_str(", info_field := "); single_value->field_info__field.log(); TTCN_Logger::log_event_str(", info_field_term := "); single_value->field_info__field__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 SI10NeighInfo_template::log_match(const SI10NeighInfo& 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_first__freq.match(match_value.first__freq(), legacy)){ TTCN_Logger::log_logmatch_info(".first_freq"); single_value->field_first__freq.log_match(match_value.first__freq(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if(!single_value->field_cell__info.match(match_value.cell__info(), legacy)){ TTCN_Logger::log_logmatch_info(".cell_info"); single_value->field_cell__info.log_match(match_value.cell__info(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.info__field().ispresent()){ if(!single_value->field_info__field.match(match_value.info__field(), legacy)){ TTCN_Logger::log_logmatch_info(".info_field"); single_value->field_info__field.log_match(match_value.info__field(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_info__field.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".info_field := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_info__field.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if(!single_value->field_info__field__term.match(match_value.info__field__term(), legacy)){ TTCN_Logger::log_logmatch_info(".info_field_term"); single_value->field_info__field__term.log_match(match_value.info__field__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("{ first_freq := "); single_value->field_first__freq.log_match(match_value.first__freq(), legacy); TTCN_Logger::log_event_str(", cell_info := "); single_value->field_cell__info.log_match(match_value.cell__info(), legacy); TTCN_Logger::log_event_str(", info_field := "); if (match_value.info__field().ispresent()) { single_value->field_info__field.log_match(match_value.info__field(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_info__field.log(); if (single_value->field_info__field.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", info_field_term := "); single_value->field_info__field__term.log_match(match_value.info__field__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 SI10NeighInfo_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (first__freq().is_bound()) first__freq().set_implicit_omit(); if (cell__info().is_bound()) cell__info().set_implicit_omit(); if (!info__field().is_bound()) info__field() = OMIT_VALUE; else info__field().set_implicit_omit(); if (info__field__term().is_bound()) info__field__term().set_implicit_omit(); } void SI10NeighInfo_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_first__freq.encode_text(text_buf); single_value->field_cell__info.encode_text(text_buf); single_value->field_info__field.encode_text(text_buf); single_value->field_info__field__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.SI10NeighInfo."); } } void SI10NeighInfo_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_first__freq.decode_text(text_buf); single_value->field_cell__info.decode_text(text_buf); single_value->field_info__field.decode_text(text_buf); single_value->field_info__field__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 SI10NeighInfo_template[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.SI10NeighInfo."); } } void SI10NeighInfo_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: { SI10NeighInfo_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) first__freq().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) cell__info().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) info__field().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) info__field__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(), "first_freq")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { first__freq().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "cell_info")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cell__info().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "info_field")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { info__field().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "info_field_term")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { info__field__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.SI10NeighInfo: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { SI10NeighInfo_template* precondition = new SI10NeighInfo_template; precondition->set_param(*param.get_elem(0)); SI10NeighInfo_template* implied_template = new SI10NeighInfo_template; implied_template->set_param(*param.get_elem(1)); *this = SI10NeighInfo_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.SI10NeighInfo"); } is_ifpresent = param.get_ifpresent(); } void SI10NeighInfo_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_first__freq.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI10NeighInfo"); single_value->field_cell__info.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI10NeighInfo"); single_value->field_info__field.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI10NeighInfo"); single_value->field_info__field__term.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI10NeighInfo"); 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.SI10NeighInfo"); } boolean SI10NeighInfo_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean SI10NeighInfo_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; } SI10InfoFieldList::SI10InfoFieldList(const SI10InfoFieldList& other_value) { if (!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.SI10InfoFieldList."); val_ptr = other_value.val_ptr; val_ptr->ref_count++; } SI10InfoFieldList::~SI10InfoFieldList() { clean_up(); if (val_ptr != NULL) val_ptr = NULL; } void SI10InfoFieldList::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."); } } SI10InfoFieldList& SI10InfoFieldList::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; } SI10InfoFieldList& SI10InfoFieldList::operator=(const SI10InfoFieldList& other_value) { if (other_value.val_ptr == NULL) TTCN_error("Assigning an unbound value of type @GSM_RestOctets.SI10InfoFieldList."); if (this != &other_value) { clean_up(); val_ptr = other_value.val_ptr; val_ptr->ref_count++; } return *this; } boolean SI10InfoFieldList::operator==(null_type) const { if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @GSM_RestOctets.SI10InfoFieldList."); return val_ptr->n_elements == 0 ; } boolean SI10InfoFieldList::operator==(const SI10InfoFieldList& other_value) const { if (val_ptr == NULL) TTCN_error("The left operand of comparison is an unbound value of type @GSM_RestOctets.SI10InfoFieldList."); if (other_value.val_ptr == NULL) TTCN_error("The right operand of comparison is an unbound value of type @GSM_RestOctets.SI10InfoFieldList."); 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; } SI10InfoField& SI10InfoFieldList::operator[](int index_value) { if (index_value < 0) TTCN_error("Accessing an element of type @GSM_RestOctets.SI10InfoFieldList 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 = (SI10InfoField**)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 SI10InfoField(*(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 SI10InfoField; } return *val_ptr->value_elements[index_value]; } SI10InfoField& SI10InfoFieldList::operator[](const INTEGER& index_value) { index_value.must_bound("Using an unbound integer value for indexing a value of type @GSM_RestOctets.SI10InfoFieldList."); return (*this)[(int)index_value]; } const SI10InfoField& SI10InfoFieldList::operator[](int index_value) const { if (val_ptr == NULL) TTCN_error("Accessing an element in an unbound value of type @GSM_RestOctets.SI10InfoFieldList."); if (index_value < 0) TTCN_error("Accessing an element of type @GSM_RestOctets.SI10InfoFieldList 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.SI10InfoFieldList: 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 SI10InfoField& SI10InfoFieldList::operator[](const INTEGER& index_value) const { index_value.must_bound("Using an unbound integer value for indexing a value of type @GSM_RestOctets.SI10InfoFieldList."); return (*this)[(int)index_value]; } SI10InfoFieldList SI10InfoFieldList::operator<<=(int rotate_count) const { return *this >>= (-rotate_count); } SI10InfoFieldList SI10InfoFieldList::operator<<=(const INTEGER& rotate_count) const { rotate_count.must_bound("Unbound integer operand of rotate left operator."); return *this >>= (int)(-rotate_count); } SI10InfoFieldList SI10InfoFieldList::operator>>=(const INTEGER& rotate_count) const { rotate_count.must_bound("Unbound integer operand of rotate right operator."); return *this >>= (int)rotate_count; } SI10InfoFieldList SI10InfoFieldList::operator>>=(int rotate_count) const { if (val_ptr == NULL) TTCN_error("Performing rotation operation on an unbound value of type @GSM_RestOctets.SI10InfoFieldList."); 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; SI10InfoFieldList 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 SI10InfoField(*val_ptr->value_elements[i]); } } return ret_val; } SI10InfoFieldList SI10InfoFieldList::operator+(const SI10InfoFieldList& other_value) const { if (val_ptr == NULL || other_value.val_ptr == NULL) TTCN_error("Unbound operand of @GSM_RestOctets.SI10InfoFieldList concatenation."); if (val_ptr->n_elements == 0) return other_value; if (other_value.val_ptr->n_elements == 0) return *this; SI10InfoFieldList 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 SI10InfoField(*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 SI10InfoField(*other_value.val_ptr->value_elements[i]); } } return ret_val; } SI10InfoFieldList SI10InfoFieldList::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.SI10InfoFieldList."); check_substr_arguments(val_ptr->n_elements, index, returncount, "@GSM_RestOctets.SI10InfoFieldList","element"); SI10InfoFieldList ret_val; ret_val.set_size(returncount); for (int i=0; ivalue_elements[i+index] != NULL) { ret_val.val_ptr->value_elements[i] = new SI10InfoField(*val_ptr->value_elements[i+index]); } } return ret_val; } SI10InfoFieldList SI10InfoFieldList::replace(int index, int len, const SI10InfoFieldList& repl) const { if (val_ptr == NULL) TTCN_error("The first argument of replace() is an unbound value of type @GSM_RestOctets.SI10InfoFieldList."); if (repl.val_ptr == NULL) TTCN_error("The fourth argument of replace() is an unbound value of type @GSM_RestOctets.SI10InfoFieldList."); check_replace_arguments(val_ptr->n_elements, index, len, "@GSM_RestOctets.SI10InfoFieldList","element"); SI10InfoFieldList 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 SI10InfoField(*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 SI10InfoField(*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 SI10InfoField(*val_ptr->value_elements[index+i+len]); } } return ret_val; } SI10InfoFieldList SI10InfoFieldList::replace(int index, int len, const SI10InfoFieldList_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 SI10InfoFieldList::set_size(int new_size) { if (new_size < 0) TTCN_error("Internal error: Setting a negative size for a value of type @GSM_RestOctets.SI10InfoFieldList."); 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 = (SI10InfoField**)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 SI10InfoField(*(val_ptr->value_elements[elem_count])); } } clean_up(); val_ptr = new_val_ptr; } if (new_size > val_ptr->n_elements) { val_ptr->value_elements = (SI10InfoField**)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.SI10InfoFieldList: %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 = (SI10InfoField**)reallocate_pointers((void**)val_ptr->value_elements, val_ptr->n_elements, new_size); val_ptr->n_elements = new_size; } } boolean SI10InfoFieldList::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 SI10InfoFieldList::size_of() const { if (val_ptr == NULL) TTCN_error("Performing sizeof operation on an unbound value of type @GSM_RestOctets.SI10InfoFieldList."); return val_ptr->n_elements; } int SI10InfoFieldList::lengthof() const { if (val_ptr == NULL) TTCN_error("Performing lengthof operation on an unbound value of type @GSM_RestOctets.SI10InfoFieldList."); 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 SI10InfoFieldList::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 SI10InfoFieldList::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 SI10InfoFieldList::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.SI10InfoFieldList"); } 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.SI10InfoFieldList"); } break; default: TTCN_error("Internal error: Unknown operation type."); } } void SI10InfoFieldList::encode_text(Text_Buf& text_buf) const { if (val_ptr == NULL) TTCN_error("Text encoder: Encoding an unbound value of type @GSM_RestOctets.SI10InfoFieldList."); 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 SI10InfoFieldList::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.SI10InfoFieldList."); val_ptr->value_elements = (SI10InfoField**)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 SI10InfoField; val_ptr->value_elements[elem_count]->decode_text(text_buf); } } void SI10InfoFieldList::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 SI10InfoFieldList::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 SI10InfoFieldList::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 SI10InfoFieldList::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 SI10InfoFieldList_template::copy_value(const SI10InfoFieldList& other_value) { if (!other_value.is_bound()) TTCN_error("Initialization of a template of type @GSM_RestOctets.SI10InfoFieldList with an unbound value."); single_value.n_elements = other_value.size_of(); single_value.value_elements = (SI10InfoField_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 SI10InfoField_template(other_value[elem_count]); } else { single_value.value_elements[elem_count] = new SI10InfoField_template; } } set_selection(SPECIFIC_VALUE); } void SI10InfoFieldList_template::copy_template(const SI10InfoFieldList_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 = (SI10InfoField_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 SI10InfoField_template(*other_value.single_value.value_elements[elem_count]); } else { single_value.value_elements[elem_count] = new SI10InfoField_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 SI10InfoFieldList_template[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 SI10InfoFieldList_template(*other_value.implication_.precondition); implication_.implied_template = new SI10InfoFieldList_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.SI10InfoFieldList."); break; } set_selection(other_value); } boolean SI10InfoFieldList_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 SI10InfoFieldList_template*)template_ptr)->single_value.value_elements[template_index]->match((*(const SI10InfoFieldList*)value_ptr)[value_index], legacy); else return ((const SI10InfoFieldList_template*)template_ptr)->single_value.value_elements[template_index]->is_any_or_omit(); } SI10InfoFieldList_template::SI10InfoFieldList_template() { } SI10InfoFieldList_template::SI10InfoFieldList_template(template_sel other_value) : Base_Record_Of_Template(other_value) { check_single_selection(other_value); } SI10InfoFieldList_template::SI10InfoFieldList_template(null_type) : Base_Record_Of_Template(SPECIFIC_VALUE) { single_value.n_elements = 0; single_value.value_elements = NULL; } SI10InfoFieldList_template::SI10InfoFieldList_template(const SI10InfoFieldList& other_value) { copy_value(other_value); } SI10InfoFieldList_template::SI10InfoFieldList_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI10InfoFieldList&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.SI10InfoFieldList from an unbound optional field."); } } SI10InfoFieldList_template::SI10InfoFieldList_template(SI10InfoFieldList_template* p_precondition, SI10InfoFieldList_template* p_implied_template) : Base_Record_Of_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } SI10InfoFieldList_template::SI10InfoFieldList_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; } SI10InfoFieldList_template::SI10InfoFieldList_template(const SI10InfoFieldList_template& other_value) : Base_Record_Of_Template() { copy_template(other_value); } SI10InfoFieldList_template::~SI10InfoFieldList_template() { clean_up(); } void SI10InfoFieldList_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; } SI10InfoFieldList_template& SI10InfoFieldList_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } SI10InfoFieldList_template& SI10InfoFieldList_template::operator=(null_type) { clean_up(); set_selection(SPECIFIC_VALUE); single_value.n_elements = 0; single_value.value_elements = NULL; return *this; } SI10InfoFieldList_template& SI10InfoFieldList_template::operator=(const SI10InfoFieldList& other_value) { clean_up(); copy_value(other_value); return *this; } SI10InfoFieldList_template& SI10InfoFieldList_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI10InfoFieldList&)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.SI10InfoFieldList."); } return *this; } SI10InfoFieldList_template& SI10InfoFieldList_template::operator=(const SI10InfoFieldList_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } SI10InfoField_template& SI10InfoFieldList_template::operator[](int index_value) { if (index_value < 0) TTCN_error("Accessing an element of a template for type @GSM_RestOctets.SI10InfoFieldList 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.SI10InfoFieldList."); break; } return *single_value.value_elements[index_value]; } SI10InfoField_template& SI10InfoFieldList_template::operator[](const INTEGER& index_value) { index_value.must_bound("Using an unbound integer value for indexing a template of type @GSM_RestOctets.SI10InfoFieldList."); return (*this)[(int)index_value]; } const SI10InfoField_template& SI10InfoFieldList_template::operator[](int index_value) const { if (index_value < 0) TTCN_error("Accessing an element of a template for type @GSM_RestOctets.SI10InfoFieldList 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.SI10InfoFieldList."); if (index_value >= single_value.n_elements) TTCN_error("Index overflow in a template of type @GSM_RestOctets.SI10InfoFieldList: 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 SI10InfoField_template& SI10InfoFieldList_template::operator[](const INTEGER& index_value) const { index_value.must_bound("Using an unbound integer value for indexing a template of type @GSM_RestOctets.SI10InfoFieldList."); return (*this)[(int)index_value]; } void SI10InfoFieldList_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.SI10InfoFieldList."); 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 = (SI10InfoField_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 SI10InfoField_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 SI10InfoField_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 = (SI10InfoField_template**)reallocate_pointers((void**)single_value.value_elements, single_value.n_elements, new_size); single_value.n_elements = new_size; } } int SI10InfoFieldList_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 SI10InfoFieldList_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.SI10InfoFieldList 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.SI10InfoFieldList 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.SI10InfoFieldList 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.SI10InfoFieldList 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.SI10InfoFieldList 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.SI10InfoFieldList containing complemented list.", op_name); default: TTCN_error("Performing %sof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.SI10InfoFieldList.", op_name); } return check_section_is_single(min_size, has_any_or_none, op_name, "a", "template of type @GSM_RestOctets.SI10InfoFieldList"); } boolean SI10InfoFieldList_template::match(const SI10InfoFieldList& 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.SI10InfoFieldList."); } return FALSE; } boolean SI10InfoFieldList_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; } SI10InfoFieldList SI10InfoFieldList_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.SI10InfoFieldList."); SI10InfoFieldList 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; } SI10InfoFieldList SI10InfoFieldList_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); } SI10InfoFieldList SI10InfoFieldList_template::replace(int index, int len, const SI10InfoFieldList_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()); } SI10InfoFieldList SI10InfoFieldList_template::replace(int index, int len, const SI10InfoFieldList& 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 SI10InfoFieldList_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 SI10InfoFieldList_template[list_length]; break; default: TTCN_error("Internal error: Setting an invalid type for a template of type @GSM_RestOctets.SI10InfoFieldList."); } set_selection(template_type); } SI10InfoFieldList_template& SI10InfoFieldList_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.SI10InfoFieldList."); if (list_index >= value_list.n_values) TTCN_error("Internal error: Index overflow in a value list template of type @GSM_RestOctets.SI10InfoFieldList."); return value_list.list_value[list_index]; } void SI10InfoFieldList_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 SI10InfoFieldList_template::log_match(const SI10InfoFieldList& 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 SI10InfoFieldList_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.SI10InfoFieldList."); } } void SI10InfoFieldList_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.SI10InfoFieldList."); single_value.value_elements = (SI10InfoField_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 SI10InfoField_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 SI10InfoFieldList_template[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.SI10InfoFieldList."); } } boolean SI10InfoFieldList_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean SI10InfoFieldList_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 SI10InfoFieldList_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: { SI10InfoFieldList_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: { SI10InfoFieldList_template* precondition = new SI10InfoFieldList_template; precondition->set_param(*param.get_elem(0)); SI10InfoFieldList_template* implied_template = new SI10InfoFieldList_template; implied_template->set_param(*param.get_elem(1)); *this = SI10InfoFieldList_template(precondition, implied_template); } break; default: param.type_error("record of template", "@GSM_RestOctets.SI10InfoFieldList"); } is_ifpresent = param.get_ifpresent(); set_length_range(param); } void SI10InfoFieldList_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.SI10InfoFieldList"); 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.SI10InfoFieldList"); } boolean SI10InfoFieldList_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); } } SI10DiffCellInfo::SI10DiffCellInfo() { } SI10DiffCellInfo::SI10DiffCellInfo(const BITSTRING& par_bcc__or__bsic, const OPTIONAL< INTEGER >& par_bcc, const OPTIONAL< INTEGER >& par_bsic, const BITSTRING& par_diff__cell__params__presence, const OPTIONAL< SI10DiffCellParams >& par_diff__cell__params) : field_bcc__or__bsic(par_bcc__or__bsic), field_bcc(par_bcc), field_bsic(par_bsic), field_diff__cell__params__presence(par_diff__cell__params__presence), field_diff__cell__params(par_diff__cell__params) { } SI10DiffCellInfo::SI10DiffCellInfo(const SI10DiffCellInfo& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.SI10DiffCellInfo."); if (other_value.bcc__or__bsic().is_bound()) field_bcc__or__bsic = other_value.bcc__or__bsic(); else field_bcc__or__bsic.clean_up(); if (other_value.bcc().is_bound()) field_bcc = other_value.bcc(); else field_bcc.clean_up(); if (other_value.bsic().is_bound()) field_bsic = other_value.bsic(); else field_bsic.clean_up(); if (other_value.diff__cell__params__presence().is_bound()) field_diff__cell__params__presence = other_value.diff__cell__params__presence(); else field_diff__cell__params__presence.clean_up(); if (other_value.diff__cell__params().is_bound()) field_diff__cell__params = other_value.diff__cell__params(); else field_diff__cell__params.clean_up(); } void SI10DiffCellInfo::clean_up() { field_bcc__or__bsic.clean_up(); field_bcc.clean_up(); field_bsic.clean_up(); field_diff__cell__params__presence.clean_up(); field_diff__cell__params.clean_up(); } const TTCN_Typedescriptor_t* SI10DiffCellInfo::get_descriptor() const { return &SI10DiffCellInfo_descr_; } SI10DiffCellInfo& SI10DiffCellInfo::operator=(const SI10DiffCellInfo& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.SI10DiffCellInfo."); if (other_value.bcc__or__bsic().is_bound()) field_bcc__or__bsic = other_value.bcc__or__bsic(); else field_bcc__or__bsic.clean_up(); if (other_value.bcc().is_bound()) field_bcc = other_value.bcc(); else field_bcc.clean_up(); if (other_value.bsic().is_bound()) field_bsic = other_value.bsic(); else field_bsic.clean_up(); if (other_value.diff__cell__params__presence().is_bound()) field_diff__cell__params__presence = other_value.diff__cell__params__presence(); else field_diff__cell__params__presence.clean_up(); if (other_value.diff__cell__params().is_bound()) field_diff__cell__params = other_value.diff__cell__params(); else field_diff__cell__params.clean_up(); } return *this; } boolean SI10DiffCellInfo::operator==(const SI10DiffCellInfo& other_value) const { return field_bcc__or__bsic==other_value.field_bcc__or__bsic && field_bcc==other_value.field_bcc && field_bsic==other_value.field_bsic && field_diff__cell__params__presence==other_value.field_diff__cell__params__presence && field_diff__cell__params==other_value.field_diff__cell__params; } boolean SI10DiffCellInfo::is_bound() const { return (field_bcc__or__bsic.is_bound()) || (OPTIONAL_OMIT == field_bcc.get_selection() || field_bcc.is_bound()) || (OPTIONAL_OMIT == field_bsic.get_selection() || field_bsic.is_bound()) || (field_diff__cell__params__presence.is_bound()) || (OPTIONAL_OMIT == field_diff__cell__params.get_selection() || field_diff__cell__params.is_bound()); } boolean SI10DiffCellInfo::is_value() const { return field_bcc__or__bsic.is_value() && (OPTIONAL_OMIT == field_bcc.get_selection() || field_bcc.is_value()) && (OPTIONAL_OMIT == field_bsic.get_selection() || field_bsic.is_value()) && field_diff__cell__params__presence.is_value() && (OPTIONAL_OMIT == field_diff__cell__params.get_selection() || field_diff__cell__params.is_value()); } int SI10DiffCellInfo::size_of() const { int ret_val = 2; if (field_bcc.ispresent()) ret_val++; if (field_bsic.ispresent()) ret_val++; if (field_diff__cell__params.ispresent()) ret_val++; return ret_val; } void SI10DiffCellInfo::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ bcc_or_bsic := "); field_bcc__or__bsic.log(); TTCN_Logger::log_event_str(", bcc := "); field_bcc.log(); TTCN_Logger::log_event_str(", bsic := "); field_bsic.log(); TTCN_Logger::log_event_str(", diff_cell_params_presence := "); field_diff__cell__params__presence.log(); TTCN_Logger::log_event_str(", diff_cell_params := "); field_diff__cell__params.log(); TTCN_Logger::log_event_str(" }"); } void SI10DiffCellInfo::set_implicit_omit() { if (bcc__or__bsic().is_bound()) bcc__or__bsic().set_implicit_omit(); if (!bcc().is_bound()) bcc() = OMIT_VALUE; else bcc().set_implicit_omit(); if (!bsic().is_bound()) bsic() = OMIT_VALUE; else bsic().set_implicit_omit(); if (diff__cell__params__presence().is_bound()) diff__cell__params__presence().set_implicit_omit(); if (!diff__cell__params().is_bound()) diff__cell__params() = OMIT_VALUE; else diff__cell__params().set_implicit_omit(); } void SI10DiffCellInfo::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "record value"); switch (param.get_type()) { case Module_Param::MP_Value_List: if (50 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) bcc__or__bsic().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) bcc().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) bsic().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) diff__cell__params__presence().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) diff__cell__params().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(), "bcc_or_bsic")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { bcc__or__bsic().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "bcc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { bcc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "bsic")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { bsic().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "diff_cell_params_presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { diff__cell__params__presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "diff_cell_params")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { diff__cell__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.SI10DiffCellInfo: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.SI10DiffCellInfo"); } } void SI10DiffCellInfo::encode_text(Text_Buf& text_buf) const { field_bcc__or__bsic.encode_text(text_buf); field_bcc.encode_text(text_buf); field_bsic.encode_text(text_buf); field_diff__cell__params__presence.encode_text(text_buf); field_diff__cell__params.encode_text(text_buf); } void SI10DiffCellInfo::decode_text(Text_Buf& text_buf) { field_bcc__or__bsic.decode_text(text_buf); field_bcc.decode_text(text_buf); field_bsic.decode_text(text_buf); field_diff__cell__params__presence.decode_text(text_buf); field_diff__cell__params.decode_text(text_buf); } void SI10DiffCellInfo::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 SI10DiffCellInfo::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 SI10DiffCellInfo::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, SI10DiffCellInfo_bcc__or__bsic_descr_.raw->forceomit); decoded_field_length = field_bcc__or__bsic.RAW_decode(SI10DiffCellInfo_bcc__or__bsic_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_bcc__or__bsic == bs_0){ if (force_omit != NULL && (*force_omit)(1)) { field_bcc = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_1_force_omit(1, force_omit, SI10DiffCellInfo_bcc_descr_.raw->forceomit); decoded_field_length = field_bcc().RAW_decode(SI10DiffCellInfo_bcc_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 1) { field_bcc = 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_bcc=OMIT_VALUE; if (limit > 0 && field_bcc__or__bsic == bs_1){ if (force_omit != NULL && (*force_omit)(2)) { field_bsic = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_2_force_omit(2, force_omit, SI10DiffCellInfo_bsic_descr_.raw->forceomit); decoded_field_length = field_bsic().RAW_decode(SI10DiffCellInfo_bsic_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_2_force_omit); if (decoded_field_length < 1) { field_bsic = 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_bsic=OMIT_VALUE; RAW_Force_Omit field_3_force_omit(3, force_omit, SI10DiffCellInfo_diff__cell__params__presence_descr_.raw->forceomit); decoded_field_length = field_diff__cell__params__presence.RAW_decode(SI10DiffCellInfo_diff__cell__params__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_diff__cell__params__presence == bs_0){ if (force_omit != NULL && (*force_omit)(4)) { field_diff__cell__params = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_4_force_omit(4, force_omit, SI10DiffCellInfo_diff__cell__params_descr_.raw->forceomit); decoded_field_length = field_diff__cell__params().RAW_decode(SI10DiffCellInfo_diff__cell__params_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_4_force_omit); if (decoded_field_length < 1) { field_diff__cell__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_diff__cell__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 SI10DiffCellInfo::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, SI10DiffCellInfo_bcc__or__bsic_descr_.raw); if (field_bcc.ispresent()) { myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, SI10DiffCellInfo_bcc_descr_.raw); } else myleaf.body.node.nodes[1] = NULL; if (field_bsic.ispresent()) { myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, SI10DiffCellInfo_bsic_descr_.raw); } else myleaf.body.node.nodes[2] = NULL; myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, SI10DiffCellInfo_diff__cell__params__presence_descr_.raw); if (field_diff__cell__params.ispresent()) { myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, SI10DiffCellInfo_diff__cell__params_descr_.raw); } else myleaf.body.node.nodes[4] = NULL; encoded_length += field_bcc__or__bsic.RAW_encode(SI10DiffCellInfo_bcc__or__bsic_descr_, *myleaf.body.node.nodes[0]); if (field_bcc.ispresent()) { encoded_length += field_bcc().RAW_encode(SI10DiffCellInfo_bcc_descr_, *myleaf.body.node.nodes[1]); } if (field_bsic.ispresent()) { encoded_length += field_bsic().RAW_encode(SI10DiffCellInfo_bsic_descr_, *myleaf.body.node.nodes[2]); } encoded_length += field_diff__cell__params__presence.RAW_encode(SI10DiffCellInfo_diff__cell__params__presence_descr_, *myleaf.body.node.nodes[3]); if (field_diff__cell__params.ispresent()) { encoded_length += field_diff__cell__params().RAW_encode(SI10DiffCellInfo_diff__cell__params_descr_, *myleaf.body.node.nodes[4]); } if (field_bcc.ispresent() && (field_bcc__or__bsic != 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(SI10DiffCellInfo_bcc__or__bsic_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_bsic.ispresent() && (field_bcc__or__bsic != bs_1)) { 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_1.RAW_encode(SI10DiffCellInfo_bcc__or__bsic_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_diff__cell__params.ispresent() && (field_diff__cell__params__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(SI10DiffCellInfo_diff__cell__params__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 SI10DiffCellInfo_template::single_value_struct { BITSTRING_template field_bcc__or__bsic; INTEGER_template field_bcc; INTEGER_template field_bsic; BITSTRING_template field_diff__cell__params__presence; SI10DiffCellParams_template field_diff__cell__params; }; void SI10DiffCellInfo_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_bcc__or__bsic = ANY_VALUE; single_value->field_bcc = ANY_OR_OMIT; single_value->field_bsic = ANY_OR_OMIT; single_value->field_diff__cell__params__presence = ANY_VALUE; single_value->field_diff__cell__params = ANY_OR_OMIT; } } } void SI10DiffCellInfo_template::copy_value(const SI10DiffCellInfo& other_value) { single_value = new single_value_struct; if (other_value.bcc__or__bsic().is_bound()) { single_value->field_bcc__or__bsic = other_value.bcc__or__bsic(); } else { single_value->field_bcc__or__bsic.clean_up(); } if (other_value.bcc().is_bound()) { if (other_value.bcc().ispresent()) single_value->field_bcc = other_value.bcc()(); else single_value->field_bcc = OMIT_VALUE; } else { single_value->field_bcc.clean_up(); } if (other_value.bsic().is_bound()) { if (other_value.bsic().ispresent()) single_value->field_bsic = other_value.bsic()(); else single_value->field_bsic = OMIT_VALUE; } else { single_value->field_bsic.clean_up(); } if (other_value.diff__cell__params__presence().is_bound()) { single_value->field_diff__cell__params__presence = other_value.diff__cell__params__presence(); } else { single_value->field_diff__cell__params__presence.clean_up(); } if (other_value.diff__cell__params().is_bound()) { if (other_value.diff__cell__params().ispresent()) single_value->field_diff__cell__params = other_value.diff__cell__params()(); else single_value->field_diff__cell__params = OMIT_VALUE; } else { single_value->field_diff__cell__params.clean_up(); } set_selection(SPECIFIC_VALUE); } void SI10DiffCellInfo_template::copy_template(const SI10DiffCellInfo_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.bcc__or__bsic().get_selection()) { single_value->field_bcc__or__bsic = other_value.bcc__or__bsic(); } else { single_value->field_bcc__or__bsic.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.bcc().get_selection()) { single_value->field_bcc = other_value.bcc(); } else { single_value->field_bcc.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.bsic().get_selection()) { single_value->field_bsic = other_value.bsic(); } else { single_value->field_bsic.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.diff__cell__params__presence().get_selection()) { single_value->field_diff__cell__params__presence = other_value.diff__cell__params__presence(); } else { single_value->field_diff__cell__params__presence.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.diff__cell__params().get_selection()) { single_value->field_diff__cell__params = other_value.diff__cell__params(); } else { single_value->field_diff__cell__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 SI10DiffCellInfo_template[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 SI10DiffCellInfo_template(*other_value.implication_.precondition); implication_.implied_template = new SI10DiffCellInfo_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.SI10DiffCellInfo."); break; } set_selection(other_value); } SI10DiffCellInfo_template::SI10DiffCellInfo_template() { } SI10DiffCellInfo_template::SI10DiffCellInfo_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } SI10DiffCellInfo_template::SI10DiffCellInfo_template(const SI10DiffCellInfo& other_value) { copy_value(other_value); } SI10DiffCellInfo_template::SI10DiffCellInfo_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI10DiffCellInfo&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.SI10DiffCellInfo from an unbound optional field."); } } SI10DiffCellInfo_template::SI10DiffCellInfo_template(SI10DiffCellInfo_template* p_precondition, SI10DiffCellInfo_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } SI10DiffCellInfo_template::SI10DiffCellInfo_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; } SI10DiffCellInfo_template::SI10DiffCellInfo_template(const SI10DiffCellInfo_template& other_value) : Base_Template() { copy_template(other_value); } SI10DiffCellInfo_template::~SI10DiffCellInfo_template() { clean_up(); } SI10DiffCellInfo_template& SI10DiffCellInfo_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } SI10DiffCellInfo_template& SI10DiffCellInfo_template::operator=(const SI10DiffCellInfo& other_value) { clean_up(); copy_value(other_value); return *this; } SI10DiffCellInfo_template& SI10DiffCellInfo_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI10DiffCellInfo&)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.SI10DiffCellInfo."); } return *this; } SI10DiffCellInfo_template& SI10DiffCellInfo_template::operator=(const SI10DiffCellInfo_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean SI10DiffCellInfo_template::match(const SI10DiffCellInfo& 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.bcc__or__bsic().is_bound()) return FALSE; if(!single_value->field_bcc__or__bsic.match(other_value.bcc__or__bsic(), legacy))return FALSE; if(!other_value.bcc().is_bound()) return FALSE; if((other_value.bcc().ispresent() ? !single_value->field_bcc.match((const INTEGER&)other_value.bcc(), legacy) : !single_value->field_bcc.match_omit(legacy)))return FALSE; if(!other_value.bsic().is_bound()) return FALSE; if((other_value.bsic().ispresent() ? !single_value->field_bsic.match((const INTEGER&)other_value.bsic(), legacy) : !single_value->field_bsic.match_omit(legacy)))return FALSE; if(!other_value.diff__cell__params__presence().is_bound()) return FALSE; if(!single_value->field_diff__cell__params__presence.match(other_value.diff__cell__params__presence(), legacy))return FALSE; if(!other_value.diff__cell__params().is_bound()) return FALSE; if((other_value.diff__cell__params().ispresent() ? !single_value->field_diff__cell__params.match((const SI10DiffCellParams&)other_value.diff__cell__params(), legacy) : !single_value->field_diff__cell__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.SI10DiffCellInfo."); } return FALSE; } boolean SI10DiffCellInfo_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_bcc__or__bsic.is_bound() || (single_value->field_bcc.is_omit() || single_value->field_bcc.is_bound()) || (single_value->field_bsic.is_omit() || single_value->field_bsic.is_bound()) || single_value->field_diff__cell__params__presence.is_bound() || (single_value->field_diff__cell__params.is_omit() || single_value->field_diff__cell__params.is_bound()); } boolean SI10DiffCellInfo_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_bcc__or__bsic.is_value() && (single_value->field_bcc.is_omit() || single_value->field_bcc.is_value()) && (single_value->field_bsic.is_omit() || single_value->field_bsic.is_value()) && single_value->field_diff__cell__params__presence.is_value() && (single_value->field_diff__cell__params.is_omit() || single_value->field_diff__cell__params.is_value()); } void SI10DiffCellInfo_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; } SI10DiffCellInfo SI10DiffCellInfo_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.SI10DiffCellInfo."); SI10DiffCellInfo ret_val; if (single_value->field_bcc__or__bsic.is_bound()) { ret_val.bcc__or__bsic() = single_value->field_bcc__or__bsic.valueof(); } if (single_value->field_bcc.is_omit()) ret_val.bcc() = OMIT_VALUE; else if (single_value->field_bcc.is_bound()) { ret_val.bcc() = single_value->field_bcc.valueof(); } if (single_value->field_bsic.is_omit()) ret_val.bsic() = OMIT_VALUE; else if (single_value->field_bsic.is_bound()) { ret_val.bsic() = single_value->field_bsic.valueof(); } if (single_value->field_diff__cell__params__presence.is_bound()) { ret_val.diff__cell__params__presence() = single_value->field_diff__cell__params__presence.valueof(); } if (single_value->field_diff__cell__params.is_omit()) ret_val.diff__cell__params() = OMIT_VALUE; else if (single_value->field_diff__cell__params.is_bound()) { ret_val.diff__cell__params() = single_value->field_diff__cell__params.valueof(); } return ret_val; } void SI10DiffCellInfo_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.SI10DiffCellInfo."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new SI10DiffCellInfo_template[list_length]; } SI10DiffCellInfo_template& SI10DiffCellInfo_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.SI10DiffCellInfo."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.SI10DiffCellInfo."); return value_list.list_value[list_index]; } BITSTRING_template& SI10DiffCellInfo_template::bcc__or__bsic() { set_specific(); return single_value->field_bcc__or__bsic; } const BITSTRING_template& SI10DiffCellInfo_template::bcc__or__bsic() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field bcc_or_bsic of a non-specific template of type @GSM_RestOctets.SI10DiffCellInfo."); return single_value->field_bcc__or__bsic; } INTEGER_template& SI10DiffCellInfo_template::bcc() { set_specific(); return single_value->field_bcc; } const INTEGER_template& SI10DiffCellInfo_template::bcc() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field bcc of a non-specific template of type @GSM_RestOctets.SI10DiffCellInfo."); return single_value->field_bcc; } INTEGER_template& SI10DiffCellInfo_template::bsic() { set_specific(); return single_value->field_bsic; } const INTEGER_template& SI10DiffCellInfo_template::bsic() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field bsic of a non-specific template of type @GSM_RestOctets.SI10DiffCellInfo."); return single_value->field_bsic; } BITSTRING_template& SI10DiffCellInfo_template::diff__cell__params__presence() { set_specific(); return single_value->field_diff__cell__params__presence; } const BITSTRING_template& SI10DiffCellInfo_template::diff__cell__params__presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field diff_cell_params_presence of a non-specific template of type @GSM_RestOctets.SI10DiffCellInfo."); return single_value->field_diff__cell__params__presence; } SI10DiffCellParams_template& SI10DiffCellInfo_template::diff__cell__params() { set_specific(); return single_value->field_diff__cell__params; } const SI10DiffCellParams_template& SI10DiffCellInfo_template::diff__cell__params() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field diff_cell_params of a non-specific template of type @GSM_RestOctets.SI10DiffCellInfo."); return single_value->field_diff__cell__params; } int SI10DiffCellInfo_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10DiffCellInfo which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 2; if (single_value->field_bcc.is_present()) ret_val++; if (single_value->field_bsic.is_present()) ret_val++; if (single_value->field_diff__cell__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.SI10DiffCellInfo 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.SI10DiffCellInfo 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.SI10DiffCellInfo containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10DiffCellInfo containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10DiffCellInfo containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10DiffCellInfo containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10DiffCellInfo containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10DiffCellInfo containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.SI10DiffCellInfo."); } return 0; } void SI10DiffCellInfo_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ bcc_or_bsic := "); single_value->field_bcc__or__bsic.log(); TTCN_Logger::log_event_str(", bcc := "); single_value->field_bcc.log(); TTCN_Logger::log_event_str(", bsic := "); single_value->field_bsic.log(); TTCN_Logger::log_event_str(", diff_cell_params_presence := "); single_value->field_diff__cell__params__presence.log(); TTCN_Logger::log_event_str(", diff_cell_params := "); single_value->field_diff__cell__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 SI10DiffCellInfo_template::log_match(const SI10DiffCellInfo& 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_bcc__or__bsic.match(match_value.bcc__or__bsic(), legacy)){ TTCN_Logger::log_logmatch_info(".bcc_or_bsic"); single_value->field_bcc__or__bsic.log_match(match_value.bcc__or__bsic(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.bcc().ispresent()){ if(!single_value->field_bcc.match(match_value.bcc(), legacy)){ TTCN_Logger::log_logmatch_info(".bcc"); single_value->field_bcc.log_match(match_value.bcc(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_bcc.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".bcc := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_bcc.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if (match_value.bsic().ispresent()){ if(!single_value->field_bsic.match(match_value.bsic(), legacy)){ TTCN_Logger::log_logmatch_info(".bsic"); single_value->field_bsic.log_match(match_value.bsic(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_bsic.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".bsic := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_bsic.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if(!single_value->field_diff__cell__params__presence.match(match_value.diff__cell__params__presence(), legacy)){ TTCN_Logger::log_logmatch_info(".diff_cell_params_presence"); single_value->field_diff__cell__params__presence.log_match(match_value.diff__cell__params__presence(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.diff__cell__params().ispresent()){ if(!single_value->field_diff__cell__params.match(match_value.diff__cell__params(), legacy)){ TTCN_Logger::log_logmatch_info(".diff_cell_params"); single_value->field_diff__cell__params.log_match(match_value.diff__cell__params(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_diff__cell__params.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".diff_cell_params := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_diff__cell__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("{ bcc_or_bsic := "); single_value->field_bcc__or__bsic.log_match(match_value.bcc__or__bsic(), legacy); TTCN_Logger::log_event_str(", bcc := "); if (match_value.bcc().ispresent()) { single_value->field_bcc.log_match(match_value.bcc(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_bcc.log(); if (single_value->field_bcc.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", bsic := "); if (match_value.bsic().ispresent()) { single_value->field_bsic.log_match(match_value.bsic(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_bsic.log(); if (single_value->field_bsic.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", diff_cell_params_presence := "); single_value->field_diff__cell__params__presence.log_match(match_value.diff__cell__params__presence(), legacy); TTCN_Logger::log_event_str(", diff_cell_params := "); if (match_value.diff__cell__params().ispresent()) { single_value->field_diff__cell__params.log_match(match_value.diff__cell__params(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_diff__cell__params.log(); if (single_value->field_diff__cell__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 SI10DiffCellInfo_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (bcc__or__bsic().is_bound()) bcc__or__bsic().set_implicit_omit(); if (!bcc().is_bound()) bcc() = OMIT_VALUE; else bcc().set_implicit_omit(); if (!bsic().is_bound()) bsic() = OMIT_VALUE; else bsic().set_implicit_omit(); if (diff__cell__params__presence().is_bound()) diff__cell__params__presence().set_implicit_omit(); if (!diff__cell__params().is_bound()) diff__cell__params() = OMIT_VALUE; else diff__cell__params().set_implicit_omit(); } void SI10DiffCellInfo_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_bcc__or__bsic.encode_text(text_buf); single_value->field_bcc.encode_text(text_buf); single_value->field_bsic.encode_text(text_buf); single_value->field_diff__cell__params__presence.encode_text(text_buf); single_value->field_diff__cell__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.SI10DiffCellInfo."); } } void SI10DiffCellInfo_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_bcc__or__bsic.decode_text(text_buf); single_value->field_bcc.decode_text(text_buf); single_value->field_bsic.decode_text(text_buf); single_value->field_diff__cell__params__presence.decode_text(text_buf); single_value->field_diff__cell__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 SI10DiffCellInfo_template[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.SI10DiffCellInfo."); } } void SI10DiffCellInfo_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: { SI10DiffCellInfo_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) bcc__or__bsic().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) bcc().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) bsic().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) diff__cell__params__presence().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) diff__cell__params().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(), "bcc_or_bsic")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { bcc__or__bsic().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "bcc")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { bcc().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "bsic")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { bsic().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "diff_cell_params_presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { diff__cell__params__presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "diff_cell_params")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { diff__cell__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.SI10DiffCellInfo: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { SI10DiffCellInfo_template* precondition = new SI10DiffCellInfo_template; precondition->set_param(*param.get_elem(0)); SI10DiffCellInfo_template* implied_template = new SI10DiffCellInfo_template; implied_template->set_param(*param.get_elem(1)); *this = SI10DiffCellInfo_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.SI10DiffCellInfo"); } is_ifpresent = param.get_ifpresent(); } void SI10DiffCellInfo_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_bcc__or__bsic.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI10DiffCellInfo"); single_value->field_bcc.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI10DiffCellInfo"); single_value->field_bsic.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI10DiffCellInfo"); single_value->field_diff__cell__params__presence.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI10DiffCellInfo"); single_value->field_diff__cell__params.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI10DiffCellInfo"); 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.SI10DiffCellInfo"); } boolean SI10DiffCellInfo_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean SI10DiffCellInfo_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_further__diff__cell__info) : field_cell__barred(par_cell__barred), field_further__diff__cell__info(par_further__diff__cell__info) { } SI10DiffCellParams::SI10DiffCellParams(const SI10DiffCellParams& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.SI10DiffCellParams."); if (other_value.cell__barred().is_bound()) field_cell__barred = other_value.cell__barred(); else field_cell__barred.clean_up(); if (other_value.further__diff__cell__info().is_bound()) field_further__diff__cell__info = other_value.further__diff__cell__info(); else field_further__diff__cell__info.clean_up(); } void SI10DiffCellParams::clean_up() { field_cell__barred.clean_up(); field_further__diff__cell__info.clean_up(); } const TTCN_Typedescriptor_t* SI10DiffCellParams::get_descriptor() const { return &SI10DiffCellParams_descr_; } SI10DiffCellParams& SI10DiffCellParams::operator=(const SI10DiffCellParams& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.SI10DiffCellParams."); if (other_value.cell__barred().is_bound()) field_cell__barred = other_value.cell__barred(); else field_cell__barred.clean_up(); if (other_value.further__diff__cell__info().is_bound()) field_further__diff__cell__info = other_value.further__diff__cell__info(); else field_further__diff__cell__info.clean_up(); } return *this; } boolean SI10DiffCellParams::operator==(const SI10DiffCellParams& other_value) const { return field_cell__barred==other_value.field_cell__barred && field_further__diff__cell__info==other_value.field_further__diff__cell__info; } boolean SI10DiffCellParams::is_bound() const { return (field_cell__barred.is_bound()) || (OPTIONAL_OMIT == field_further__diff__cell__info.get_selection() || field_further__diff__cell__info.is_bound()); } boolean SI10DiffCellParams::is_value() const { return field_cell__barred.is_value() && (OPTIONAL_OMIT == field_further__diff__cell__info.get_selection() || field_further__diff__cell__info.is_value()); } int SI10DiffCellParams::size_of() const { int ret_val = 1; if (field_further__diff__cell__info.ispresent()) ret_val++; return ret_val; } void SI10DiffCellParams::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ cell_barred := "); field_cell__barred.log(); TTCN_Logger::log_event_str(", further_diff_cell_info := "); field_further__diff__cell__info.log(); TTCN_Logger::log_event_str(" }"); } void SI10DiffCellParams::set_implicit_omit() { if (cell__barred().is_bound()) cell__barred().set_implicit_omit(); if (!further__diff__cell__info().is_bound()) further__diff__cell__info() = OMIT_VALUE; else further__diff__cell__info().set_implicit_omit(); } void SI10DiffCellParams::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) cell__barred().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) further__diff__cell__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(), "cell_barred")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cell__barred().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "further_diff_cell_info")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { further__diff__cell__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.SI10DiffCellParams: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.SI10DiffCellParams"); } } void SI10DiffCellParams::encode_text(Text_Buf& text_buf) const { field_cell__barred.encode_text(text_buf); field_further__diff__cell__info.encode_text(text_buf); } void SI10DiffCellParams::decode_text(Text_Buf& text_buf) { field_cell__barred.decode_text(text_buf); field_further__diff__cell__info.decode_text(text_buf); } void SI10DiffCellParams::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 SI10DiffCellParams::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 SI10DiffCellParams::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, SI10DiffCellParams_cell__barred_descr_.raw->forceomit); decoded_field_length = field_cell__barred.RAW_decode(SI10DiffCellParams_cell__barred_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_cell__barred == bs_1){ if (force_omit != NULL && (*force_omit)(1)) { field_further__diff__cell__info = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_1_force_omit(1, force_omit, SI10DiffCellParams_further__diff__cell__info_descr_.raw->forceomit); decoded_field_length = field_further__diff__cell__info().RAW_decode(SI10DiffCellParams_further__diff__cell__info_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 1) { field_further__diff__cell__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_further__diff__cell__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 SI10DiffCellParams::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, SI10DiffCellParams_cell__barred_descr_.raw); if (field_further__diff__cell__info.ispresent()) { myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, SI10DiffCellParams_further__diff__cell__info_descr_.raw); } else myleaf.body.node.nodes[1] = NULL; encoded_length += field_cell__barred.RAW_encode(SI10DiffCellParams_cell__barred_descr_, *myleaf.body.node.nodes[0]); if (field_further__diff__cell__info.ispresent()) { encoded_length += field_further__diff__cell__info().RAW_encode(SI10DiffCellParams_further__diff__cell__info_descr_, *myleaf.body.node.nodes[1]); } if (field_further__diff__cell__info.ispresent() && (field_cell__barred != bs_1)) { 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_1.RAW_encode(SI10DiffCellParams_cell__barred_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 SI10DiffCellParams_template::single_value_struct { BITSTRING_template field_cell__barred; SI10FurtherDiffCellInfo_template field_further__diff__cell__info; }; void SI10DiffCellParams_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_cell__barred = ANY_VALUE; single_value->field_further__diff__cell__info = ANY_OR_OMIT; } } } void SI10DiffCellParams_template::copy_value(const SI10DiffCellParams& other_value) { single_value = new single_value_struct; if (other_value.cell__barred().is_bound()) { single_value->field_cell__barred = other_value.cell__barred(); } else { single_value->field_cell__barred.clean_up(); } if (other_value.further__diff__cell__info().is_bound()) { if (other_value.further__diff__cell__info().ispresent()) single_value->field_further__diff__cell__info = other_value.further__diff__cell__info()(); else single_value->field_further__diff__cell__info = OMIT_VALUE; } else { single_value->field_further__diff__cell__info.clean_up(); } set_selection(SPECIFIC_VALUE); } void SI10DiffCellParams_template::copy_template(const SI10DiffCellParams_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.cell__barred().get_selection()) { single_value->field_cell__barred = other_value.cell__barred(); } else { single_value->field_cell__barred.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.further__diff__cell__info().get_selection()) { single_value->field_further__diff__cell__info = other_value.further__diff__cell__info(); } else { single_value->field_further__diff__cell__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 SI10DiffCellParams_template[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 SI10DiffCellParams_template(*other_value.implication_.precondition); implication_.implied_template = new SI10DiffCellParams_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.SI10DiffCellParams."); break; } set_selection(other_value); } SI10DiffCellParams_template::SI10DiffCellParams_template() { } SI10DiffCellParams_template::SI10DiffCellParams_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } SI10DiffCellParams_template::SI10DiffCellParams_template(const SI10DiffCellParams& other_value) { copy_value(other_value); } SI10DiffCellParams_template::SI10DiffCellParams_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI10DiffCellParams&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.SI10DiffCellParams from an unbound optional field."); } } SI10DiffCellParams_template::SI10DiffCellParams_template(SI10DiffCellParams_template* p_precondition, SI10DiffCellParams_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } SI10DiffCellParams_template::SI10DiffCellParams_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; } SI10DiffCellParams_template::SI10DiffCellParams_template(const SI10DiffCellParams_template& other_value) : Base_Template() { copy_template(other_value); } SI10DiffCellParams_template::~SI10DiffCellParams_template() { clean_up(); } SI10DiffCellParams_template& SI10DiffCellParams_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } SI10DiffCellParams_template& SI10DiffCellParams_template::operator=(const SI10DiffCellParams& other_value) { clean_up(); copy_value(other_value); return *this; } SI10DiffCellParams_template& SI10DiffCellParams_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI10DiffCellParams&)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.SI10DiffCellParams."); } return *this; } SI10DiffCellParams_template& SI10DiffCellParams_template::operator=(const SI10DiffCellParams_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean SI10DiffCellParams_template::match(const SI10DiffCellParams& 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.cell__barred().is_bound()) return FALSE; if(!single_value->field_cell__barred.match(other_value.cell__barred(), legacy))return FALSE; if(!other_value.further__diff__cell__info().is_bound()) return FALSE; if((other_value.further__diff__cell__info().ispresent() ? !single_value->field_further__diff__cell__info.match((const SI10FurtherDiffCellInfo&)other_value.further__diff__cell__info(), legacy) : !single_value->field_further__diff__cell__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.SI10DiffCellParams."); } return FALSE; } boolean SI10DiffCellParams_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_cell__barred.is_bound() || (single_value->field_further__diff__cell__info.is_omit() || single_value->field_further__diff__cell__info.is_bound()); } boolean SI10DiffCellParams_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_cell__barred.is_value() && (single_value->field_further__diff__cell__info.is_omit() || single_value->field_further__diff__cell__info.is_value()); } void SI10DiffCellParams_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; } SI10DiffCellParams SI10DiffCellParams_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.SI10DiffCellParams."); SI10DiffCellParams ret_val; if (single_value->field_cell__barred.is_bound()) { ret_val.cell__barred() = single_value->field_cell__barred.valueof(); } if (single_value->field_further__diff__cell__info.is_omit()) ret_val.further__diff__cell__info() = OMIT_VALUE; else if (single_value->field_further__diff__cell__info.is_bound()) { ret_val.further__diff__cell__info() = single_value->field_further__diff__cell__info.valueof(); } return ret_val; } void SI10DiffCellParams_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.SI10DiffCellParams."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new SI10DiffCellParams_template[list_length]; } SI10DiffCellParams_template& SI10DiffCellParams_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.SI10DiffCellParams."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.SI10DiffCellParams."); return value_list.list_value[list_index]; } BITSTRING_template& SI10DiffCellParams_template::cell__barred() { set_specific(); return single_value->field_cell__barred; } const BITSTRING_template& SI10DiffCellParams_template::cell__barred() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field cell_barred of a non-specific template of type @GSM_RestOctets.SI10DiffCellParams."); return single_value->field_cell__barred; } SI10FurtherDiffCellInfo_template& SI10DiffCellParams_template::further__diff__cell__info() { set_specific(); return single_value->field_further__diff__cell__info; } const SI10FurtherDiffCellInfo_template& SI10DiffCellParams_template::further__diff__cell__info() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field further_diff_cell_info of a non-specific template of type @GSM_RestOctets.SI10DiffCellParams."); return single_value->field_further__diff__cell__info; } int SI10DiffCellParams_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10DiffCellParams which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 1; if (single_value->field_further__diff__cell__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.SI10DiffCellParams 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.SI10DiffCellParams 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.SI10DiffCellParams containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10DiffCellParams containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10DiffCellParams containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10DiffCellParams containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10DiffCellParams containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10DiffCellParams containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.SI10DiffCellParams."); } return 0; } void SI10DiffCellParams_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ cell_barred := "); single_value->field_cell__barred.log(); TTCN_Logger::log_event_str(", further_diff_cell_info := "); single_value->field_further__diff__cell__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 SI10DiffCellParams_template::log_match(const SI10DiffCellParams& 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_cell__barred.match(match_value.cell__barred(), legacy)){ TTCN_Logger::log_logmatch_info(".cell_barred"); single_value->field_cell__barred.log_match(match_value.cell__barred(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.further__diff__cell__info().ispresent()){ if(!single_value->field_further__diff__cell__info.match(match_value.further__diff__cell__info(), legacy)){ TTCN_Logger::log_logmatch_info(".further_diff_cell_info"); single_value->field_further__diff__cell__info.log_match(match_value.further__diff__cell__info(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_further__diff__cell__info.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".further_diff_cell_info := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_further__diff__cell__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("{ cell_barred := "); single_value->field_cell__barred.log_match(match_value.cell__barred(), legacy); TTCN_Logger::log_event_str(", further_diff_cell_info := "); if (match_value.further__diff__cell__info().ispresent()) { single_value->field_further__diff__cell__info.log_match(match_value.further__diff__cell__info(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_further__diff__cell__info.log(); if (single_value->field_further__diff__cell__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 SI10DiffCellParams_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (cell__barred().is_bound()) cell__barred().set_implicit_omit(); if (!further__diff__cell__info().is_bound()) further__diff__cell__info() = OMIT_VALUE; else further__diff__cell__info().set_implicit_omit(); } void SI10DiffCellParams_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_cell__barred.encode_text(text_buf); single_value->field_further__diff__cell__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.SI10DiffCellParams."); } } void SI10DiffCellParams_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_cell__barred.decode_text(text_buf); single_value->field_further__diff__cell__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 SI10DiffCellParams_template[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.SI10DiffCellParams."); } } void SI10DiffCellParams_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: { SI10DiffCellParams_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) cell__barred().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) further__diff__cell__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(), "cell_barred")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cell__barred().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "further_diff_cell_info")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { further__diff__cell__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.SI10DiffCellParams: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { SI10DiffCellParams_template* precondition = new SI10DiffCellParams_template; precondition->set_param(*param.get_elem(0)); SI10DiffCellParams_template* implied_template = new SI10DiffCellParams_template; implied_template->set_param(*param.get_elem(1)); *this = SI10DiffCellParams_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.SI10DiffCellParams"); } is_ifpresent = param.get_ifpresent(); } void SI10DiffCellParams_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_cell__barred.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI10DiffCellParams"); single_value->field_further__diff__cell__info.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI10DiffCellParams"); 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.SI10DiffCellParams"); } boolean SI10DiffCellParams_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean SI10DiffCellParams_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_cell__resel__hyst, const BITSTRING& par_ms__txpwr__max__cch__presence, const OPTIONAL< INTEGER >& par_ms__txpwr__max__cch, const BITSTRING& par_rxlev__access__min__presence, const OPTIONAL< INTEGER >& par_rxlev__access__min, const BITSTRING& par_cell__resel__offset__presence, const OPTIONAL< INTEGER >& par_cell__resel__offset, const BITSTRING& par_temp__offset__presence, const OPTIONAL< INTEGER >& par_temp__offset, const BITSTRING& par_penalty__time__presence, const OPTIONAL< INTEGER >& par_penalty__time) : field_la__different(par_la__different), field_cell__resel__hyst(par_cell__resel__hyst), field_ms__txpwr__max__cch__presence(par_ms__txpwr__max__cch__presence), field_ms__txpwr__max__cch(par_ms__txpwr__max__cch), field_rxlev__access__min__presence(par_rxlev__access__min__presence), field_rxlev__access__min(par_rxlev__access__min), field_cell__resel__offset__presence(par_cell__resel__offset__presence), field_cell__resel__offset(par_cell__resel__offset), field_temp__offset__presence(par_temp__offset__presence), field_temp__offset(par_temp__offset), field_penalty__time__presence(par_penalty__time__presence), field_penalty__time(par_penalty__time) { } SI10FurtherDiffCellInfo::SI10FurtherDiffCellInfo(const SI10FurtherDiffCellInfo& other_value) { if(!other_value.is_bound()) TTCN_error("Copying an unbound value of type @GSM_RestOctets.SI10FurtherDiffCellInfo."); if (other_value.la__different().is_bound()) field_la__different = other_value.la__different(); else field_la__different.clean_up(); if (other_value.cell__resel__hyst().is_bound()) field_cell__resel__hyst = other_value.cell__resel__hyst(); else field_cell__resel__hyst.clean_up(); if (other_value.ms__txpwr__max__cch__presence().is_bound()) field_ms__txpwr__max__cch__presence = other_value.ms__txpwr__max__cch__presence(); else field_ms__txpwr__max__cch__presence.clean_up(); if (other_value.ms__txpwr__max__cch().is_bound()) field_ms__txpwr__max__cch = other_value.ms__txpwr__max__cch(); else field_ms__txpwr__max__cch.clean_up(); if (other_value.rxlev__access__min__presence().is_bound()) field_rxlev__access__min__presence = other_value.rxlev__access__min__presence(); else field_rxlev__access__min__presence.clean_up(); if (other_value.rxlev__access__min().is_bound()) field_rxlev__access__min = other_value.rxlev__access__min(); else field_rxlev__access__min.clean_up(); if (other_value.cell__resel__offset__presence().is_bound()) field_cell__resel__offset__presence = other_value.cell__resel__offset__presence(); else field_cell__resel__offset__presence.clean_up(); if (other_value.cell__resel__offset().is_bound()) field_cell__resel__offset = other_value.cell__resel__offset(); else field_cell__resel__offset.clean_up(); if (other_value.temp__offset__presence().is_bound()) field_temp__offset__presence = other_value.temp__offset__presence(); else field_temp__offset__presence.clean_up(); if (other_value.temp__offset().is_bound()) field_temp__offset = other_value.temp__offset(); else field_temp__offset.clean_up(); if (other_value.penalty__time__presence().is_bound()) field_penalty__time__presence = other_value.penalty__time__presence(); else field_penalty__time__presence.clean_up(); if (other_value.penalty__time().is_bound()) field_penalty__time = other_value.penalty__time(); else field_penalty__time.clean_up(); } void SI10FurtherDiffCellInfo::clean_up() { field_la__different.clean_up(); field_cell__resel__hyst.clean_up(); field_ms__txpwr__max__cch__presence.clean_up(); field_ms__txpwr__max__cch.clean_up(); field_rxlev__access__min__presence.clean_up(); field_rxlev__access__min.clean_up(); field_cell__resel__offset__presence.clean_up(); field_cell__resel__offset.clean_up(); field_temp__offset__presence.clean_up(); field_temp__offset.clean_up(); field_penalty__time__presence.clean_up(); field_penalty__time.clean_up(); } const TTCN_Typedescriptor_t* SI10FurtherDiffCellInfo::get_descriptor() const { return &SI10FurtherDiffCellInfo_descr_; } SI10FurtherDiffCellInfo& SI10FurtherDiffCellInfo::operator=(const SI10FurtherDiffCellInfo& other_value) { if (this != &other_value) { if(!other_value.is_bound()) TTCN_error("Assignment of an unbound value of type @GSM_RestOctets.SI10FurtherDiffCellInfo."); if (other_value.la__different().is_bound()) field_la__different = other_value.la__different(); else field_la__different.clean_up(); if (other_value.cell__resel__hyst().is_bound()) field_cell__resel__hyst = other_value.cell__resel__hyst(); else field_cell__resel__hyst.clean_up(); if (other_value.ms__txpwr__max__cch__presence().is_bound()) field_ms__txpwr__max__cch__presence = other_value.ms__txpwr__max__cch__presence(); else field_ms__txpwr__max__cch__presence.clean_up(); if (other_value.ms__txpwr__max__cch().is_bound()) field_ms__txpwr__max__cch = other_value.ms__txpwr__max__cch(); else field_ms__txpwr__max__cch.clean_up(); if (other_value.rxlev__access__min__presence().is_bound()) field_rxlev__access__min__presence = other_value.rxlev__access__min__presence(); else field_rxlev__access__min__presence.clean_up(); if (other_value.rxlev__access__min().is_bound()) field_rxlev__access__min = other_value.rxlev__access__min(); else field_rxlev__access__min.clean_up(); if (other_value.cell__resel__offset__presence().is_bound()) field_cell__resel__offset__presence = other_value.cell__resel__offset__presence(); else field_cell__resel__offset__presence.clean_up(); if (other_value.cell__resel__offset().is_bound()) field_cell__resel__offset = other_value.cell__resel__offset(); else field_cell__resel__offset.clean_up(); if (other_value.temp__offset__presence().is_bound()) field_temp__offset__presence = other_value.temp__offset__presence(); else field_temp__offset__presence.clean_up(); if (other_value.temp__offset().is_bound()) field_temp__offset = other_value.temp__offset(); else field_temp__offset.clean_up(); if (other_value.penalty__time__presence().is_bound()) field_penalty__time__presence = other_value.penalty__time__presence(); else field_penalty__time__presence.clean_up(); if (other_value.penalty__time().is_bound()) field_penalty__time = other_value.penalty__time(); else field_penalty__time.clean_up(); } return *this; } boolean SI10FurtherDiffCellInfo::operator==(const SI10FurtherDiffCellInfo& other_value) const { return field_la__different==other_value.field_la__different && field_cell__resel__hyst==other_value.field_cell__resel__hyst && field_ms__txpwr__max__cch__presence==other_value.field_ms__txpwr__max__cch__presence && field_ms__txpwr__max__cch==other_value.field_ms__txpwr__max__cch && field_rxlev__access__min__presence==other_value.field_rxlev__access__min__presence && field_rxlev__access__min==other_value.field_rxlev__access__min && field_cell__resel__offset__presence==other_value.field_cell__resel__offset__presence && field_cell__resel__offset==other_value.field_cell__resel__offset && field_temp__offset__presence==other_value.field_temp__offset__presence && field_temp__offset==other_value.field_temp__offset && field_penalty__time__presence==other_value.field_penalty__time__presence && field_penalty__time==other_value.field_penalty__time; } boolean SI10FurtherDiffCellInfo::is_bound() const { return (field_la__different.is_bound()) || (OPTIONAL_OMIT == field_cell__resel__hyst.get_selection() || field_cell__resel__hyst.is_bound()) || (field_ms__txpwr__max__cch__presence.is_bound()) || (OPTIONAL_OMIT == field_ms__txpwr__max__cch.get_selection() || field_ms__txpwr__max__cch.is_bound()) || (field_rxlev__access__min__presence.is_bound()) || (OPTIONAL_OMIT == field_rxlev__access__min.get_selection() || field_rxlev__access__min.is_bound()) || (field_cell__resel__offset__presence.is_bound()) || (OPTIONAL_OMIT == field_cell__resel__offset.get_selection() || field_cell__resel__offset.is_bound()) || (field_temp__offset__presence.is_bound()) || (OPTIONAL_OMIT == field_temp__offset.get_selection() || field_temp__offset.is_bound()) || (field_penalty__time__presence.is_bound()) || (OPTIONAL_OMIT == field_penalty__time.get_selection() || field_penalty__time.is_bound()); } boolean SI10FurtherDiffCellInfo::is_value() const { return field_la__different.is_value() && (OPTIONAL_OMIT == field_cell__resel__hyst.get_selection() || field_cell__resel__hyst.is_value()) && field_ms__txpwr__max__cch__presence.is_value() && (OPTIONAL_OMIT == field_ms__txpwr__max__cch.get_selection() || field_ms__txpwr__max__cch.is_value()) && field_rxlev__access__min__presence.is_value() && (OPTIONAL_OMIT == field_rxlev__access__min.get_selection() || field_rxlev__access__min.is_value()) && field_cell__resel__offset__presence.is_value() && (OPTIONAL_OMIT == field_cell__resel__offset.get_selection() || field_cell__resel__offset.is_value()) && field_temp__offset__presence.is_value() && (OPTIONAL_OMIT == field_temp__offset.get_selection() || field_temp__offset.is_value()) && field_penalty__time__presence.is_value() && (OPTIONAL_OMIT == field_penalty__time.get_selection() || field_penalty__time.is_value()); } int SI10FurtherDiffCellInfo::size_of() const { int ret_val = 6; if (field_cell__resel__hyst.ispresent()) ret_val++; if (field_ms__txpwr__max__cch.ispresent()) ret_val++; if (field_rxlev__access__min.ispresent()) ret_val++; if (field_cell__resel__offset.ispresent()) ret_val++; if (field_temp__offset.ispresent()) ret_val++; if (field_penalty__time.ispresent()) ret_val++; return ret_val; } void SI10FurtherDiffCellInfo::log() const { if (!is_bound()) { TTCN_Logger::log_event_unbound(); return; } TTCN_Logger::log_event_str("{ la_different := "); field_la__different.log(); TTCN_Logger::log_event_str(", cell_resel_hyst := "); field_cell__resel__hyst.log(); TTCN_Logger::log_event_str(", ms_txpwr_max_cch_presence := "); field_ms__txpwr__max__cch__presence.log(); TTCN_Logger::log_event_str(", ms_txpwr_max_cch := "); field_ms__txpwr__max__cch.log(); TTCN_Logger::log_event_str(", rxlev_access_min_presence := "); field_rxlev__access__min__presence.log(); TTCN_Logger::log_event_str(", rxlev_access_min := "); field_rxlev__access__min.log(); TTCN_Logger::log_event_str(", cell_resel_offset_presence := "); field_cell__resel__offset__presence.log(); TTCN_Logger::log_event_str(", cell_resel_offset := "); field_cell__resel__offset.log(); TTCN_Logger::log_event_str(", temp_offset_presence := "); field_temp__offset__presence.log(); TTCN_Logger::log_event_str(", temp_offset := "); field_temp__offset.log(); TTCN_Logger::log_event_str(", penalty_time_presence := "); field_penalty__time__presence.log(); TTCN_Logger::log_event_str(", penalty_time := "); field_penalty__time.log(); TTCN_Logger::log_event_str(" }"); } void SI10FurtherDiffCellInfo::set_implicit_omit() { if (la__different().is_bound()) la__different().set_implicit_omit(); if (!cell__resel__hyst().is_bound()) cell__resel__hyst() = OMIT_VALUE; else cell__resel__hyst().set_implicit_omit(); if (ms__txpwr__max__cch__presence().is_bound()) ms__txpwr__max__cch__presence().set_implicit_omit(); if (!ms__txpwr__max__cch().is_bound()) ms__txpwr__max__cch() = OMIT_VALUE; else ms__txpwr__max__cch().set_implicit_omit(); if (rxlev__access__min__presence().is_bound()) rxlev__access__min__presence().set_implicit_omit(); if (!rxlev__access__min().is_bound()) rxlev__access__min() = OMIT_VALUE; else rxlev__access__min().set_implicit_omit(); if (cell__resel__offset__presence().is_bound()) cell__resel__offset__presence().set_implicit_omit(); if (!cell__resel__offset().is_bound()) cell__resel__offset() = OMIT_VALUE; else cell__resel__offset().set_implicit_omit(); if (temp__offset__presence().is_bound()) temp__offset__presence().set_implicit_omit(); if (!temp__offset().is_bound()) temp__offset() = OMIT_VALUE; else temp__offset().set_implicit_omit(); if (penalty__time__presence().is_bound()) penalty__time__presence().set_implicit_omit(); if (!penalty__time().is_bound()) penalty__time() = OMIT_VALUE; else penalty__time().set_implicit_omit(); } void SI10FurtherDiffCellInfo::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 (120 && param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) la__different().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) cell__resel__hyst().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) ms__txpwr__max__cch__presence().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) ms__txpwr__max__cch().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) rxlev__access__min__presence().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) rxlev__access__min().set_param(*param.get_elem(5)); if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) cell__resel__offset__presence().set_param(*param.get_elem(6)); if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) cell__resel__offset().set_param(*param.get_elem(7)); if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) temp__offset__presence().set_param(*param.get_elem(8)); if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) temp__offset().set_param(*param.get_elem(9)); if (param.get_size()>10 && param.get_elem(10)->get_type()!=Module_Param::MP_NotUsed) penalty__time__presence().set_param(*param.get_elem(10)); if (param.get_size()>11 && param.get_elem(11)->get_type()!=Module_Param::MP_NotUsed) penalty__time().set_param(*param.get_elem(11)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "la_different")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { la__different().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "cell_resel_hyst")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cell__resel__hyst().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ms_txpwr_max_cch_presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ms__txpwr__max__cch__presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ms_txpwr_max_cch")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ms__txpwr__max__cch().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "rxlev_access_min_presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rxlev__access__min__presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "rxlev_access_min")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rxlev__access__min().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "cell_resel_offset_presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cell__resel__offset__presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "cell_resel_offset")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cell__resel__offset().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "temp_offset_presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { temp__offset__presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "temp_offset")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { temp__offset().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "penalty_time_presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { penalty__time__presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "penalty_time")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { penalty__time().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.SI10FurtherDiffCellInfo: %s", curr_param->get_id()->get_name()); break; } } break; default: param.type_error("record value", "@GSM_RestOctets.SI10FurtherDiffCellInfo"); } } void SI10FurtherDiffCellInfo::encode_text(Text_Buf& text_buf) const { field_la__different.encode_text(text_buf); field_cell__resel__hyst.encode_text(text_buf); field_ms__txpwr__max__cch__presence.encode_text(text_buf); field_ms__txpwr__max__cch.encode_text(text_buf); field_rxlev__access__min__presence.encode_text(text_buf); field_rxlev__access__min.encode_text(text_buf); field_cell__resel__offset__presence.encode_text(text_buf); field_cell__resel__offset.encode_text(text_buf); field_temp__offset__presence.encode_text(text_buf); field_temp__offset.encode_text(text_buf); field_penalty__time__presence.encode_text(text_buf); field_penalty__time.encode_text(text_buf); } void SI10FurtherDiffCellInfo::decode_text(Text_Buf& text_buf) { field_la__different.decode_text(text_buf); field_cell__resel__hyst.decode_text(text_buf); field_ms__txpwr__max__cch__presence.decode_text(text_buf); field_ms__txpwr__max__cch.decode_text(text_buf); field_rxlev__access__min__presence.decode_text(text_buf); field_rxlev__access__min.decode_text(text_buf); field_cell__resel__offset__presence.decode_text(text_buf); field_cell__resel__offset.decode_text(text_buf); field_temp__offset__presence.decode_text(text_buf); field_temp__offset.decode_text(text_buf); field_penalty__time__presence.decode_text(text_buf); field_penalty__time.decode_text(text_buf); } void SI10FurtherDiffCellInfo::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 SI10FurtherDiffCellInfo::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 SI10FurtherDiffCellInfo::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, SI10FurtherDiffCellInfo_la__different_descr_.raw->forceomit); decoded_field_length = field_la__different.RAW_decode(SI10FurtherDiffCellInfo_la__different_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_la__different == bs_0){ if (force_omit != NULL && (*force_omit)(1)) { field_cell__resel__hyst = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_1_force_omit(1, force_omit, SI10FurtherDiffCellInfo_cell__resel__hyst_descr_.raw->forceomit); decoded_field_length = field_cell__resel__hyst().RAW_decode(SI10FurtherDiffCellInfo_cell__resel__hyst_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_1_force_omit); if (decoded_field_length < 1) { field_cell__resel__hyst = 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__resel__hyst=OMIT_VALUE; RAW_Force_Omit field_2_force_omit(2, force_omit, SI10FurtherDiffCellInfo_ms__txpwr__max__cch__presence_descr_.raw->forceomit); decoded_field_length = field_ms__txpwr__max__cch__presence.RAW_decode(SI10FurtherDiffCellInfo_ms__txpwr__max__cch__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_ms__txpwr__max__cch__presence == bs_0){ if (force_omit != NULL && (*force_omit)(3)) { field_ms__txpwr__max__cch = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_3_force_omit(3, force_omit, SI10FurtherDiffCellInfo_ms__txpwr__max__cch_descr_.raw->forceomit); decoded_field_length = field_ms__txpwr__max__cch().RAW_decode(SI10FurtherDiffCellInfo_ms__txpwr__max__cch_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_3_force_omit); if (decoded_field_length < 1) { field_ms__txpwr__max__cch = 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_ms__txpwr__max__cch=OMIT_VALUE; RAW_Force_Omit field_4_force_omit(4, force_omit, SI10FurtherDiffCellInfo_rxlev__access__min__presence_descr_.raw->forceomit); decoded_field_length = field_rxlev__access__min__presence.RAW_decode(SI10FurtherDiffCellInfo_rxlev__access__min__presence_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 && field_rxlev__access__min__presence == bs_0){ if (force_omit != NULL && (*force_omit)(5)) { field_rxlev__access__min = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_5_force_omit(5, force_omit, SI10FurtherDiffCellInfo_rxlev__access__min_descr_.raw->forceomit); decoded_field_length = field_rxlev__access__min().RAW_decode(SI10FurtherDiffCellInfo_rxlev__access__min_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_5_force_omit); if (decoded_field_length < 1) { field_rxlev__access__min = 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_rxlev__access__min=OMIT_VALUE; RAW_Force_Omit field_6_force_omit(6, force_omit, SI10FurtherDiffCellInfo_cell__resel__offset__presence_descr_.raw->forceomit); decoded_field_length = field_cell__resel__offset__presence.RAW_decode(SI10FurtherDiffCellInfo_cell__resel__offset__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_cell__resel__offset__presence == bs_0){ if (force_omit != NULL && (*force_omit)(7)) { field_cell__resel__offset = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_7_force_omit(7, force_omit, SI10FurtherDiffCellInfo_cell__resel__offset_descr_.raw->forceomit); decoded_field_length = field_cell__resel__offset().RAW_decode(SI10FurtherDiffCellInfo_cell__resel__offset_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_7_force_omit); if (decoded_field_length < 1) { field_cell__resel__offset = 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__resel__offset=OMIT_VALUE; RAW_Force_Omit field_8_force_omit(8, force_omit, SI10FurtherDiffCellInfo_temp__offset__presence_descr_.raw->forceomit); decoded_field_length = field_temp__offset__presence.RAW_decode(SI10FurtherDiffCellInfo_temp__offset__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_temp__offset__presence == bs_0){ if (force_omit != NULL && (*force_omit)(9)) { field_temp__offset = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_9_force_omit(9, force_omit, SI10FurtherDiffCellInfo_temp__offset_descr_.raw->forceomit); decoded_field_length = field_temp__offset().RAW_decode(SI10FurtherDiffCellInfo_temp__offset_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_9_force_omit); if (decoded_field_length < 1) { field_temp__offset = 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_temp__offset=OMIT_VALUE; RAW_Force_Omit field_10_force_omit(10, force_omit, SI10FurtherDiffCellInfo_penalty__time__presence_descr_.raw->forceomit); decoded_field_length = field_penalty__time__presence.RAW_decode(SI10FurtherDiffCellInfo_penalty__time__presence_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()); if (limit > 0 && field_penalty__time__presence == bs_0){ if (force_omit != NULL && (*force_omit)(11)) { field_penalty__time = OMIT_VALUE; } else { size_t fl_start_pos = p_buf.get_pos_bit(); RAW_Force_Omit field_11_force_omit(11, force_omit, SI10FurtherDiffCellInfo_penalty__time_descr_.raw->forceomit); decoded_field_length = field_penalty__time().RAW_decode(SI10FurtherDiffCellInfo_penalty__time_descr_, p_buf, limit, local_top_order, TRUE, -1, TRUE, &field_11_force_omit); if (decoded_field_length < 1) { field_penalty__time = 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_penalty__time=OMIT_VALUE; p_buf.set_pos_bit(last_decoded_pos); return decoded_length+prepaddlength+p_buf.increase_pos_padd(p_td.raw->padding); } int SI10FurtherDiffCellInfo::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 = 12; myleaf.body.node.nodes = init_nodes_of_enc_tree(12); myleaf.body.node.nodes[0] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 0, SI10FurtherDiffCellInfo_la__different_descr_.raw); if (field_cell__resel__hyst.ispresent()) { myleaf.body.node.nodes[1] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 1, SI10FurtherDiffCellInfo_cell__resel__hyst_descr_.raw); } else myleaf.body.node.nodes[1] = NULL; myleaf.body.node.nodes[2] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 2, SI10FurtherDiffCellInfo_ms__txpwr__max__cch__presence_descr_.raw); if (field_ms__txpwr__max__cch.ispresent()) { myleaf.body.node.nodes[3] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 3, SI10FurtherDiffCellInfo_ms__txpwr__max__cch_descr_.raw); } else myleaf.body.node.nodes[3] = NULL; myleaf.body.node.nodes[4] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 4, SI10FurtherDiffCellInfo_rxlev__access__min__presence_descr_.raw); if (field_rxlev__access__min.ispresent()) { myleaf.body.node.nodes[5] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 5, SI10FurtherDiffCellInfo_rxlev__access__min_descr_.raw); } else myleaf.body.node.nodes[5] = NULL; myleaf.body.node.nodes[6] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 6, SI10FurtherDiffCellInfo_cell__resel__offset__presence_descr_.raw); if (field_cell__resel__offset.ispresent()) { myleaf.body.node.nodes[7] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 7, SI10FurtherDiffCellInfo_cell__resel__offset_descr_.raw); } else myleaf.body.node.nodes[7] = NULL; myleaf.body.node.nodes[8] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 8, SI10FurtherDiffCellInfo_temp__offset__presence_descr_.raw); if (field_temp__offset.ispresent()) { myleaf.body.node.nodes[9] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 9, SI10FurtherDiffCellInfo_temp__offset_descr_.raw); } else myleaf.body.node.nodes[9] = NULL; myleaf.body.node.nodes[10] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 10, SI10FurtherDiffCellInfo_penalty__time__presence_descr_.raw); if (field_penalty__time.ispresent()) { myleaf.body.node.nodes[11] = new RAW_enc_tree(TRUE, &myleaf, &(myleaf.curr_pos), 11, SI10FurtherDiffCellInfo_penalty__time_descr_.raw); } else myleaf.body.node.nodes[11] = NULL; encoded_length += field_la__different.RAW_encode(SI10FurtherDiffCellInfo_la__different_descr_, *myleaf.body.node.nodes[0]); if (field_cell__resel__hyst.ispresent()) { encoded_length += field_cell__resel__hyst().RAW_encode(SI10FurtherDiffCellInfo_cell__resel__hyst_descr_, *myleaf.body.node.nodes[1]); } encoded_length += field_ms__txpwr__max__cch__presence.RAW_encode(SI10FurtherDiffCellInfo_ms__txpwr__max__cch__presence_descr_, *myleaf.body.node.nodes[2]); if (field_ms__txpwr__max__cch.ispresent()) { encoded_length += field_ms__txpwr__max__cch().RAW_encode(SI10FurtherDiffCellInfo_ms__txpwr__max__cch_descr_, *myleaf.body.node.nodes[3]); } encoded_length += field_rxlev__access__min__presence.RAW_encode(SI10FurtherDiffCellInfo_rxlev__access__min__presence_descr_, *myleaf.body.node.nodes[4]); if (field_rxlev__access__min.ispresent()) { encoded_length += field_rxlev__access__min().RAW_encode(SI10FurtherDiffCellInfo_rxlev__access__min_descr_, *myleaf.body.node.nodes[5]); } encoded_length += field_cell__resel__offset__presence.RAW_encode(SI10FurtherDiffCellInfo_cell__resel__offset__presence_descr_, *myleaf.body.node.nodes[6]); if (field_cell__resel__offset.ispresent()) { encoded_length += field_cell__resel__offset().RAW_encode(SI10FurtherDiffCellInfo_cell__resel__offset_descr_, *myleaf.body.node.nodes[7]); } encoded_length += field_temp__offset__presence.RAW_encode(SI10FurtherDiffCellInfo_temp__offset__presence_descr_, *myleaf.body.node.nodes[8]); if (field_temp__offset.ispresent()) { encoded_length += field_temp__offset().RAW_encode(SI10FurtherDiffCellInfo_temp__offset_descr_, *myleaf.body.node.nodes[9]); } encoded_length += field_penalty__time__presence.RAW_encode(SI10FurtherDiffCellInfo_penalty__time__presence_descr_, *myleaf.body.node.nodes[10]); if (field_penalty__time.ispresent()) { encoded_length += field_penalty__time().RAW_encode(SI10FurtherDiffCellInfo_penalty__time_descr_, *myleaf.body.node.nodes[11]); } if (field_cell__resel__hyst.ispresent() && (field_la__different != 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(SI10FurtherDiffCellInfo_la__different_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_ms__txpwr__max__cch.ispresent() && (field_ms__txpwr__max__cch__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(SI10FurtherDiffCellInfo_ms__txpwr__max__cch__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_rxlev__access__min.ispresent() && (field_rxlev__access__min__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[]={4}; 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(SI10FurtherDiffCellInfo_rxlev__access__min__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_cell__resel__offset.ispresent() && (field_cell__resel__offset__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(SI10FurtherDiffCellInfo_cell__resel__offset__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_temp__offset.ispresent() && (field_temp__offset__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(SI10FurtherDiffCellInfo_temp__offset__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_penalty__time.ispresent() && (field_penalty__time__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[]={10}; 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(SI10FurtherDiffCellInfo_penalty__time__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 SI10FurtherDiffCellInfo_template::single_value_struct { BITSTRING_template field_la__different; INTEGER_template field_cell__resel__hyst; BITSTRING_template field_ms__txpwr__max__cch__presence; INTEGER_template field_ms__txpwr__max__cch; BITSTRING_template field_rxlev__access__min__presence; INTEGER_template field_rxlev__access__min; BITSTRING_template field_cell__resel__offset__presence; INTEGER_template field_cell__resel__offset; BITSTRING_template field_temp__offset__presence; INTEGER_template field_temp__offset; BITSTRING_template field_penalty__time__presence; INTEGER_template field_penalty__time; }; void SI10FurtherDiffCellInfo_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_la__different = ANY_VALUE; single_value->field_cell__resel__hyst = ANY_OR_OMIT; single_value->field_ms__txpwr__max__cch__presence = ANY_VALUE; single_value->field_ms__txpwr__max__cch = ANY_OR_OMIT; single_value->field_rxlev__access__min__presence = ANY_VALUE; single_value->field_rxlev__access__min = ANY_OR_OMIT; single_value->field_cell__resel__offset__presence = ANY_VALUE; single_value->field_cell__resel__offset = ANY_OR_OMIT; single_value->field_temp__offset__presence = ANY_VALUE; single_value->field_temp__offset = ANY_OR_OMIT; single_value->field_penalty__time__presence = ANY_VALUE; single_value->field_penalty__time = ANY_OR_OMIT; } } } void SI10FurtherDiffCellInfo_template::copy_value(const SI10FurtherDiffCellInfo& other_value) { single_value = new single_value_struct; if (other_value.la__different().is_bound()) { single_value->field_la__different = other_value.la__different(); } else { single_value->field_la__different.clean_up(); } if (other_value.cell__resel__hyst().is_bound()) { if (other_value.cell__resel__hyst().ispresent()) single_value->field_cell__resel__hyst = other_value.cell__resel__hyst()(); else single_value->field_cell__resel__hyst = OMIT_VALUE; } else { single_value->field_cell__resel__hyst.clean_up(); } if (other_value.ms__txpwr__max__cch__presence().is_bound()) { single_value->field_ms__txpwr__max__cch__presence = other_value.ms__txpwr__max__cch__presence(); } else { single_value->field_ms__txpwr__max__cch__presence.clean_up(); } if (other_value.ms__txpwr__max__cch().is_bound()) { if (other_value.ms__txpwr__max__cch().ispresent()) single_value->field_ms__txpwr__max__cch = other_value.ms__txpwr__max__cch()(); else single_value->field_ms__txpwr__max__cch = OMIT_VALUE; } else { single_value->field_ms__txpwr__max__cch.clean_up(); } if (other_value.rxlev__access__min__presence().is_bound()) { single_value->field_rxlev__access__min__presence = other_value.rxlev__access__min__presence(); } else { single_value->field_rxlev__access__min__presence.clean_up(); } if (other_value.rxlev__access__min().is_bound()) { if (other_value.rxlev__access__min().ispresent()) single_value->field_rxlev__access__min = other_value.rxlev__access__min()(); else single_value->field_rxlev__access__min = OMIT_VALUE; } else { single_value->field_rxlev__access__min.clean_up(); } if (other_value.cell__resel__offset__presence().is_bound()) { single_value->field_cell__resel__offset__presence = other_value.cell__resel__offset__presence(); } else { single_value->field_cell__resel__offset__presence.clean_up(); } if (other_value.cell__resel__offset().is_bound()) { if (other_value.cell__resel__offset().ispresent()) single_value->field_cell__resel__offset = other_value.cell__resel__offset()(); else single_value->field_cell__resel__offset = OMIT_VALUE; } else { single_value->field_cell__resel__offset.clean_up(); } if (other_value.temp__offset__presence().is_bound()) { single_value->field_temp__offset__presence = other_value.temp__offset__presence(); } else { single_value->field_temp__offset__presence.clean_up(); } if (other_value.temp__offset().is_bound()) { if (other_value.temp__offset().ispresent()) single_value->field_temp__offset = other_value.temp__offset()(); else single_value->field_temp__offset = OMIT_VALUE; } else { single_value->field_temp__offset.clean_up(); } if (other_value.penalty__time__presence().is_bound()) { single_value->field_penalty__time__presence = other_value.penalty__time__presence(); } else { single_value->field_penalty__time__presence.clean_up(); } if (other_value.penalty__time().is_bound()) { if (other_value.penalty__time().ispresent()) single_value->field_penalty__time = other_value.penalty__time()(); else single_value->field_penalty__time = OMIT_VALUE; } else { single_value->field_penalty__time.clean_up(); } set_selection(SPECIFIC_VALUE); } void SI10FurtherDiffCellInfo_template::copy_template(const SI10FurtherDiffCellInfo_template& other_value) { switch (other_value.template_selection) { case SPECIFIC_VALUE: single_value = new single_value_struct; if (UNINITIALIZED_TEMPLATE != other_value.la__different().get_selection()) { single_value->field_la__different = other_value.la__different(); } else { single_value->field_la__different.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.cell__resel__hyst().get_selection()) { single_value->field_cell__resel__hyst = other_value.cell__resel__hyst(); } else { single_value->field_cell__resel__hyst.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.ms__txpwr__max__cch__presence().get_selection()) { single_value->field_ms__txpwr__max__cch__presence = other_value.ms__txpwr__max__cch__presence(); } else { single_value->field_ms__txpwr__max__cch__presence.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.ms__txpwr__max__cch().get_selection()) { single_value->field_ms__txpwr__max__cch = other_value.ms__txpwr__max__cch(); } else { single_value->field_ms__txpwr__max__cch.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.rxlev__access__min__presence().get_selection()) { single_value->field_rxlev__access__min__presence = other_value.rxlev__access__min__presence(); } else { single_value->field_rxlev__access__min__presence.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.rxlev__access__min().get_selection()) { single_value->field_rxlev__access__min = other_value.rxlev__access__min(); } else { single_value->field_rxlev__access__min.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.cell__resel__offset__presence().get_selection()) { single_value->field_cell__resel__offset__presence = other_value.cell__resel__offset__presence(); } else { single_value->field_cell__resel__offset__presence.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.cell__resel__offset().get_selection()) { single_value->field_cell__resel__offset = other_value.cell__resel__offset(); } else { single_value->field_cell__resel__offset.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.temp__offset__presence().get_selection()) { single_value->field_temp__offset__presence = other_value.temp__offset__presence(); } else { single_value->field_temp__offset__presence.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.temp__offset().get_selection()) { single_value->field_temp__offset = other_value.temp__offset(); } else { single_value->field_temp__offset.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.penalty__time__presence().get_selection()) { single_value->field_penalty__time__presence = other_value.penalty__time__presence(); } else { single_value->field_penalty__time__presence.clean_up(); } if (UNINITIALIZED_TEMPLATE != other_value.penalty__time().get_selection()) { single_value->field_penalty__time = other_value.penalty__time(); } else { single_value->field_penalty__time.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 SI10FurtherDiffCellInfo_template[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 SI10FurtherDiffCellInfo_template(*other_value.implication_.precondition); implication_.implied_template = new SI10FurtherDiffCellInfo_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.SI10FurtherDiffCellInfo."); break; } set_selection(other_value); } SI10FurtherDiffCellInfo_template::SI10FurtherDiffCellInfo_template() { } SI10FurtherDiffCellInfo_template::SI10FurtherDiffCellInfo_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } SI10FurtherDiffCellInfo_template::SI10FurtherDiffCellInfo_template(const SI10FurtherDiffCellInfo& other_value) { copy_value(other_value); } SI10FurtherDiffCellInfo_template::SI10FurtherDiffCellInfo_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI10FurtherDiffCellInfo&)other_value); break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of type @GSM_RestOctets.SI10FurtherDiffCellInfo from an unbound optional field."); } } SI10FurtherDiffCellInfo_template::SI10FurtherDiffCellInfo_template(SI10FurtherDiffCellInfo_template* p_precondition, SI10FurtherDiffCellInfo_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } SI10FurtherDiffCellInfo_template::SI10FurtherDiffCellInfo_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; } SI10FurtherDiffCellInfo_template::SI10FurtherDiffCellInfo_template(const SI10FurtherDiffCellInfo_template& other_value) : Base_Template() { copy_template(other_value); } SI10FurtherDiffCellInfo_template::~SI10FurtherDiffCellInfo_template() { clean_up(); } SI10FurtherDiffCellInfo_template& SI10FurtherDiffCellInfo_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } SI10FurtherDiffCellInfo_template& SI10FurtherDiffCellInfo_template::operator=(const SI10FurtherDiffCellInfo& other_value) { clean_up(); copy_value(other_value); return *this; } SI10FurtherDiffCellInfo_template& SI10FurtherDiffCellInfo_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: copy_value((const SI10FurtherDiffCellInfo&)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.SI10FurtherDiffCellInfo."); } return *this; } SI10FurtherDiffCellInfo_template& SI10FurtherDiffCellInfo_template::operator=(const SI10FurtherDiffCellInfo_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean SI10FurtherDiffCellInfo_template::match(const SI10FurtherDiffCellInfo& 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.la__different().is_bound()) return FALSE; if(!single_value->field_la__different.match(other_value.la__different(), legacy))return FALSE; if(!other_value.cell__resel__hyst().is_bound()) return FALSE; if((other_value.cell__resel__hyst().ispresent() ? !single_value->field_cell__resel__hyst.match((const INTEGER&)other_value.cell__resel__hyst(), legacy) : !single_value->field_cell__resel__hyst.match_omit(legacy)))return FALSE; if(!other_value.ms__txpwr__max__cch__presence().is_bound()) return FALSE; if(!single_value->field_ms__txpwr__max__cch__presence.match(other_value.ms__txpwr__max__cch__presence(), legacy))return FALSE; if(!other_value.ms__txpwr__max__cch().is_bound()) return FALSE; if((other_value.ms__txpwr__max__cch().ispresent() ? !single_value->field_ms__txpwr__max__cch.match((const INTEGER&)other_value.ms__txpwr__max__cch(), legacy) : !single_value->field_ms__txpwr__max__cch.match_omit(legacy)))return FALSE; if(!other_value.rxlev__access__min__presence().is_bound()) return FALSE; if(!single_value->field_rxlev__access__min__presence.match(other_value.rxlev__access__min__presence(), legacy))return FALSE; if(!other_value.rxlev__access__min().is_bound()) return FALSE; if((other_value.rxlev__access__min().ispresent() ? !single_value->field_rxlev__access__min.match((const INTEGER&)other_value.rxlev__access__min(), legacy) : !single_value->field_rxlev__access__min.match_omit(legacy)))return FALSE; if(!other_value.cell__resel__offset__presence().is_bound()) return FALSE; if(!single_value->field_cell__resel__offset__presence.match(other_value.cell__resel__offset__presence(), legacy))return FALSE; if(!other_value.cell__resel__offset().is_bound()) return FALSE; if((other_value.cell__resel__offset().ispresent() ? !single_value->field_cell__resel__offset.match((const INTEGER&)other_value.cell__resel__offset(), legacy) : !single_value->field_cell__resel__offset.match_omit(legacy)))return FALSE; if(!other_value.temp__offset__presence().is_bound()) return FALSE; if(!single_value->field_temp__offset__presence.match(other_value.temp__offset__presence(), legacy))return FALSE; if(!other_value.temp__offset().is_bound()) return FALSE; if((other_value.temp__offset().ispresent() ? !single_value->field_temp__offset.match((const INTEGER&)other_value.temp__offset(), legacy) : !single_value->field_temp__offset.match_omit(legacy)))return FALSE; if(!other_value.penalty__time__presence().is_bound()) return FALSE; if(!single_value->field_penalty__time__presence.match(other_value.penalty__time__presence(), legacy))return FALSE; if(!other_value.penalty__time().is_bound()) return FALSE; if((other_value.penalty__time().ispresent() ? !single_value->field_penalty__time.match((const INTEGER&)other_value.penalty__time(), legacy) : !single_value->field_penalty__time.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.SI10FurtherDiffCellInfo."); } return FALSE; } boolean SI10FurtherDiffCellInfo_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; if (template_selection != SPECIFIC_VALUE) return TRUE; return single_value->field_la__different.is_bound() || (single_value->field_cell__resel__hyst.is_omit() || single_value->field_cell__resel__hyst.is_bound()) || single_value->field_ms__txpwr__max__cch__presence.is_bound() || (single_value->field_ms__txpwr__max__cch.is_omit() || single_value->field_ms__txpwr__max__cch.is_bound()) || single_value->field_rxlev__access__min__presence.is_bound() || (single_value->field_rxlev__access__min.is_omit() || single_value->field_rxlev__access__min.is_bound()) || single_value->field_cell__resel__offset__presence.is_bound() || (single_value->field_cell__resel__offset.is_omit() || single_value->field_cell__resel__offset.is_bound()) || single_value->field_temp__offset__presence.is_bound() || (single_value->field_temp__offset.is_omit() || single_value->field_temp__offset.is_bound()) || single_value->field_penalty__time__presence.is_bound() || (single_value->field_penalty__time.is_omit() || single_value->field_penalty__time.is_bound()); } boolean SI10FurtherDiffCellInfo_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value->field_la__different.is_value() && (single_value->field_cell__resel__hyst.is_omit() || single_value->field_cell__resel__hyst.is_value()) && single_value->field_ms__txpwr__max__cch__presence.is_value() && (single_value->field_ms__txpwr__max__cch.is_omit() || single_value->field_ms__txpwr__max__cch.is_value()) && single_value->field_rxlev__access__min__presence.is_value() && (single_value->field_rxlev__access__min.is_omit() || single_value->field_rxlev__access__min.is_value()) && single_value->field_cell__resel__offset__presence.is_value() && (single_value->field_cell__resel__offset.is_omit() || single_value->field_cell__resel__offset.is_value()) && single_value->field_temp__offset__presence.is_value() && (single_value->field_temp__offset.is_omit() || single_value->field_temp__offset.is_value()) && single_value->field_penalty__time__presence.is_value() && (single_value->field_penalty__time.is_omit() || single_value->field_penalty__time.is_value()); } void SI10FurtherDiffCellInfo_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; } SI10FurtherDiffCellInfo SI10FurtherDiffCellInfo_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.SI10FurtherDiffCellInfo."); SI10FurtherDiffCellInfo ret_val; if (single_value->field_la__different.is_bound()) { ret_val.la__different() = single_value->field_la__different.valueof(); } if (single_value->field_cell__resel__hyst.is_omit()) ret_val.cell__resel__hyst() = OMIT_VALUE; else if (single_value->field_cell__resel__hyst.is_bound()) { ret_val.cell__resel__hyst() = single_value->field_cell__resel__hyst.valueof(); } if (single_value->field_ms__txpwr__max__cch__presence.is_bound()) { ret_val.ms__txpwr__max__cch__presence() = single_value->field_ms__txpwr__max__cch__presence.valueof(); } if (single_value->field_ms__txpwr__max__cch.is_omit()) ret_val.ms__txpwr__max__cch() = OMIT_VALUE; else if (single_value->field_ms__txpwr__max__cch.is_bound()) { ret_val.ms__txpwr__max__cch() = single_value->field_ms__txpwr__max__cch.valueof(); } if (single_value->field_rxlev__access__min__presence.is_bound()) { ret_val.rxlev__access__min__presence() = single_value->field_rxlev__access__min__presence.valueof(); } if (single_value->field_rxlev__access__min.is_omit()) ret_val.rxlev__access__min() = OMIT_VALUE; else if (single_value->field_rxlev__access__min.is_bound()) { ret_val.rxlev__access__min() = single_value->field_rxlev__access__min.valueof(); } if (single_value->field_cell__resel__offset__presence.is_bound()) { ret_val.cell__resel__offset__presence() = single_value->field_cell__resel__offset__presence.valueof(); } if (single_value->field_cell__resel__offset.is_omit()) ret_val.cell__resel__offset() = OMIT_VALUE; else if (single_value->field_cell__resel__offset.is_bound()) { ret_val.cell__resel__offset() = single_value->field_cell__resel__offset.valueof(); } if (single_value->field_temp__offset__presence.is_bound()) { ret_val.temp__offset__presence() = single_value->field_temp__offset__presence.valueof(); } if (single_value->field_temp__offset.is_omit()) ret_val.temp__offset() = OMIT_VALUE; else if (single_value->field_temp__offset.is_bound()) { ret_val.temp__offset() = single_value->field_temp__offset.valueof(); } if (single_value->field_penalty__time__presence.is_bound()) { ret_val.penalty__time__presence() = single_value->field_penalty__time__presence.valueof(); } if (single_value->field_penalty__time.is_omit()) ret_val.penalty__time() = OMIT_VALUE; else if (single_value->field_penalty__time.is_bound()) { ret_val.penalty__time() = single_value->field_penalty__time.valueof(); } return ret_val; } void SI10FurtherDiffCellInfo_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.SI10FurtherDiffCellInfo."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new SI10FurtherDiffCellInfo_template[list_length]; } SI10FurtherDiffCellInfo_template& SI10FurtherDiffCellInfo_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.SI10FurtherDiffCellInfo."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of type @GSM_RestOctets.SI10FurtherDiffCellInfo."); return value_list.list_value[list_index]; } BITSTRING_template& SI10FurtherDiffCellInfo_template::la__different() { set_specific(); return single_value->field_la__different; } const BITSTRING_template& SI10FurtherDiffCellInfo_template::la__different() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field la_different of a non-specific template of type @GSM_RestOctets.SI10FurtherDiffCellInfo."); return single_value->field_la__different; } INTEGER_template& SI10FurtherDiffCellInfo_template::cell__resel__hyst() { set_specific(); return single_value->field_cell__resel__hyst; } const INTEGER_template& SI10FurtherDiffCellInfo_template::cell__resel__hyst() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field cell_resel_hyst of a non-specific template of type @GSM_RestOctets.SI10FurtherDiffCellInfo."); return single_value->field_cell__resel__hyst; } BITSTRING_template& SI10FurtherDiffCellInfo_template::ms__txpwr__max__cch__presence() { set_specific(); return single_value->field_ms__txpwr__max__cch__presence; } const BITSTRING_template& SI10FurtherDiffCellInfo_template::ms__txpwr__max__cch__presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ms_txpwr_max_cch_presence of a non-specific template of type @GSM_RestOctets.SI10FurtherDiffCellInfo."); return single_value->field_ms__txpwr__max__cch__presence; } INTEGER_template& SI10FurtherDiffCellInfo_template::ms__txpwr__max__cch() { set_specific(); return single_value->field_ms__txpwr__max__cch; } const INTEGER_template& SI10FurtherDiffCellInfo_template::ms__txpwr__max__cch() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field ms_txpwr_max_cch of a non-specific template of type @GSM_RestOctets.SI10FurtherDiffCellInfo."); return single_value->field_ms__txpwr__max__cch; } BITSTRING_template& SI10FurtherDiffCellInfo_template::rxlev__access__min__presence() { set_specific(); return single_value->field_rxlev__access__min__presence; } const BITSTRING_template& SI10FurtherDiffCellInfo_template::rxlev__access__min__presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field rxlev_access_min_presence of a non-specific template of type @GSM_RestOctets.SI10FurtherDiffCellInfo."); return single_value->field_rxlev__access__min__presence; } INTEGER_template& SI10FurtherDiffCellInfo_template::rxlev__access__min() { set_specific(); return single_value->field_rxlev__access__min; } const INTEGER_template& SI10FurtherDiffCellInfo_template::rxlev__access__min() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field rxlev_access_min of a non-specific template of type @GSM_RestOctets.SI10FurtherDiffCellInfo."); return single_value->field_rxlev__access__min; } BITSTRING_template& SI10FurtherDiffCellInfo_template::cell__resel__offset__presence() { set_specific(); return single_value->field_cell__resel__offset__presence; } const BITSTRING_template& SI10FurtherDiffCellInfo_template::cell__resel__offset__presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field cell_resel_offset_presence of a non-specific template of type @GSM_RestOctets.SI10FurtherDiffCellInfo."); return single_value->field_cell__resel__offset__presence; } INTEGER_template& SI10FurtherDiffCellInfo_template::cell__resel__offset() { set_specific(); return single_value->field_cell__resel__offset; } const INTEGER_template& SI10FurtherDiffCellInfo_template::cell__resel__offset() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field cell_resel_offset of a non-specific template of type @GSM_RestOctets.SI10FurtherDiffCellInfo."); return single_value->field_cell__resel__offset; } BITSTRING_template& SI10FurtherDiffCellInfo_template::temp__offset__presence() { set_specific(); return single_value->field_temp__offset__presence; } const BITSTRING_template& SI10FurtherDiffCellInfo_template::temp__offset__presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field temp_offset_presence of a non-specific template of type @GSM_RestOctets.SI10FurtherDiffCellInfo."); return single_value->field_temp__offset__presence; } INTEGER_template& SI10FurtherDiffCellInfo_template::temp__offset() { set_specific(); return single_value->field_temp__offset; } const INTEGER_template& SI10FurtherDiffCellInfo_template::temp__offset() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field temp_offset of a non-specific template of type @GSM_RestOctets.SI10FurtherDiffCellInfo."); return single_value->field_temp__offset; } BITSTRING_template& SI10FurtherDiffCellInfo_template::penalty__time__presence() { set_specific(); return single_value->field_penalty__time__presence; } const BITSTRING_template& SI10FurtherDiffCellInfo_template::penalty__time__presence() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field penalty_time_presence of a non-specific template of type @GSM_RestOctets.SI10FurtherDiffCellInfo."); return single_value->field_penalty__time__presence; } INTEGER_template& SI10FurtherDiffCellInfo_template::penalty__time() { set_specific(); return single_value->field_penalty__time; } const INTEGER_template& SI10FurtherDiffCellInfo_template::penalty__time() const { if (template_selection != SPECIFIC_VALUE) TTCN_error("Accessing field penalty_time of a non-specific template of type @GSM_RestOctets.SI10FurtherDiffCellInfo."); return single_value->field_penalty__time; } int SI10FurtherDiffCellInfo_template::size_of() const { if (is_ifpresent) TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10FurtherDiffCellInfo which has an ifpresent attribute."); switch (template_selection) { case SPECIFIC_VALUE: { int ret_val = 6; if (single_value->field_cell__resel__hyst.is_present()) ret_val++; if (single_value->field_ms__txpwr__max__cch.is_present()) ret_val++; if (single_value->field_rxlev__access__min.is_present()) ret_val++; if (single_value->field_cell__resel__offset.is_present()) ret_val++; if (single_value->field_temp__offset.is_present()) ret_val++; if (single_value->field_penalty__time.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.SI10FurtherDiffCellInfo 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.SI10FurtherDiffCellInfo 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.SI10FurtherDiffCellInfo containing omit value."); case ANY_VALUE: case ANY_OR_OMIT: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10FurtherDiffCellInfo containing */? value."); case COMPLEMENTED_LIST: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10FurtherDiffCellInfo containing complemented list."); case CONJUNCTION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10FurtherDiffCellInfo containing a conjunction list match."); case IMPLICATION_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10FurtherDiffCellInfo containing an implication match."); case DYNAMIC_MATCH: TTCN_error("Performing sizeof() operation on a template of type @GSM_RestOctets.SI10FurtherDiffCellInfo containing a dynamic match."); default: TTCN_error("Performing sizeof() operation on an uninitialized/unsupported template of type @GSM_RestOctets.SI10FurtherDiffCellInfo."); } return 0; } void SI10FurtherDiffCellInfo_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_str("{ la_different := "); single_value->field_la__different.log(); TTCN_Logger::log_event_str(", cell_resel_hyst := "); single_value->field_cell__resel__hyst.log(); TTCN_Logger::log_event_str(", ms_txpwr_max_cch_presence := "); single_value->field_ms__txpwr__max__cch__presence.log(); TTCN_Logger::log_event_str(", ms_txpwr_max_cch := "); single_value->field_ms__txpwr__max__cch.log(); TTCN_Logger::log_event_str(", rxlev_access_min_presence := "); single_value->field_rxlev__access__min__presence.log(); TTCN_Logger::log_event_str(", rxlev_access_min := "); single_value->field_rxlev__access__min.log(); TTCN_Logger::log_event_str(", cell_resel_offset_presence := "); single_value->field_cell__resel__offset__presence.log(); TTCN_Logger::log_event_str(", cell_resel_offset := "); single_value->field_cell__resel__offset.log(); TTCN_Logger::log_event_str(", temp_offset_presence := "); single_value->field_temp__offset__presence.log(); TTCN_Logger::log_event_str(", temp_offset := "); single_value->field_temp__offset.log(); TTCN_Logger::log_event_str(", penalty_time_presence := "); single_value->field_penalty__time__presence.log(); TTCN_Logger::log_event_str(", penalty_time := "); single_value->field_penalty__time.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 SI10FurtherDiffCellInfo_template::log_match(const SI10FurtherDiffCellInfo& 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_la__different.match(match_value.la__different(), legacy)){ TTCN_Logger::log_logmatch_info(".la_different"); single_value->field_la__different.log_match(match_value.la__different(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.cell__resel__hyst().ispresent()){ if(!single_value->field_cell__resel__hyst.match(match_value.cell__resel__hyst(), legacy)){ TTCN_Logger::log_logmatch_info(".cell_resel_hyst"); single_value->field_cell__resel__hyst.log_match(match_value.cell__resel__hyst(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_cell__resel__hyst.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".cell_resel_hyst := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_cell__resel__hyst.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if(!single_value->field_ms__txpwr__max__cch__presence.match(match_value.ms__txpwr__max__cch__presence(), legacy)){ TTCN_Logger::log_logmatch_info(".ms_txpwr_max_cch_presence"); single_value->field_ms__txpwr__max__cch__presence.log_match(match_value.ms__txpwr__max__cch__presence(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.ms__txpwr__max__cch().ispresent()){ if(!single_value->field_ms__txpwr__max__cch.match(match_value.ms__txpwr__max__cch(), legacy)){ TTCN_Logger::log_logmatch_info(".ms_txpwr_max_cch"); single_value->field_ms__txpwr__max__cch.log_match(match_value.ms__txpwr__max__cch(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_ms__txpwr__max__cch.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".ms_txpwr_max_cch := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_ms__txpwr__max__cch.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if(!single_value->field_rxlev__access__min__presence.match(match_value.rxlev__access__min__presence(), legacy)){ TTCN_Logger::log_logmatch_info(".rxlev_access_min_presence"); single_value->field_rxlev__access__min__presence.log_match(match_value.rxlev__access__min__presence(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.rxlev__access__min().ispresent()){ if(!single_value->field_rxlev__access__min.match(match_value.rxlev__access__min(), legacy)){ TTCN_Logger::log_logmatch_info(".rxlev_access_min"); single_value->field_rxlev__access__min.log_match(match_value.rxlev__access__min(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_rxlev__access__min.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".rxlev_access_min := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_rxlev__access__min.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if(!single_value->field_cell__resel__offset__presence.match(match_value.cell__resel__offset__presence(), legacy)){ TTCN_Logger::log_logmatch_info(".cell_resel_offset_presence"); single_value->field_cell__resel__offset__presence.log_match(match_value.cell__resel__offset__presence(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.cell__resel__offset().ispresent()){ if(!single_value->field_cell__resel__offset.match(match_value.cell__resel__offset(), legacy)){ TTCN_Logger::log_logmatch_info(".cell_resel_offset"); single_value->field_cell__resel__offset.log_match(match_value.cell__resel__offset(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_cell__resel__offset.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".cell_resel_offset := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_cell__resel__offset.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if(!single_value->field_temp__offset__presence.match(match_value.temp__offset__presence(), legacy)){ TTCN_Logger::log_logmatch_info(".temp_offset_presence"); single_value->field_temp__offset__presence.log_match(match_value.temp__offset__presence(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.temp__offset().ispresent()){ if(!single_value->field_temp__offset.match(match_value.temp__offset(), legacy)){ TTCN_Logger::log_logmatch_info(".temp_offset"); single_value->field_temp__offset.log_match(match_value.temp__offset(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_temp__offset.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".temp_offset := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_temp__offset.log(); TTCN_Logger::log_event_str(" unmatched"); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } if(!single_value->field_penalty__time__presence.match(match_value.penalty__time__presence(), legacy)){ TTCN_Logger::log_logmatch_info(".penalty_time_presence"); single_value->field_penalty__time__presence.log_match(match_value.penalty__time__presence(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } if (match_value.penalty__time().ispresent()){ if(!single_value->field_penalty__time.match(match_value.penalty__time(), legacy)){ TTCN_Logger::log_logmatch_info(".penalty_time"); single_value->field_penalty__time.log_match(match_value.penalty__time(), legacy); TTCN_Logger::set_logmatch_buffer_len(previous_size); } } else { if (!single_value->field_penalty__time.match_omit(legacy)){ TTCN_Logger::log_logmatch_info(".penalty_time := omit with "); TTCN_Logger::print_logmatch_buffer(); single_value->field_penalty__time.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("{ la_different := "); single_value->field_la__different.log_match(match_value.la__different(), legacy); TTCN_Logger::log_event_str(", cell_resel_hyst := "); if (match_value.cell__resel__hyst().ispresent()) { single_value->field_cell__resel__hyst.log_match(match_value.cell__resel__hyst(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_cell__resel__hyst.log(); if (single_value->field_cell__resel__hyst.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", ms_txpwr_max_cch_presence := "); single_value->field_ms__txpwr__max__cch__presence.log_match(match_value.ms__txpwr__max__cch__presence(), legacy); TTCN_Logger::log_event_str(", ms_txpwr_max_cch := "); if (match_value.ms__txpwr__max__cch().ispresent()) { single_value->field_ms__txpwr__max__cch.log_match(match_value.ms__txpwr__max__cch(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_ms__txpwr__max__cch.log(); if (single_value->field_ms__txpwr__max__cch.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", rxlev_access_min_presence := "); single_value->field_rxlev__access__min__presence.log_match(match_value.rxlev__access__min__presence(), legacy); TTCN_Logger::log_event_str(", rxlev_access_min := "); if (match_value.rxlev__access__min().ispresent()) { single_value->field_rxlev__access__min.log_match(match_value.rxlev__access__min(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_rxlev__access__min.log(); if (single_value->field_rxlev__access__min.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", cell_resel_offset_presence := "); single_value->field_cell__resel__offset__presence.log_match(match_value.cell__resel__offset__presence(), legacy); TTCN_Logger::log_event_str(", cell_resel_offset := "); if (match_value.cell__resel__offset().ispresent()) { single_value->field_cell__resel__offset.log_match(match_value.cell__resel__offset(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_cell__resel__offset.log(); if (single_value->field_cell__resel__offset.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", temp_offset_presence := "); single_value->field_temp__offset__presence.log_match(match_value.temp__offset__presence(), legacy); TTCN_Logger::log_event_str(", temp_offset := "); if (match_value.temp__offset().ispresent()) { single_value->field_temp__offset.log_match(match_value.temp__offset(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_temp__offset.log(); if (single_value->field_temp__offset.match_omit(legacy)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } TTCN_Logger::log_event_str(", penalty_time_presence := "); single_value->field_penalty__time__presence.log_match(match_value.penalty__time__presence(), legacy); TTCN_Logger::log_event_str(", penalty_time := "); if (match_value.penalty__time().ispresent()) { single_value->field_penalty__time.log_match(match_value.penalty__time(), legacy); } else { TTCN_Logger::log_event_str("omit with "); single_value->field_penalty__time.log(); if (single_value->field_penalty__time.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 SI10FurtherDiffCellInfo_template::set_implicit_omit() { if (template_selection != SPECIFIC_VALUE) return; if (la__different().is_bound()) la__different().set_implicit_omit(); if (!cell__resel__hyst().is_bound()) cell__resel__hyst() = OMIT_VALUE; else cell__resel__hyst().set_implicit_omit(); if (ms__txpwr__max__cch__presence().is_bound()) ms__txpwr__max__cch__presence().set_implicit_omit(); if (!ms__txpwr__max__cch().is_bound()) ms__txpwr__max__cch() = OMIT_VALUE; else ms__txpwr__max__cch().set_implicit_omit(); if (rxlev__access__min__presence().is_bound()) rxlev__access__min__presence().set_implicit_omit(); if (!rxlev__access__min().is_bound()) rxlev__access__min() = OMIT_VALUE; else rxlev__access__min().set_implicit_omit(); if (cell__resel__offset__presence().is_bound()) cell__resel__offset__presence().set_implicit_omit(); if (!cell__resel__offset().is_bound()) cell__resel__offset() = OMIT_VALUE; else cell__resel__offset().set_implicit_omit(); if (temp__offset__presence().is_bound()) temp__offset__presence().set_implicit_omit(); if (!temp__offset().is_bound()) temp__offset() = OMIT_VALUE; else temp__offset().set_implicit_omit(); if (penalty__time__presence().is_bound()) penalty__time__presence().set_implicit_omit(); if (!penalty__time().is_bound()) penalty__time() = OMIT_VALUE; else penalty__time().set_implicit_omit(); } void SI10FurtherDiffCellInfo_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value->field_la__different.encode_text(text_buf); single_value->field_cell__resel__hyst.encode_text(text_buf); single_value->field_ms__txpwr__max__cch__presence.encode_text(text_buf); single_value->field_ms__txpwr__max__cch.encode_text(text_buf); single_value->field_rxlev__access__min__presence.encode_text(text_buf); single_value->field_rxlev__access__min.encode_text(text_buf); single_value->field_cell__resel__offset__presence.encode_text(text_buf); single_value->field_cell__resel__offset.encode_text(text_buf); single_value->field_temp__offset__presence.encode_text(text_buf); single_value->field_temp__offset.encode_text(text_buf); single_value->field_penalty__time__presence.encode_text(text_buf); single_value->field_penalty__time.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.SI10FurtherDiffCellInfo."); } } void SI10FurtherDiffCellInfo_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_la__different.decode_text(text_buf); single_value->field_cell__resel__hyst.decode_text(text_buf); single_value->field_ms__txpwr__max__cch__presence.decode_text(text_buf); single_value->field_ms__txpwr__max__cch.decode_text(text_buf); single_value->field_rxlev__access__min__presence.decode_text(text_buf); single_value->field_rxlev__access__min.decode_text(text_buf); single_value->field_cell__resel__offset__presence.decode_text(text_buf); single_value->field_cell__resel__offset.decode_text(text_buf); single_value->field_temp__offset__presence.decode_text(text_buf); single_value->field_temp__offset.decode_text(text_buf); single_value->field_penalty__time__presence.decode_text(text_buf); single_value->field_penalty__time.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 SI10FurtherDiffCellInfo_template[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.SI10FurtherDiffCellInfo."); } } void SI10FurtherDiffCellInfo_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: { SI10FurtherDiffCellInfo_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) la__different().set_param(*param.get_elem(0)); if (param.get_size()>1 && param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) cell__resel__hyst().set_param(*param.get_elem(1)); if (param.get_size()>2 && param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) ms__txpwr__max__cch__presence().set_param(*param.get_elem(2)); if (param.get_size()>3 && param.get_elem(3)->get_type()!=Module_Param::MP_NotUsed) ms__txpwr__max__cch().set_param(*param.get_elem(3)); if (param.get_size()>4 && param.get_elem(4)->get_type()!=Module_Param::MP_NotUsed) rxlev__access__min__presence().set_param(*param.get_elem(4)); if (param.get_size()>5 && param.get_elem(5)->get_type()!=Module_Param::MP_NotUsed) rxlev__access__min().set_param(*param.get_elem(5)); if (param.get_size()>6 && param.get_elem(6)->get_type()!=Module_Param::MP_NotUsed) cell__resel__offset__presence().set_param(*param.get_elem(6)); if (param.get_size()>7 && param.get_elem(7)->get_type()!=Module_Param::MP_NotUsed) cell__resel__offset().set_param(*param.get_elem(7)); if (param.get_size()>8 && param.get_elem(8)->get_type()!=Module_Param::MP_NotUsed) temp__offset__presence().set_param(*param.get_elem(8)); if (param.get_size()>9 && param.get_elem(9)->get_type()!=Module_Param::MP_NotUsed) temp__offset().set_param(*param.get_elem(9)); if (param.get_size()>10 && param.get_elem(10)->get_type()!=Module_Param::MP_NotUsed) penalty__time__presence().set_param(*param.get_elem(10)); if (param.get_size()>11 && param.get_elem(11)->get_type()!=Module_Param::MP_NotUsed) penalty__time().set_param(*param.get_elem(11)); break; case Module_Param::MP_Assignment_List: { Vector value_used(param.get_size()); value_used.resize(param.get_size(), FALSE); for (size_t val_idx=0; val_idxget_id()->get_name(), "la_different")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { la__different().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "cell_resel_hyst")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cell__resel__hyst().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ms_txpwr_max_cch_presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ms__txpwr__max__cch__presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "ms_txpwr_max_cch")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { ms__txpwr__max__cch().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "rxlev_access_min_presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rxlev__access__min__presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "rxlev_access_min")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { rxlev__access__min().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "cell_resel_offset_presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cell__resel__offset__presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "cell_resel_offset")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { cell__resel__offset().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "temp_offset_presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { temp__offset__presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "temp_offset")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { temp__offset().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "penalty_time_presence")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { penalty__time__presence().set_param(*curr_param); } value_used[val_idx]=TRUE; } } for (size_t val_idx=0; val_idxget_id()->get_name(), "penalty_time")) { if (curr_param->get_type()!=Module_Param::MP_NotUsed) { penalty__time().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.SI10FurtherDiffCellInfo: %s", curr_param->get_id()->get_name()); break; } } break; case Module_Param::MP_Implication_Template: { SI10FurtherDiffCellInfo_template* precondition = new SI10FurtherDiffCellInfo_template; precondition->set_param(*param.get_elem(0)); SI10FurtherDiffCellInfo_template* implied_template = new SI10FurtherDiffCellInfo_template; implied_template->set_param(*param.get_elem(1)); *this = SI10FurtherDiffCellInfo_template(precondition, implied_template); } break; default: param.type_error("record template", "@GSM_RestOctets.SI10FurtherDiffCellInfo"); } is_ifpresent = param.get_ifpresent(); } void SI10FurtherDiffCellInfo_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_la__different.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI10FurtherDiffCellInfo"); single_value->field_cell__resel__hyst.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI10FurtherDiffCellInfo"); single_value->field_ms__txpwr__max__cch__presence.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI10FurtherDiffCellInfo"); single_value->field_ms__txpwr__max__cch.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI10FurtherDiffCellInfo"); single_value->field_rxlev__access__min__presence.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI10FurtherDiffCellInfo"); single_value->field_rxlev__access__min.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI10FurtherDiffCellInfo"); single_value->field_cell__resel__offset__presence.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI10FurtherDiffCellInfo"); single_value->field_cell__resel__offset.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI10FurtherDiffCellInfo"); single_value->field_temp__offset__presence.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI10FurtherDiffCellInfo"); single_value->field_temp__offset.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI10FurtherDiffCellInfo"); single_value->field_penalty__time__presence.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI10FurtherDiffCellInfo"); single_value->field_penalty__time.check_restriction(t_res, t_name ? t_name : "@GSM_RestOctets.SI10FurtherDiffCellInfo"); 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.SI10FurtherDiffCellInfo"); } boolean SI10FurtherDiffCellInfo_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean SI10FurtherDiffCellInfo_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