// This C++ source file was generated by the TTCN-3 compiler // of the TTCN-3 Test Executor version 9.0.0 // for (build@3978f7fbee0c) on Mon Jun 24 02:37:33 2024 // Copyright (c) 2000-2023 Ericsson Telecom AB // Do not edit this file unless you know what you are doing. /* Including header files */ #include "DIAMETER_Types.hh" namespace DIAMETER__Types { /* Member functions of C++ classes */ RX__3GPP__SIP__Forking__Indication::RX__3GPP__SIP__Forking__Indication() { enum_value = UNBOUND_VALUE; } RX__3GPP__SIP__Forking__Indication::RX__3GPP__SIP__Forking__Indication(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.RX_3GPP_SIP_Forking_Indication with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } RX__3GPP__SIP__Forking__Indication::RX__3GPP__SIP__Forking__Indication(enum_type other_value) { enum_value = other_value; } RX__3GPP__SIP__Forking__Indication::RX__3GPP__SIP__Forking__Indication(const RX__3GPP__SIP__Forking__Indication& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_SIP_Forking_Indication."); enum_value = other_value.enum_value; } RX__3GPP__SIP__Forking__Indication& RX__3GPP__SIP__Forking__Indication::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.RX_3GPP_SIP_Forking_Indication.", other_value); enum_value = (enum_type)other_value; return *this; } RX__3GPP__SIP__Forking__Indication& RX__3GPP__SIP__Forking__Indication::operator=(enum_type other_value) { enum_value = other_value; return *this; } RX__3GPP__SIP__Forking__Indication& RX__3GPP__SIP__Forking__Indication::operator=(const RX__3GPP__SIP__Forking__Indication& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_SIP_Forking_Indication."); enum_value = other_value.enum_value; return *this; } boolean RX__3GPP__SIP__Forking__Indication::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_SIP_Forking_Indication."); return enum_value == other_value; } boolean RX__3GPP__SIP__Forking__Indication::operator==(const RX__3GPP__SIP__Forking__Indication& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_SIP_Forking_Indication."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_SIP_Forking_Indication."); return enum_value == other_value.enum_value; } boolean RX__3GPP__SIP__Forking__Indication::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_SIP_Forking_Indication."); return enum_value < other_value; } boolean RX__3GPP__SIP__Forking__Indication::operator<(const RX__3GPP__SIP__Forking__Indication& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_SIP_Forking_Indication."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_SIP_Forking_Indication."); return enum_value < other_value.enum_value; } boolean RX__3GPP__SIP__Forking__Indication::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_SIP_Forking_Indication."); return enum_value > other_value; } boolean RX__3GPP__SIP__Forking__Indication::operator>(const RX__3GPP__SIP__Forking__Indication& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_SIP_Forking_Indication."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_SIP_Forking_Indication."); return enum_value > other_value.enum_value; } const char *RX__3GPP__SIP__Forking__Indication::enum_to_str(enum_type enum_par) { switch (enum_par) { case SINGLE__DIALOGUE: return "SINGLE_DIALOGUE"; case SEVERAL__DIALOGUES: return "SEVERAL_DIALOGUES"; default: return ""; } } RX__3GPP__SIP__Forking__Indication::enum_type RX__3GPP__SIP__Forking__Indication::str_to_enum(const char *str_par) { if (!strcmp(str_par, "SINGLE_DIALOGUE")) return SINGLE__DIALOGUE; else if (!strcmp(str_par, "SEVERAL_DIALOGUES")) return SEVERAL__DIALOGUES; else return UNKNOWN_VALUE; } boolean RX__3GPP__SIP__Forking__Indication::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: return TRUE; default: return FALSE; } } int RX__3GPP__SIP__Forking__Indication::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.RX_3GPP_SIP_Forking_Indication.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int RX__3GPP__SIP__Forking__Indication::enum2int(const RX__3GPP__SIP__Forking__Indication& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.RX_3GPP_SIP_Forking_Indication.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void RX__3GPP__SIP__Forking__Indication::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.RX_3GPP_SIP_Forking_Indication.", int_val); enum_value = (enum_type)int_val; } RX__3GPP__SIP__Forking__Indication::operator RX__3GPP__SIP__Forking__Indication::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.RX_3GPP_SIP_Forking_Indication."); return enum_value; } void RX__3GPP__SIP__Forking__Indication::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void RX__3GPP__SIP__Forking__Indication::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.RX_3GPP_SIP_Forking_Indication"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.RX_3GPP_SIP_Forking_Indication."); } } void RX__3GPP__SIP__Forking__Indication::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_SIP_Forking_Indication."); text_buf.push_int(enum_value); } void RX__3GPP__SIP__Forking__Indication::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.RX_3GPP_SIP_Forking_Indication.", enum_value); } void RX__3GPP__SIP__Forking__Indication::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void RX__3GPP__SIP__Forking__Indication::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int RX__3GPP__SIP__Forking__Indication::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int RX__3GPP__SIP__Forking__Indication::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void RX__3GPP__SIP__Forking__Indication_template::copy_template(const RX__3GPP__SIP__Forking__Indication_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new RX__3GPP__SIP__Forking__Indication_template[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 RX__3GPP__SIP__Forking__Indication_template(*other_value.implication_.precondition); implication_.implied_template = new RX__3GPP__SIP__Forking__Indication_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.RX_3GPP_SIP_Forking_Indication."); } } RX__3GPP__SIP__Forking__Indication_template::RX__3GPP__SIP__Forking__Indication_template() { } RX__3GPP__SIP__Forking__Indication_template::RX__3GPP__SIP__Forking__Indication_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } RX__3GPP__SIP__Forking__Indication_template::RX__3GPP__SIP__Forking__Indication_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!RX__3GPP__SIP__Forking__Indication::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.RX_3GPP_SIP_Forking_Indication with unknown numeric value %d.", other_value); single_value = (RX__3GPP__SIP__Forking__Indication::enum_type)other_value; } RX__3GPP__SIP__Forking__Indication_template::RX__3GPP__SIP__Forking__Indication_template(RX__3GPP__SIP__Forking__Indication::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } RX__3GPP__SIP__Forking__Indication_template::RX__3GPP__SIP__Forking__Indication_template(const RX__3GPP__SIP__Forking__Indication& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == RX__3GPP__SIP__Forking__Indication::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_SIP_Forking_Indication."); single_value = other_value.enum_value; } RX__3GPP__SIP__Forking__Indication_template::RX__3GPP__SIP__Forking__Indication_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (RX__3GPP__SIP__Forking__Indication::enum_type)(const RX__3GPP__SIP__Forking__Indication&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.RX_3GPP_SIP_Forking_Indication from an unbound optional field."); } } RX__3GPP__SIP__Forking__Indication_template::RX__3GPP__SIP__Forking__Indication_template(RX__3GPP__SIP__Forking__Indication_template* p_precondition, RX__3GPP__SIP__Forking__Indication_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } RX__3GPP__SIP__Forking__Indication_template::RX__3GPP__SIP__Forking__Indication_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; } RX__3GPP__SIP__Forking__Indication_template::RX__3GPP__SIP__Forking__Indication_template(const RX__3GPP__SIP__Forking__Indication_template& other_value) : Base_Template() { copy_template(other_value); } RX__3GPP__SIP__Forking__Indication_template::~RX__3GPP__SIP__Forking__Indication_template() { clean_up(); } boolean RX__3GPP__SIP__Forking__Indication_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean RX__3GPP__SIP__Forking__Indication_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != RX__3GPP__SIP__Forking__Indication::UNBOUND_VALUE; } void RX__3GPP__SIP__Forking__Indication_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } RX__3GPP__SIP__Forking__Indication_template& RX__3GPP__SIP__Forking__Indication_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } RX__3GPP__SIP__Forking__Indication_template& RX__3GPP__SIP__Forking__Indication_template::operator=(int other_value) { if (!RX__3GPP__SIP__Forking__Indication::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.RX_3GPP_SIP_Forking_Indication.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (RX__3GPP__SIP__Forking__Indication::enum_type)other_value; return *this; } RX__3GPP__SIP__Forking__Indication_template& RX__3GPP__SIP__Forking__Indication_template::operator=(RX__3GPP__SIP__Forking__Indication::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } RX__3GPP__SIP__Forking__Indication_template& RX__3GPP__SIP__Forking__Indication_template::operator=(const RX__3GPP__SIP__Forking__Indication& other_value) { if (other_value.enum_value == RX__3GPP__SIP__Forking__Indication::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_SIP_Forking_Indication to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } RX__3GPP__SIP__Forking__Indication_template& RX__3GPP__SIP__Forking__Indication_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (RX__3GPP__SIP__Forking__Indication::enum_type)(const RX__3GPP__SIP__Forking__Indication&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.RX_3GPP_SIP_Forking_Indication."); } return *this; } RX__3GPP__SIP__Forking__Indication_template& RX__3GPP__SIP__Forking__Indication_template::operator=(const RX__3GPP__SIP__Forking__Indication_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean RX__3GPP__SIP__Forking__Indication_template::match(RX__3GPP__SIP__Forking__Indication::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.RX_3GPP_SIP_Forking_Indication."); } return FALSE; } boolean RX__3GPP__SIP__Forking__Indication_template::match(const RX__3GPP__SIP__Forking__Indication& other_value, boolean) const { if (other_value.enum_value == RX__3GPP__SIP__Forking__Indication::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.RX_3GPP_SIP_Forking_Indication with an unbound value."); return match(other_value.enum_value); } RX__3GPP__SIP__Forking__Indication::enum_type RX__3GPP__SIP__Forking__Indication_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.RX_3GPP_SIP_Forking_Indication."); return single_value; } void RX__3GPP__SIP__Forking__Indication_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.RX_3GPP_SIP_Forking_Indication."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new RX__3GPP__SIP__Forking__Indication_template[list_length]; } RX__3GPP__SIP__Forking__Indication_template& RX__3GPP__SIP__Forking__Indication_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.RX_3GPP_SIP_Forking_Indication."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.RX_3GPP_SIP_Forking_Indication."); return value_list.list_value[list_index]; } void RX__3GPP__SIP__Forking__Indication_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(RX__3GPP__SIP__Forking__Indication::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void RX__3GPP__SIP__Forking__Indication_template::log_match(const RX__3GPP__SIP__Forking__Indication& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void RX__3GPP__SIP__Forking__Indication_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.RX_3GPP_SIP_Forking_Indication."); } } void RX__3GPP__SIP__Forking__Indication_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (RX__3GPP__SIP__Forking__Indication::enum_type)text_buf.pull_int().get_val(); if (!RX__3GPP__SIP__Forking__Indication::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.RX_3GPP_SIP_Forking_Indication.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new RX__3GPP__SIP__Forking__Indication_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.RX_3GPP_SIP_Forking_Indication."); } } boolean RX__3GPP__SIP__Forking__Indication_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean RX__3GPP__SIP__Forking__Indication_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { RX__3GPP__SIP__Forking__Indication_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { RX__3GPP__SIP__Forking__Indication::enum_type enum_val = RX__3GPP__SIP__Forking__Indication::str_to_enum(m_p->get_enumerated()); if (!RX__3GPP__SIP__Forking__Indication::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.RX_3GPP_SIP_Forking_Indication."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { RX__3GPP__SIP__Forking__Indication_template* precondition = new RX__3GPP__SIP__Forking__Indication_template; precondition->set_param(*m_p->get_elem(0)); RX__3GPP__SIP__Forking__Indication_template* implied_template = new RX__3GPP__SIP__Forking__Indication_template; implied_template->set_param(*m_p->get_elem(1)); *this = RX__3GPP__SIP__Forking__Indication_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.RX_3GPP_SIP_Forking_Indication"); } is_ifpresent = param.get_ifpresent(); } void RX__3GPP__SIP__Forking__Indication_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.RX_3GPP_SIP_Forking_Indication"); } PCC__3GPP__IP__CAN__Type::PCC__3GPP__IP__CAN__Type() { enum_value = UNBOUND_VALUE; } PCC__3GPP__IP__CAN__Type::PCC__3GPP__IP__CAN__Type(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Type with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } PCC__3GPP__IP__CAN__Type::PCC__3GPP__IP__CAN__Type(enum_type other_value) { enum_value = other_value; } PCC__3GPP__IP__CAN__Type::PCC__3GPP__IP__CAN__Type(const PCC__3GPP__IP__CAN__Type& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Type."); enum_value = other_value.enum_value; } PCC__3GPP__IP__CAN__Type& PCC__3GPP__IP__CAN__Type::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Type.", other_value); enum_value = (enum_type)other_value; return *this; } PCC__3GPP__IP__CAN__Type& PCC__3GPP__IP__CAN__Type::operator=(enum_type other_value) { enum_value = other_value; return *this; } PCC__3GPP__IP__CAN__Type& PCC__3GPP__IP__CAN__Type::operator=(const PCC__3GPP__IP__CAN__Type& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Type."); enum_value = other_value.enum_value; return *this; } boolean PCC__3GPP__IP__CAN__Type::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Type."); return enum_value == other_value; } boolean PCC__3GPP__IP__CAN__Type::operator==(const PCC__3GPP__IP__CAN__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Type."); return enum_value == other_value.enum_value; } boolean PCC__3GPP__IP__CAN__Type::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Type."); return enum_value < other_value; } boolean PCC__3GPP__IP__CAN__Type::operator<(const PCC__3GPP__IP__CAN__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Type."); return enum_value < other_value.enum_value; } boolean PCC__3GPP__IP__CAN__Type::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Type."); return enum_value > other_value; } boolean PCC__3GPP__IP__CAN__Type::operator>(const PCC__3GPP__IP__CAN__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Type."); return enum_value > other_value.enum_value; } const char *PCC__3GPP__IP__CAN__Type::enum_to_str(enum_type enum_par) { switch (enum_par) { case threeGPP__GPRS: return "threeGPP_GPRS"; case DOCSIS: return "DOCSIS"; case xDSL: return "xDSL"; case WiMAX: return "WiMAX"; case threeGPP2: return "threeGPP2"; case threeGPP__EPS: return "threeGPP_EPS"; case Non__threeGPP__EPS: return "Non_threeGPP_EPS"; case FBA: return "FBA"; default: return ""; } } PCC__3GPP__IP__CAN__Type::enum_type PCC__3GPP__IP__CAN__Type::str_to_enum(const char *str_par) { if (!strcmp(str_par, "threeGPP_GPRS")) return threeGPP__GPRS; else if (!strcmp(str_par, "DOCSIS")) return DOCSIS; else if (!strcmp(str_par, "xDSL")) return xDSL; else if (!strcmp(str_par, "WiMAX")) return WiMAX; else if (!strcmp(str_par, "threeGPP2")) return threeGPP2; else if (!strcmp(str_par, "threeGPP_EPS")) return threeGPP__EPS; else if (!strcmp(str_par, "Non_threeGPP_EPS")) return Non__threeGPP__EPS; else if (!strcmp(str_par, "FBA")) return FBA; else return UNKNOWN_VALUE; } boolean PCC__3GPP__IP__CAN__Type::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: return TRUE; default: return FALSE; } } int PCC__3GPP__IP__CAN__Type::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Type.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int PCC__3GPP__IP__CAN__Type::enum2int(const PCC__3GPP__IP__CAN__Type& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Type.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void PCC__3GPP__IP__CAN__Type::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Type.", int_val); enum_value = (enum_type)int_val; } PCC__3GPP__IP__CAN__Type::operator PCC__3GPP__IP__CAN__Type::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Type."); return enum_value; } void PCC__3GPP__IP__CAN__Type::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void PCC__3GPP__IP__CAN__Type::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.PCC_3GPP_IP_CAN_Type"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.PCC_3GPP_IP_CAN_Type."); } } void PCC__3GPP__IP__CAN__Type::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Type."); text_buf.push_int(enum_value); } void PCC__3GPP__IP__CAN__Type::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Type.", enum_value); } void PCC__3GPP__IP__CAN__Type::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void PCC__3GPP__IP__CAN__Type::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int PCC__3GPP__IP__CAN__Type::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 4, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int PCC__3GPP__IP__CAN__Type::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 4); } void PCC__3GPP__IP__CAN__Type_template::copy_template(const PCC__3GPP__IP__CAN__Type_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new PCC__3GPP__IP__CAN__Type_template[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 PCC__3GPP__IP__CAN__Type_template(*other_value.implication_.precondition); implication_.implied_template = new PCC__3GPP__IP__CAN__Type_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Type."); } } PCC__3GPP__IP__CAN__Type_template::PCC__3GPP__IP__CAN__Type_template() { } PCC__3GPP__IP__CAN__Type_template::PCC__3GPP__IP__CAN__Type_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } PCC__3GPP__IP__CAN__Type_template::PCC__3GPP__IP__CAN__Type_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!PCC__3GPP__IP__CAN__Type::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Type with unknown numeric value %d.", other_value); single_value = (PCC__3GPP__IP__CAN__Type::enum_type)other_value; } PCC__3GPP__IP__CAN__Type_template::PCC__3GPP__IP__CAN__Type_template(PCC__3GPP__IP__CAN__Type::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } PCC__3GPP__IP__CAN__Type_template::PCC__3GPP__IP__CAN__Type_template(const PCC__3GPP__IP__CAN__Type& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == PCC__3GPP__IP__CAN__Type::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Type."); single_value = other_value.enum_value; } PCC__3GPP__IP__CAN__Type_template::PCC__3GPP__IP__CAN__Type_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (PCC__3GPP__IP__CAN__Type::enum_type)(const PCC__3GPP__IP__CAN__Type&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Type from an unbound optional field."); } } PCC__3GPP__IP__CAN__Type_template::PCC__3GPP__IP__CAN__Type_template(PCC__3GPP__IP__CAN__Type_template* p_precondition, PCC__3GPP__IP__CAN__Type_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } PCC__3GPP__IP__CAN__Type_template::PCC__3GPP__IP__CAN__Type_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; } PCC__3GPP__IP__CAN__Type_template::PCC__3GPP__IP__CAN__Type_template(const PCC__3GPP__IP__CAN__Type_template& other_value) : Base_Template() { copy_template(other_value); } PCC__3GPP__IP__CAN__Type_template::~PCC__3GPP__IP__CAN__Type_template() { clean_up(); } boolean PCC__3GPP__IP__CAN__Type_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean PCC__3GPP__IP__CAN__Type_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != PCC__3GPP__IP__CAN__Type::UNBOUND_VALUE; } void PCC__3GPP__IP__CAN__Type_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } PCC__3GPP__IP__CAN__Type_template& PCC__3GPP__IP__CAN__Type_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } PCC__3GPP__IP__CAN__Type_template& PCC__3GPP__IP__CAN__Type_template::operator=(int other_value) { if (!PCC__3GPP__IP__CAN__Type::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Type.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (PCC__3GPP__IP__CAN__Type::enum_type)other_value; return *this; } PCC__3GPP__IP__CAN__Type_template& PCC__3GPP__IP__CAN__Type_template::operator=(PCC__3GPP__IP__CAN__Type::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } PCC__3GPP__IP__CAN__Type_template& PCC__3GPP__IP__CAN__Type_template::operator=(const PCC__3GPP__IP__CAN__Type& other_value) { if (other_value.enum_value == PCC__3GPP__IP__CAN__Type::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Type to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } PCC__3GPP__IP__CAN__Type_template& PCC__3GPP__IP__CAN__Type_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (PCC__3GPP__IP__CAN__Type::enum_type)(const PCC__3GPP__IP__CAN__Type&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Type."); } return *this; } PCC__3GPP__IP__CAN__Type_template& PCC__3GPP__IP__CAN__Type_template::operator=(const PCC__3GPP__IP__CAN__Type_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean PCC__3GPP__IP__CAN__Type_template::match(PCC__3GPP__IP__CAN__Type::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Type."); } return FALSE; } boolean PCC__3GPP__IP__CAN__Type_template::match(const PCC__3GPP__IP__CAN__Type& other_value, boolean) const { if (other_value.enum_value == PCC__3GPP__IP__CAN__Type::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Type with an unbound value."); return match(other_value.enum_value); } PCC__3GPP__IP__CAN__Type::enum_type PCC__3GPP__IP__CAN__Type_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Type."); return single_value; } void PCC__3GPP__IP__CAN__Type_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Type."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new PCC__3GPP__IP__CAN__Type_template[list_length]; } PCC__3GPP__IP__CAN__Type_template& PCC__3GPP__IP__CAN__Type_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Type."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Type."); return value_list.list_value[list_index]; } void PCC__3GPP__IP__CAN__Type_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(PCC__3GPP__IP__CAN__Type::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void PCC__3GPP__IP__CAN__Type_template::log_match(const PCC__3GPP__IP__CAN__Type& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void PCC__3GPP__IP__CAN__Type_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Type."); } } void PCC__3GPP__IP__CAN__Type_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (PCC__3GPP__IP__CAN__Type::enum_type)text_buf.pull_int().get_val(); if (!PCC__3GPP__IP__CAN__Type::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Type.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new PCC__3GPP__IP__CAN__Type_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Type."); } } boolean PCC__3GPP__IP__CAN__Type_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean PCC__3GPP__IP__CAN__Type_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { PCC__3GPP__IP__CAN__Type_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { PCC__3GPP__IP__CAN__Type::enum_type enum_val = PCC__3GPP__IP__CAN__Type::str_to_enum(m_p->get_enumerated()); if (!PCC__3GPP__IP__CAN__Type::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.PCC_3GPP_IP_CAN_Type."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { PCC__3GPP__IP__CAN__Type_template* precondition = new PCC__3GPP__IP__CAN__Type_template; precondition->set_param(*m_p->get_elem(0)); PCC__3GPP__IP__CAN__Type_template* implied_template = new PCC__3GPP__IP__CAN__Type_template; implied_template->set_param(*m_p->get_elem(1)); *this = PCC__3GPP__IP__CAN__Type_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.PCC_3GPP_IP_CAN_Type"); } is_ifpresent = param.get_ifpresent(); } void PCC__3GPP__IP__CAN__Type_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.PCC_3GPP_IP_CAN_Type"); } AAA__3GPP__Logging__Interval::AAA__3GPP__Logging__Interval() { enum_value = UNBOUND_VALUE; } AAA__3GPP__Logging__Interval::AAA__3GPP__Logging__Interval(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.AAA_3GPP_Logging_Interval with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } AAA__3GPP__Logging__Interval::AAA__3GPP__Logging__Interval(enum_type other_value) { enum_value = other_value; } AAA__3GPP__Logging__Interval::AAA__3GPP__Logging__Interval(const AAA__3GPP__Logging__Interval& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Logging_Interval."); enum_value = other_value.enum_value; } AAA__3GPP__Logging__Interval& AAA__3GPP__Logging__Interval::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.AAA_3GPP_Logging_Interval.", other_value); enum_value = (enum_type)other_value; return *this; } AAA__3GPP__Logging__Interval& AAA__3GPP__Logging__Interval::operator=(enum_type other_value) { enum_value = other_value; return *this; } AAA__3GPP__Logging__Interval& AAA__3GPP__Logging__Interval::operator=(const AAA__3GPP__Logging__Interval& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Logging_Interval."); enum_value = other_value.enum_value; return *this; } boolean AAA__3GPP__Logging__Interval::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Logging_Interval."); return enum_value == other_value; } boolean AAA__3GPP__Logging__Interval::operator==(const AAA__3GPP__Logging__Interval& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Logging_Interval."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Logging_Interval."); return enum_value == other_value.enum_value; } boolean AAA__3GPP__Logging__Interval::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Logging_Interval."); return enum_value < other_value; } boolean AAA__3GPP__Logging__Interval::operator<(const AAA__3GPP__Logging__Interval& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Logging_Interval."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Logging_Interval."); return enum_value < other_value.enum_value; } boolean AAA__3GPP__Logging__Interval::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Logging_Interval."); return enum_value > other_value; } boolean AAA__3GPP__Logging__Interval::operator>(const AAA__3GPP__Logging__Interval& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Logging_Interval."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Logging_Interval."); return enum_value > other_value.enum_value; } const char *AAA__3GPP__Logging__Interval::enum_to_str(enum_type enum_par) { switch (enum_par) { case LI__128: return "LI_128"; case LI__256: return "LI_256"; case LI__512: return "LI_512"; case LI__1024: return "LI_1024"; case LI__2048: return "LI_2048"; case LI__3072: return "LI_3072"; case LI__4096: return "LI_4096"; case LI__6144: return "LI_6144"; default: return ""; } } AAA__3GPP__Logging__Interval::enum_type AAA__3GPP__Logging__Interval::str_to_enum(const char *str_par) { if (!strcmp(str_par, "LI_128")) return LI__128; else if (!strcmp(str_par, "LI_256")) return LI__256; else if (!strcmp(str_par, "LI_512")) return LI__512; else if (!strcmp(str_par, "LI_1024")) return LI__1024; else if (!strcmp(str_par, "LI_2048")) return LI__2048; else if (!strcmp(str_par, "LI_3072")) return LI__3072; else if (!strcmp(str_par, "LI_4096")) return LI__4096; else if (!strcmp(str_par, "LI_6144")) return LI__6144; else return UNKNOWN_VALUE; } boolean AAA__3GPP__Logging__Interval::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: return TRUE; default: return FALSE; } } int AAA__3GPP__Logging__Interval::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.AAA_3GPP_Logging_Interval.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int AAA__3GPP__Logging__Interval::enum2int(const AAA__3GPP__Logging__Interval& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.AAA_3GPP_Logging_Interval.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void AAA__3GPP__Logging__Interval::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.AAA_3GPP_Logging_Interval.", int_val); enum_value = (enum_type)int_val; } AAA__3GPP__Logging__Interval::operator AAA__3GPP__Logging__Interval::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.AAA_3GPP_Logging_Interval."); return enum_value; } void AAA__3GPP__Logging__Interval::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void AAA__3GPP__Logging__Interval::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.AAA_3GPP_Logging_Interval"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.AAA_3GPP_Logging_Interval."); } } void AAA__3GPP__Logging__Interval::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Logging_Interval."); text_buf.push_int(enum_value); } void AAA__3GPP__Logging__Interval::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.AAA_3GPP_Logging_Interval.", enum_value); } void AAA__3GPP__Logging__Interval::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void AAA__3GPP__Logging__Interval::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int AAA__3GPP__Logging__Interval::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 4, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int AAA__3GPP__Logging__Interval::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 4); } void AAA__3GPP__Logging__Interval_template::copy_template(const AAA__3GPP__Logging__Interval_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new AAA__3GPP__Logging__Interval_template[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 AAA__3GPP__Logging__Interval_template(*other_value.implication_.precondition); implication_.implied_template = new AAA__3GPP__Logging__Interval_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_Logging_Interval."); } } AAA__3GPP__Logging__Interval_template::AAA__3GPP__Logging__Interval_template() { } AAA__3GPP__Logging__Interval_template::AAA__3GPP__Logging__Interval_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } AAA__3GPP__Logging__Interval_template::AAA__3GPP__Logging__Interval_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!AAA__3GPP__Logging__Interval::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.AAA_3GPP_Logging_Interval with unknown numeric value %d.", other_value); single_value = (AAA__3GPP__Logging__Interval::enum_type)other_value; } AAA__3GPP__Logging__Interval_template::AAA__3GPP__Logging__Interval_template(AAA__3GPP__Logging__Interval::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } AAA__3GPP__Logging__Interval_template::AAA__3GPP__Logging__Interval_template(const AAA__3GPP__Logging__Interval& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == AAA__3GPP__Logging__Interval::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Logging_Interval."); single_value = other_value.enum_value; } AAA__3GPP__Logging__Interval_template::AAA__3GPP__Logging__Interval_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__Logging__Interval::enum_type)(const AAA__3GPP__Logging__Interval&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.AAA_3GPP_Logging_Interval from an unbound optional field."); } } AAA__3GPP__Logging__Interval_template::AAA__3GPP__Logging__Interval_template(AAA__3GPP__Logging__Interval_template* p_precondition, AAA__3GPP__Logging__Interval_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } AAA__3GPP__Logging__Interval_template::AAA__3GPP__Logging__Interval_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; } AAA__3GPP__Logging__Interval_template::AAA__3GPP__Logging__Interval_template(const AAA__3GPP__Logging__Interval_template& other_value) : Base_Template() { copy_template(other_value); } AAA__3GPP__Logging__Interval_template::~AAA__3GPP__Logging__Interval_template() { clean_up(); } boolean AAA__3GPP__Logging__Interval_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean AAA__3GPP__Logging__Interval_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != AAA__3GPP__Logging__Interval::UNBOUND_VALUE; } void AAA__3GPP__Logging__Interval_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } AAA__3GPP__Logging__Interval_template& AAA__3GPP__Logging__Interval_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } AAA__3GPP__Logging__Interval_template& AAA__3GPP__Logging__Interval_template::operator=(int other_value) { if (!AAA__3GPP__Logging__Interval::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.AAA_3GPP_Logging_Interval.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__Logging__Interval::enum_type)other_value; return *this; } AAA__3GPP__Logging__Interval_template& AAA__3GPP__Logging__Interval_template::operator=(AAA__3GPP__Logging__Interval::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } AAA__3GPP__Logging__Interval_template& AAA__3GPP__Logging__Interval_template::operator=(const AAA__3GPP__Logging__Interval& other_value) { if (other_value.enum_value == AAA__3GPP__Logging__Interval::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Logging_Interval to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } AAA__3GPP__Logging__Interval_template& AAA__3GPP__Logging__Interval_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__Logging__Interval::enum_type)(const AAA__3GPP__Logging__Interval&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.AAA_3GPP_Logging_Interval."); } return *this; } AAA__3GPP__Logging__Interval_template& AAA__3GPP__Logging__Interval_template::operator=(const AAA__3GPP__Logging__Interval_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean AAA__3GPP__Logging__Interval_template::match(AAA__3GPP__Logging__Interval::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_Logging_Interval."); } return FALSE; } boolean AAA__3GPP__Logging__Interval_template::match(const AAA__3GPP__Logging__Interval& other_value, boolean) const { if (other_value.enum_value == AAA__3GPP__Logging__Interval::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.AAA_3GPP_Logging_Interval with an unbound value."); return match(other_value.enum_value); } AAA__3GPP__Logging__Interval::enum_type AAA__3GPP__Logging__Interval_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.AAA_3GPP_Logging_Interval."); return single_value; } void AAA__3GPP__Logging__Interval_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.AAA_3GPP_Logging_Interval."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new AAA__3GPP__Logging__Interval_template[list_length]; } AAA__3GPP__Logging__Interval_template& AAA__3GPP__Logging__Interval_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.AAA_3GPP_Logging_Interval."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.AAA_3GPP_Logging_Interval."); return value_list.list_value[list_index]; } void AAA__3GPP__Logging__Interval_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(AAA__3GPP__Logging__Interval::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void AAA__3GPP__Logging__Interval_template::log_match(const AAA__3GPP__Logging__Interval& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void AAA__3GPP__Logging__Interval_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_Logging_Interval."); } } void AAA__3GPP__Logging__Interval_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (AAA__3GPP__Logging__Interval::enum_type)text_buf.pull_int().get_val(); if (!AAA__3GPP__Logging__Interval::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.AAA_3GPP_Logging_Interval.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new AAA__3GPP__Logging__Interval_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.AAA_3GPP_Logging_Interval."); } } boolean AAA__3GPP__Logging__Interval_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean AAA__3GPP__Logging__Interval_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { AAA__3GPP__Logging__Interval_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { AAA__3GPP__Logging__Interval::enum_type enum_val = AAA__3GPP__Logging__Interval::str_to_enum(m_p->get_enumerated()); if (!AAA__3GPP__Logging__Interval::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.AAA_3GPP_Logging_Interval."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { AAA__3GPP__Logging__Interval_template* precondition = new AAA__3GPP__Logging__Interval_template; precondition->set_param(*m_p->get_elem(0)); AAA__3GPP__Logging__Interval_template* implied_template = new AAA__3GPP__Logging__Interval_template; implied_template->set_param(*m_p->get_elem(1)); *this = AAA__3GPP__Logging__Interval_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.AAA_3GPP_Logging_Interval"); } is_ifpresent = param.get_ifpresent(); } void AAA__3GPP__Logging__Interval_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.AAA_3GPP_Logging_Interval"); } PCC__3GPP__Metering__Method::PCC__3GPP__Metering__Method() { enum_value = UNBOUND_VALUE; } PCC__3GPP__Metering__Method::PCC__3GPP__Metering__Method(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.PCC_3GPP_Metering_Method with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } PCC__3GPP__Metering__Method::PCC__3GPP__Metering__Method(enum_type other_value) { enum_value = other_value; } PCC__3GPP__Metering__Method::PCC__3GPP__Metering__Method(const PCC__3GPP__Metering__Method& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Metering_Method."); enum_value = other_value.enum_value; } PCC__3GPP__Metering__Method& PCC__3GPP__Metering__Method::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.PCC_3GPP_Metering_Method.", other_value); enum_value = (enum_type)other_value; return *this; } PCC__3GPP__Metering__Method& PCC__3GPP__Metering__Method::operator=(enum_type other_value) { enum_value = other_value; return *this; } PCC__3GPP__Metering__Method& PCC__3GPP__Metering__Method::operator=(const PCC__3GPP__Metering__Method& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Metering_Method."); enum_value = other_value.enum_value; return *this; } boolean PCC__3GPP__Metering__Method::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Metering_Method."); return enum_value == other_value; } boolean PCC__3GPP__Metering__Method::operator==(const PCC__3GPP__Metering__Method& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Metering_Method."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Metering_Method."); return enum_value == other_value.enum_value; } boolean PCC__3GPP__Metering__Method::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Metering_Method."); return enum_value < other_value; } boolean PCC__3GPP__Metering__Method::operator<(const PCC__3GPP__Metering__Method& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Metering_Method."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Metering_Method."); return enum_value < other_value.enum_value; } boolean PCC__3GPP__Metering__Method::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Metering_Method."); return enum_value > other_value; } boolean PCC__3GPP__Metering__Method::operator>(const PCC__3GPP__Metering__Method& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Metering_Method."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Metering_Method."); return enum_value > other_value.enum_value; } const char *PCC__3GPP__Metering__Method::enum_to_str(enum_type enum_par) { switch (enum_par) { case DURATION: return "DURATION"; case VOLUME: return "VOLUME"; case DURATION__VOLUME: return "DURATION_VOLUME"; case EVENT: return "EVENT"; default: return ""; } } PCC__3GPP__Metering__Method::enum_type PCC__3GPP__Metering__Method::str_to_enum(const char *str_par) { if (!strcmp(str_par, "DURATION")) return DURATION; else if (!strcmp(str_par, "VOLUME")) return VOLUME; else if (!strcmp(str_par, "DURATION_VOLUME")) return DURATION__VOLUME; else if (!strcmp(str_par, "EVENT")) return EVENT; else return UNKNOWN_VALUE; } boolean PCC__3GPP__Metering__Method::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: case 2: case 3: return TRUE; default: return FALSE; } } int PCC__3GPP__Metering__Method::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.PCC_3GPP_Metering_Method.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int PCC__3GPP__Metering__Method::enum2int(const PCC__3GPP__Metering__Method& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.PCC_3GPP_Metering_Method.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void PCC__3GPP__Metering__Method::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.PCC_3GPP_Metering_Method.", int_val); enum_value = (enum_type)int_val; } PCC__3GPP__Metering__Method::operator PCC__3GPP__Metering__Method::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.PCC_3GPP_Metering_Method."); return enum_value; } void PCC__3GPP__Metering__Method::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void PCC__3GPP__Metering__Method::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.PCC_3GPP_Metering_Method"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.PCC_3GPP_Metering_Method."); } } void PCC__3GPP__Metering__Method::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Metering_Method."); text_buf.push_int(enum_value); } void PCC__3GPP__Metering__Method::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.PCC_3GPP_Metering_Method.", enum_value); } void PCC__3GPP__Metering__Method::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void PCC__3GPP__Metering__Method::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int PCC__3GPP__Metering__Method::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 3, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int PCC__3GPP__Metering__Method::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 3); } void PCC__3GPP__Metering__Method_template::copy_template(const PCC__3GPP__Metering__Method_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new PCC__3GPP__Metering__Method_template[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 PCC__3GPP__Metering__Method_template(*other_value.implication_.precondition); implication_.implied_template = new PCC__3GPP__Metering__Method_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.PCC_3GPP_Metering_Method."); } } PCC__3GPP__Metering__Method_template::PCC__3GPP__Metering__Method_template() { } PCC__3GPP__Metering__Method_template::PCC__3GPP__Metering__Method_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } PCC__3GPP__Metering__Method_template::PCC__3GPP__Metering__Method_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!PCC__3GPP__Metering__Method::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.PCC_3GPP_Metering_Method with unknown numeric value %d.", other_value); single_value = (PCC__3GPP__Metering__Method::enum_type)other_value; } PCC__3GPP__Metering__Method_template::PCC__3GPP__Metering__Method_template(PCC__3GPP__Metering__Method::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } PCC__3GPP__Metering__Method_template::PCC__3GPP__Metering__Method_template(const PCC__3GPP__Metering__Method& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == PCC__3GPP__Metering__Method::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Metering_Method."); single_value = other_value.enum_value; } PCC__3GPP__Metering__Method_template::PCC__3GPP__Metering__Method_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (PCC__3GPP__Metering__Method::enum_type)(const PCC__3GPP__Metering__Method&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.PCC_3GPP_Metering_Method from an unbound optional field."); } } PCC__3GPP__Metering__Method_template::PCC__3GPP__Metering__Method_template(PCC__3GPP__Metering__Method_template* p_precondition, PCC__3GPP__Metering__Method_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } PCC__3GPP__Metering__Method_template::PCC__3GPP__Metering__Method_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; } PCC__3GPP__Metering__Method_template::PCC__3GPP__Metering__Method_template(const PCC__3GPP__Metering__Method_template& other_value) : Base_Template() { copy_template(other_value); } PCC__3GPP__Metering__Method_template::~PCC__3GPP__Metering__Method_template() { clean_up(); } boolean PCC__3GPP__Metering__Method_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean PCC__3GPP__Metering__Method_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != PCC__3GPP__Metering__Method::UNBOUND_VALUE; } void PCC__3GPP__Metering__Method_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } PCC__3GPP__Metering__Method_template& PCC__3GPP__Metering__Method_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } PCC__3GPP__Metering__Method_template& PCC__3GPP__Metering__Method_template::operator=(int other_value) { if (!PCC__3GPP__Metering__Method::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.PCC_3GPP_Metering_Method.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (PCC__3GPP__Metering__Method::enum_type)other_value; return *this; } PCC__3GPP__Metering__Method_template& PCC__3GPP__Metering__Method_template::operator=(PCC__3GPP__Metering__Method::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } PCC__3GPP__Metering__Method_template& PCC__3GPP__Metering__Method_template::operator=(const PCC__3GPP__Metering__Method& other_value) { if (other_value.enum_value == PCC__3GPP__Metering__Method::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Metering_Method to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } PCC__3GPP__Metering__Method_template& PCC__3GPP__Metering__Method_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (PCC__3GPP__Metering__Method::enum_type)(const PCC__3GPP__Metering__Method&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.PCC_3GPP_Metering_Method."); } return *this; } PCC__3GPP__Metering__Method_template& PCC__3GPP__Metering__Method_template::operator=(const PCC__3GPP__Metering__Method_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean PCC__3GPP__Metering__Method_template::match(PCC__3GPP__Metering__Method::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.PCC_3GPP_Metering_Method."); } return FALSE; } boolean PCC__3GPP__Metering__Method_template::match(const PCC__3GPP__Metering__Method& other_value, boolean) const { if (other_value.enum_value == PCC__3GPP__Metering__Method::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.PCC_3GPP_Metering_Method with an unbound value."); return match(other_value.enum_value); } PCC__3GPP__Metering__Method::enum_type PCC__3GPP__Metering__Method_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.PCC_3GPP_Metering_Method."); return single_value; } void PCC__3GPP__Metering__Method_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.PCC_3GPP_Metering_Method."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new PCC__3GPP__Metering__Method_template[list_length]; } PCC__3GPP__Metering__Method_template& PCC__3GPP__Metering__Method_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.PCC_3GPP_Metering_Method."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.PCC_3GPP_Metering_Method."); return value_list.list_value[list_index]; } void PCC__3GPP__Metering__Method_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(PCC__3GPP__Metering__Method::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void PCC__3GPP__Metering__Method_template::log_match(const PCC__3GPP__Metering__Method& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void PCC__3GPP__Metering__Method_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.PCC_3GPP_Metering_Method."); } } void PCC__3GPP__Metering__Method_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (PCC__3GPP__Metering__Method::enum_type)text_buf.pull_int().get_val(); if (!PCC__3GPP__Metering__Method::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.PCC_3GPP_Metering_Method.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new PCC__3GPP__Metering__Method_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.PCC_3GPP_Metering_Method."); } } boolean PCC__3GPP__Metering__Method_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean PCC__3GPP__Metering__Method_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { PCC__3GPP__Metering__Method_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { PCC__3GPP__Metering__Method::enum_type enum_val = PCC__3GPP__Metering__Method::str_to_enum(m_p->get_enumerated()); if (!PCC__3GPP__Metering__Method::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.PCC_3GPP_Metering_Method."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { PCC__3GPP__Metering__Method_template* precondition = new PCC__3GPP__Metering__Method_template; precondition->set_param(*m_p->get_elem(0)); PCC__3GPP__Metering__Method_template* implied_template = new PCC__3GPP__Metering__Method_template; implied_template->set_param(*m_p->get_elem(1)); *this = PCC__3GPP__Metering__Method_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.PCC_3GPP_Metering_Method"); } is_ifpresent = param.get_ifpresent(); } void PCC__3GPP__Metering__Method_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.PCC_3GPP_Metering_Method"); } BASE__NONE__Session__Server__Failover::BASE__NONE__Session__Server__Failover() { enum_value = UNBOUND_VALUE; } BASE__NONE__Session__Server__Failover::BASE__NONE__Session__Server__Failover(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.BASE_NONE_Session_Server_Failover with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } BASE__NONE__Session__Server__Failover::BASE__NONE__Session__Server__Failover(enum_type other_value) { enum_value = other_value; } BASE__NONE__Session__Server__Failover::BASE__NONE__Session__Server__Failover(const BASE__NONE__Session__Server__Failover& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.BASE_NONE_Session_Server_Failover."); enum_value = other_value.enum_value; } BASE__NONE__Session__Server__Failover& BASE__NONE__Session__Server__Failover::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.BASE_NONE_Session_Server_Failover.", other_value); enum_value = (enum_type)other_value; return *this; } BASE__NONE__Session__Server__Failover& BASE__NONE__Session__Server__Failover::operator=(enum_type other_value) { enum_value = other_value; return *this; } BASE__NONE__Session__Server__Failover& BASE__NONE__Session__Server__Failover::operator=(const BASE__NONE__Session__Server__Failover& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.BASE_NONE_Session_Server_Failover."); enum_value = other_value.enum_value; return *this; } boolean BASE__NONE__Session__Server__Failover::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.BASE_NONE_Session_Server_Failover."); return enum_value == other_value; } boolean BASE__NONE__Session__Server__Failover::operator==(const BASE__NONE__Session__Server__Failover& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.BASE_NONE_Session_Server_Failover."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.BASE_NONE_Session_Server_Failover."); return enum_value == other_value.enum_value; } boolean BASE__NONE__Session__Server__Failover::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.BASE_NONE_Session_Server_Failover."); return enum_value < other_value; } boolean BASE__NONE__Session__Server__Failover::operator<(const BASE__NONE__Session__Server__Failover& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.BASE_NONE_Session_Server_Failover."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.BASE_NONE_Session_Server_Failover."); return enum_value < other_value.enum_value; } boolean BASE__NONE__Session__Server__Failover::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.BASE_NONE_Session_Server_Failover."); return enum_value > other_value; } boolean BASE__NONE__Session__Server__Failover::operator>(const BASE__NONE__Session__Server__Failover& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.BASE_NONE_Session_Server_Failover."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.BASE_NONE_Session_Server_Failover."); return enum_value > other_value.enum_value; } const char *BASE__NONE__Session__Server__Failover::enum_to_str(enum_type enum_par) { switch (enum_par) { case REFUSE__SERVICE: return "REFUSE_SERVICE"; case TRY__AGAIN: return "TRY_AGAIN"; case ALLOW__SERVICE: return "ALLOW_SERVICE"; case TRY__AGAIN__ALLOW__SERVICE: return "TRY_AGAIN_ALLOW_SERVICE"; default: return ""; } } BASE__NONE__Session__Server__Failover::enum_type BASE__NONE__Session__Server__Failover::str_to_enum(const char *str_par) { if (!strcmp(str_par, "REFUSE_SERVICE")) return REFUSE__SERVICE; else if (!strcmp(str_par, "TRY_AGAIN")) return TRY__AGAIN; else if (!strcmp(str_par, "ALLOW_SERVICE")) return ALLOW__SERVICE; else if (!strcmp(str_par, "TRY_AGAIN_ALLOW_SERVICE")) return TRY__AGAIN__ALLOW__SERVICE; else return UNKNOWN_VALUE; } boolean BASE__NONE__Session__Server__Failover::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: case 2: case 3: return TRUE; default: return FALSE; } } int BASE__NONE__Session__Server__Failover::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.BASE_NONE_Session_Server_Failover.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int BASE__NONE__Session__Server__Failover::enum2int(const BASE__NONE__Session__Server__Failover& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.BASE_NONE_Session_Server_Failover.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void BASE__NONE__Session__Server__Failover::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.BASE_NONE_Session_Server_Failover.", int_val); enum_value = (enum_type)int_val; } BASE__NONE__Session__Server__Failover::operator BASE__NONE__Session__Server__Failover::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.BASE_NONE_Session_Server_Failover."); return enum_value; } void BASE__NONE__Session__Server__Failover::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void BASE__NONE__Session__Server__Failover::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.BASE_NONE_Session_Server_Failover"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.BASE_NONE_Session_Server_Failover."); } } void BASE__NONE__Session__Server__Failover::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.BASE_NONE_Session_Server_Failover."); text_buf.push_int(enum_value); } void BASE__NONE__Session__Server__Failover::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.BASE_NONE_Session_Server_Failover.", enum_value); } void BASE__NONE__Session__Server__Failover::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void BASE__NONE__Session__Server__Failover::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int BASE__NONE__Session__Server__Failover::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 3, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int BASE__NONE__Session__Server__Failover::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 3); } void BASE__NONE__Session__Server__Failover_template::copy_template(const BASE__NONE__Session__Server__Failover_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new BASE__NONE__Session__Server__Failover_template[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 BASE__NONE__Session__Server__Failover_template(*other_value.implication_.precondition); implication_.implied_template = new BASE__NONE__Session__Server__Failover_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.BASE_NONE_Session_Server_Failover."); } } BASE__NONE__Session__Server__Failover_template::BASE__NONE__Session__Server__Failover_template() { } BASE__NONE__Session__Server__Failover_template::BASE__NONE__Session__Server__Failover_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } BASE__NONE__Session__Server__Failover_template::BASE__NONE__Session__Server__Failover_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!BASE__NONE__Session__Server__Failover::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.BASE_NONE_Session_Server_Failover with unknown numeric value %d.", other_value); single_value = (BASE__NONE__Session__Server__Failover::enum_type)other_value; } BASE__NONE__Session__Server__Failover_template::BASE__NONE__Session__Server__Failover_template(BASE__NONE__Session__Server__Failover::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } BASE__NONE__Session__Server__Failover_template::BASE__NONE__Session__Server__Failover_template(const BASE__NONE__Session__Server__Failover& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == BASE__NONE__Session__Server__Failover::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.BASE_NONE_Session_Server_Failover."); single_value = other_value.enum_value; } BASE__NONE__Session__Server__Failover_template::BASE__NONE__Session__Server__Failover_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (BASE__NONE__Session__Server__Failover::enum_type)(const BASE__NONE__Session__Server__Failover&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.BASE_NONE_Session_Server_Failover from an unbound optional field."); } } BASE__NONE__Session__Server__Failover_template::BASE__NONE__Session__Server__Failover_template(BASE__NONE__Session__Server__Failover_template* p_precondition, BASE__NONE__Session__Server__Failover_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } BASE__NONE__Session__Server__Failover_template::BASE__NONE__Session__Server__Failover_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; } BASE__NONE__Session__Server__Failover_template::BASE__NONE__Session__Server__Failover_template(const BASE__NONE__Session__Server__Failover_template& other_value) : Base_Template() { copy_template(other_value); } BASE__NONE__Session__Server__Failover_template::~BASE__NONE__Session__Server__Failover_template() { clean_up(); } boolean BASE__NONE__Session__Server__Failover_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean BASE__NONE__Session__Server__Failover_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != BASE__NONE__Session__Server__Failover::UNBOUND_VALUE; } void BASE__NONE__Session__Server__Failover_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } BASE__NONE__Session__Server__Failover_template& BASE__NONE__Session__Server__Failover_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } BASE__NONE__Session__Server__Failover_template& BASE__NONE__Session__Server__Failover_template::operator=(int other_value) { if (!BASE__NONE__Session__Server__Failover::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.BASE_NONE_Session_Server_Failover.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (BASE__NONE__Session__Server__Failover::enum_type)other_value; return *this; } BASE__NONE__Session__Server__Failover_template& BASE__NONE__Session__Server__Failover_template::operator=(BASE__NONE__Session__Server__Failover::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } BASE__NONE__Session__Server__Failover_template& BASE__NONE__Session__Server__Failover_template::operator=(const BASE__NONE__Session__Server__Failover& other_value) { if (other_value.enum_value == BASE__NONE__Session__Server__Failover::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.BASE_NONE_Session_Server_Failover to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } BASE__NONE__Session__Server__Failover_template& BASE__NONE__Session__Server__Failover_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (BASE__NONE__Session__Server__Failover::enum_type)(const BASE__NONE__Session__Server__Failover&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.BASE_NONE_Session_Server_Failover."); } return *this; } BASE__NONE__Session__Server__Failover_template& BASE__NONE__Session__Server__Failover_template::operator=(const BASE__NONE__Session__Server__Failover_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean BASE__NONE__Session__Server__Failover_template::match(BASE__NONE__Session__Server__Failover::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.BASE_NONE_Session_Server_Failover."); } return FALSE; } boolean BASE__NONE__Session__Server__Failover_template::match(const BASE__NONE__Session__Server__Failover& other_value, boolean) const { if (other_value.enum_value == BASE__NONE__Session__Server__Failover::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.BASE_NONE_Session_Server_Failover with an unbound value."); return match(other_value.enum_value); } BASE__NONE__Session__Server__Failover::enum_type BASE__NONE__Session__Server__Failover_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.BASE_NONE_Session_Server_Failover."); return single_value; } void BASE__NONE__Session__Server__Failover_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.BASE_NONE_Session_Server_Failover."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new BASE__NONE__Session__Server__Failover_template[list_length]; } BASE__NONE__Session__Server__Failover_template& BASE__NONE__Session__Server__Failover_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.BASE_NONE_Session_Server_Failover."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.BASE_NONE_Session_Server_Failover."); return value_list.list_value[list_index]; } void BASE__NONE__Session__Server__Failover_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(BASE__NONE__Session__Server__Failover::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void BASE__NONE__Session__Server__Failover_template::log_match(const BASE__NONE__Session__Server__Failover& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void BASE__NONE__Session__Server__Failover_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.BASE_NONE_Session_Server_Failover."); } } void BASE__NONE__Session__Server__Failover_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (BASE__NONE__Session__Server__Failover::enum_type)text_buf.pull_int().get_val(); if (!BASE__NONE__Session__Server__Failover::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.BASE_NONE_Session_Server_Failover.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new BASE__NONE__Session__Server__Failover_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.BASE_NONE_Session_Server_Failover."); } } boolean BASE__NONE__Session__Server__Failover_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean BASE__NONE__Session__Server__Failover_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { BASE__NONE__Session__Server__Failover_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { BASE__NONE__Session__Server__Failover::enum_type enum_val = BASE__NONE__Session__Server__Failover::str_to_enum(m_p->get_enumerated()); if (!BASE__NONE__Session__Server__Failover::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.BASE_NONE_Session_Server_Failover."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { BASE__NONE__Session__Server__Failover_template* precondition = new BASE__NONE__Session__Server__Failover_template; precondition->set_param(*m_p->get_elem(0)); BASE__NONE__Session__Server__Failover_template* implied_template = new BASE__NONE__Session__Server__Failover_template; implied_template->set_param(*m_p->get_elem(1)); *this = BASE__NONE__Session__Server__Failover_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.BASE_NONE_Session_Server_Failover"); } is_ifpresent = param.get_ifpresent(); } void BASE__NONE__Session__Server__Failover_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.BASE_NONE_Session_Server_Failover"); } GI__3GPP__3GPP__PDP__Type::GI__3GPP__3GPP__PDP__Type() { enum_value = UNBOUND_VALUE; } GI__3GPP__3GPP__PDP__Type::GI__3GPP__3GPP__PDP__Type(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.GI_3GPP_3GPP_PDP_Type with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } GI__3GPP__3GPP__PDP__Type::GI__3GPP__3GPP__PDP__Type(enum_type other_value) { enum_value = other_value; } GI__3GPP__3GPP__PDP__Type::GI__3GPP__3GPP__PDP__Type(const GI__3GPP__3GPP__PDP__Type& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.GI_3GPP_3GPP_PDP_Type."); enum_value = other_value.enum_value; } GI__3GPP__3GPP__PDP__Type& GI__3GPP__3GPP__PDP__Type::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.GI_3GPP_3GPP_PDP_Type.", other_value); enum_value = (enum_type)other_value; return *this; } GI__3GPP__3GPP__PDP__Type& GI__3GPP__3GPP__PDP__Type::operator=(enum_type other_value) { enum_value = other_value; return *this; } GI__3GPP__3GPP__PDP__Type& GI__3GPP__3GPP__PDP__Type::operator=(const GI__3GPP__3GPP__PDP__Type& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.GI_3GPP_3GPP_PDP_Type."); enum_value = other_value.enum_value; return *this; } boolean GI__3GPP__3GPP__PDP__Type::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.GI_3GPP_3GPP_PDP_Type."); return enum_value == other_value; } boolean GI__3GPP__3GPP__PDP__Type::operator==(const GI__3GPP__3GPP__PDP__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.GI_3GPP_3GPP_PDP_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.GI_3GPP_3GPP_PDP_Type."); return enum_value == other_value.enum_value; } boolean GI__3GPP__3GPP__PDP__Type::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.GI_3GPP_3GPP_PDP_Type."); return enum_value < other_value; } boolean GI__3GPP__3GPP__PDP__Type::operator<(const GI__3GPP__3GPP__PDP__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.GI_3GPP_3GPP_PDP_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.GI_3GPP_3GPP_PDP_Type."); return enum_value < other_value.enum_value; } boolean GI__3GPP__3GPP__PDP__Type::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.GI_3GPP_3GPP_PDP_Type."); return enum_value > other_value; } boolean GI__3GPP__3GPP__PDP__Type::operator>(const GI__3GPP__3GPP__PDP__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.GI_3GPP_3GPP_PDP_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.GI_3GPP_3GPP_PDP_Type."); return enum_value > other_value.enum_value; } const char *GI__3GPP__3GPP__PDP__Type::enum_to_str(enum_type enum_par) { switch (enum_par) { case IPv4: return "IPv4"; case PPP: return "PPP"; case IPv6: return "IPv6"; case IPv4v6: return "IPv4v6"; case NonIp: return "NonIp"; default: return ""; } } GI__3GPP__3GPP__PDP__Type::enum_type GI__3GPP__3GPP__PDP__Type::str_to_enum(const char *str_par) { if (!strcmp(str_par, "IPv4")) return IPv4; else if (!strcmp(str_par, "PPP")) return PPP; else if (!strcmp(str_par, "IPv6")) return IPv6; else if (!strcmp(str_par, "IPv4v6")) return IPv4v6; else if (!strcmp(str_par, "NonIp")) return NonIp; else return UNKNOWN_VALUE; } boolean GI__3GPP__3GPP__PDP__Type::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: case 2: case 3: case 4: return TRUE; default: return FALSE; } } int GI__3GPP__3GPP__PDP__Type::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.GI_3GPP_3GPP_PDP_Type.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int GI__3GPP__3GPP__PDP__Type::enum2int(const GI__3GPP__3GPP__PDP__Type& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.GI_3GPP_3GPP_PDP_Type.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void GI__3GPP__3GPP__PDP__Type::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.GI_3GPP_3GPP_PDP_Type.", int_val); enum_value = (enum_type)int_val; } GI__3GPP__3GPP__PDP__Type::operator GI__3GPP__3GPP__PDP__Type::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.GI_3GPP_3GPP_PDP_Type."); return enum_value; } void GI__3GPP__3GPP__PDP__Type::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void GI__3GPP__3GPP__PDP__Type::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.GI_3GPP_3GPP_PDP_Type"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.GI_3GPP_3GPP_PDP_Type."); } } void GI__3GPP__3GPP__PDP__Type::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.GI_3GPP_3GPP_PDP_Type."); text_buf.push_int(enum_value); } void GI__3GPP__3GPP__PDP__Type::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.GI_3GPP_3GPP_PDP_Type.", enum_value); } void GI__3GPP__3GPP__PDP__Type::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void GI__3GPP__3GPP__PDP__Type::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int GI__3GPP__3GPP__PDP__Type::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 3, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int GI__3GPP__3GPP__PDP__Type::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 3); } void GI__3GPP__3GPP__PDP__Type_template::copy_template(const GI__3GPP__3GPP__PDP__Type_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new GI__3GPP__3GPP__PDP__Type_template[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 GI__3GPP__3GPP__PDP__Type_template(*other_value.implication_.precondition); implication_.implied_template = new GI__3GPP__3GPP__PDP__Type_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.GI_3GPP_3GPP_PDP_Type."); } } GI__3GPP__3GPP__PDP__Type_template::GI__3GPP__3GPP__PDP__Type_template() { } GI__3GPP__3GPP__PDP__Type_template::GI__3GPP__3GPP__PDP__Type_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } GI__3GPP__3GPP__PDP__Type_template::GI__3GPP__3GPP__PDP__Type_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!GI__3GPP__3GPP__PDP__Type::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.GI_3GPP_3GPP_PDP_Type with unknown numeric value %d.", other_value); single_value = (GI__3GPP__3GPP__PDP__Type::enum_type)other_value; } GI__3GPP__3GPP__PDP__Type_template::GI__3GPP__3GPP__PDP__Type_template(GI__3GPP__3GPP__PDP__Type::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } GI__3GPP__3GPP__PDP__Type_template::GI__3GPP__3GPP__PDP__Type_template(const GI__3GPP__3GPP__PDP__Type& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == GI__3GPP__3GPP__PDP__Type::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.GI_3GPP_3GPP_PDP_Type."); single_value = other_value.enum_value; } GI__3GPP__3GPP__PDP__Type_template::GI__3GPP__3GPP__PDP__Type_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (GI__3GPP__3GPP__PDP__Type::enum_type)(const GI__3GPP__3GPP__PDP__Type&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.GI_3GPP_3GPP_PDP_Type from an unbound optional field."); } } GI__3GPP__3GPP__PDP__Type_template::GI__3GPP__3GPP__PDP__Type_template(GI__3GPP__3GPP__PDP__Type_template* p_precondition, GI__3GPP__3GPP__PDP__Type_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } GI__3GPP__3GPP__PDP__Type_template::GI__3GPP__3GPP__PDP__Type_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; } GI__3GPP__3GPP__PDP__Type_template::GI__3GPP__3GPP__PDP__Type_template(const GI__3GPP__3GPP__PDP__Type_template& other_value) : Base_Template() { copy_template(other_value); } GI__3GPP__3GPP__PDP__Type_template::~GI__3GPP__3GPP__PDP__Type_template() { clean_up(); } boolean GI__3GPP__3GPP__PDP__Type_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean GI__3GPP__3GPP__PDP__Type_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != GI__3GPP__3GPP__PDP__Type::UNBOUND_VALUE; } void GI__3GPP__3GPP__PDP__Type_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } GI__3GPP__3GPP__PDP__Type_template& GI__3GPP__3GPP__PDP__Type_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } GI__3GPP__3GPP__PDP__Type_template& GI__3GPP__3GPP__PDP__Type_template::operator=(int other_value) { if (!GI__3GPP__3GPP__PDP__Type::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.GI_3GPP_3GPP_PDP_Type.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (GI__3GPP__3GPP__PDP__Type::enum_type)other_value; return *this; } GI__3GPP__3GPP__PDP__Type_template& GI__3GPP__3GPP__PDP__Type_template::operator=(GI__3GPP__3GPP__PDP__Type::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } GI__3GPP__3GPP__PDP__Type_template& GI__3GPP__3GPP__PDP__Type_template::operator=(const GI__3GPP__3GPP__PDP__Type& other_value) { if (other_value.enum_value == GI__3GPP__3GPP__PDP__Type::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.GI_3GPP_3GPP_PDP_Type to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } GI__3GPP__3GPP__PDP__Type_template& GI__3GPP__3GPP__PDP__Type_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (GI__3GPP__3GPP__PDP__Type::enum_type)(const GI__3GPP__3GPP__PDP__Type&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.GI_3GPP_3GPP_PDP_Type."); } return *this; } GI__3GPP__3GPP__PDP__Type_template& GI__3GPP__3GPP__PDP__Type_template::operator=(const GI__3GPP__3GPP__PDP__Type_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean GI__3GPP__3GPP__PDP__Type_template::match(GI__3GPP__3GPP__PDP__Type::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.GI_3GPP_3GPP_PDP_Type."); } return FALSE; } boolean GI__3GPP__3GPP__PDP__Type_template::match(const GI__3GPP__3GPP__PDP__Type& other_value, boolean) const { if (other_value.enum_value == GI__3GPP__3GPP__PDP__Type::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.GI_3GPP_3GPP_PDP_Type with an unbound value."); return match(other_value.enum_value); } GI__3GPP__3GPP__PDP__Type::enum_type GI__3GPP__3GPP__PDP__Type_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.GI_3GPP_3GPP_PDP_Type."); return single_value; } void GI__3GPP__3GPP__PDP__Type_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.GI_3GPP_3GPP_PDP_Type."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new GI__3GPP__3GPP__PDP__Type_template[list_length]; } GI__3GPP__3GPP__PDP__Type_template& GI__3GPP__3GPP__PDP__Type_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.GI_3GPP_3GPP_PDP_Type."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.GI_3GPP_3GPP_PDP_Type."); return value_list.list_value[list_index]; } void GI__3GPP__3GPP__PDP__Type_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(GI__3GPP__3GPP__PDP__Type::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void GI__3GPP__3GPP__PDP__Type_template::log_match(const GI__3GPP__3GPP__PDP__Type& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void GI__3GPP__3GPP__PDP__Type_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.GI_3GPP_3GPP_PDP_Type."); } } void GI__3GPP__3GPP__PDP__Type_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (GI__3GPP__3GPP__PDP__Type::enum_type)text_buf.pull_int().get_val(); if (!GI__3GPP__3GPP__PDP__Type::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.GI_3GPP_3GPP_PDP_Type.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new GI__3GPP__3GPP__PDP__Type_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.GI_3GPP_3GPP_PDP_Type."); } } boolean GI__3GPP__3GPP__PDP__Type_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean GI__3GPP__3GPP__PDP__Type_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { GI__3GPP__3GPP__PDP__Type_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { GI__3GPP__3GPP__PDP__Type::enum_type enum_val = GI__3GPP__3GPP__PDP__Type::str_to_enum(m_p->get_enumerated()); if (!GI__3GPP__3GPP__PDP__Type::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.GI_3GPP_3GPP_PDP_Type."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { GI__3GPP__3GPP__PDP__Type_template* precondition = new GI__3GPP__3GPP__PDP__Type_template; precondition->set_param(*m_p->get_elem(0)); GI__3GPP__3GPP__PDP__Type_template* implied_template = new GI__3GPP__3GPP__PDP__Type_template; implied_template->set_param(*m_p->get_elem(1)); *this = GI__3GPP__3GPP__PDP__Type_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.GI_3GPP_3GPP_PDP_Type"); } is_ifpresent = param.get_ifpresent(); } void GI__3GPP__3GPP__PDP__Type_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.GI_3GPP_3GPP_PDP_Type"); } MIPv4__NONE__MIP__Replay__Mode::MIPv4__NONE__MIP__Replay__Mode() { enum_value = UNBOUND_VALUE; } MIPv4__NONE__MIP__Replay__Mode::MIPv4__NONE__MIP__Replay__Mode(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Replay_Mode with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } MIPv4__NONE__MIP__Replay__Mode::MIPv4__NONE__MIP__Replay__Mode(enum_type other_value) { enum_value = other_value; } MIPv4__NONE__MIP__Replay__Mode::MIPv4__NONE__MIP__Replay__Mode(const MIPv4__NONE__MIP__Replay__Mode& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Replay_Mode."); enum_value = other_value.enum_value; } MIPv4__NONE__MIP__Replay__Mode& MIPv4__NONE__MIP__Replay__Mode::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Replay_Mode.", other_value); enum_value = (enum_type)other_value; return *this; } MIPv4__NONE__MIP__Replay__Mode& MIPv4__NONE__MIP__Replay__Mode::operator=(enum_type other_value) { enum_value = other_value; return *this; } MIPv4__NONE__MIP__Replay__Mode& MIPv4__NONE__MIP__Replay__Mode::operator=(const MIPv4__NONE__MIP__Replay__Mode& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Replay_Mode."); enum_value = other_value.enum_value; return *this; } boolean MIPv4__NONE__MIP__Replay__Mode::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Replay_Mode."); return enum_value == other_value; } boolean MIPv4__NONE__MIP__Replay__Mode::operator==(const MIPv4__NONE__MIP__Replay__Mode& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Replay_Mode."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Replay_Mode."); return enum_value == other_value.enum_value; } boolean MIPv4__NONE__MIP__Replay__Mode::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Replay_Mode."); return enum_value < other_value; } boolean MIPv4__NONE__MIP__Replay__Mode::operator<(const MIPv4__NONE__MIP__Replay__Mode& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Replay_Mode."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Replay_Mode."); return enum_value < other_value.enum_value; } boolean MIPv4__NONE__MIP__Replay__Mode::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Replay_Mode."); return enum_value > other_value; } boolean MIPv4__NONE__MIP__Replay__Mode::operator>(const MIPv4__NONE__MIP__Replay__Mode& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Replay_Mode."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Replay_Mode."); return enum_value > other_value.enum_value; } const char *MIPv4__NONE__MIP__Replay__Mode::enum_to_str(enum_type enum_par) { switch (enum_par) { case None: return "None"; case Timestamps: return "Timestamps"; case Nonces: return "Nonces"; default: return ""; } } MIPv4__NONE__MIP__Replay__Mode::enum_type MIPv4__NONE__MIP__Replay__Mode::str_to_enum(const char *str_par) { if (!strcmp(str_par, "None")) return None; else if (!strcmp(str_par, "Timestamps")) return Timestamps; else if (!strcmp(str_par, "Nonces")) return Nonces; else return UNKNOWN_VALUE; } boolean MIPv4__NONE__MIP__Replay__Mode::is_valid_enum(int int_par) { switch (int_par) { case 1: case 2: case 3: return TRUE; default: return FALSE; } } int MIPv4__NONE__MIP__Replay__Mode::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Replay_Mode.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int MIPv4__NONE__MIP__Replay__Mode::enum2int(const MIPv4__NONE__MIP__Replay__Mode& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Replay_Mode.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void MIPv4__NONE__MIP__Replay__Mode::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Replay_Mode.", int_val); enum_value = (enum_type)int_val; } MIPv4__NONE__MIP__Replay__Mode::operator MIPv4__NONE__MIP__Replay__Mode::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Replay_Mode."); return enum_value; } void MIPv4__NONE__MIP__Replay__Mode::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void MIPv4__NONE__MIP__Replay__Mode::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.MIPv4_NONE_MIP_Replay_Mode"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.MIPv4_NONE_MIP_Replay_Mode."); } } void MIPv4__NONE__MIP__Replay__Mode::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Replay_Mode."); text_buf.push_int(enum_value); } void MIPv4__NONE__MIP__Replay__Mode::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Replay_Mode.", enum_value); } void MIPv4__NONE__MIP__Replay__Mode::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void MIPv4__NONE__MIP__Replay__Mode::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int MIPv4__NONE__MIP__Replay__Mode::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int MIPv4__NONE__MIP__Replay__Mode::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void MIPv4__NONE__MIP__Replay__Mode_template::copy_template(const MIPv4__NONE__MIP__Replay__Mode_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new MIPv4__NONE__MIP__Replay__Mode_template[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 MIPv4__NONE__MIP__Replay__Mode_template(*other_value.implication_.precondition); implication_.implied_template = new MIPv4__NONE__MIP__Replay__Mode_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Replay_Mode."); } } MIPv4__NONE__MIP__Replay__Mode_template::MIPv4__NONE__MIP__Replay__Mode_template() { } MIPv4__NONE__MIP__Replay__Mode_template::MIPv4__NONE__MIP__Replay__Mode_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } MIPv4__NONE__MIP__Replay__Mode_template::MIPv4__NONE__MIP__Replay__Mode_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!MIPv4__NONE__MIP__Replay__Mode::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Replay_Mode with unknown numeric value %d.", other_value); single_value = (MIPv4__NONE__MIP__Replay__Mode::enum_type)other_value; } MIPv4__NONE__MIP__Replay__Mode_template::MIPv4__NONE__MIP__Replay__Mode_template(MIPv4__NONE__MIP__Replay__Mode::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } MIPv4__NONE__MIP__Replay__Mode_template::MIPv4__NONE__MIP__Replay__Mode_template(const MIPv4__NONE__MIP__Replay__Mode& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == MIPv4__NONE__MIP__Replay__Mode::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Replay_Mode."); single_value = other_value.enum_value; } MIPv4__NONE__MIP__Replay__Mode_template::MIPv4__NONE__MIP__Replay__Mode_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (MIPv4__NONE__MIP__Replay__Mode::enum_type)(const MIPv4__NONE__MIP__Replay__Mode&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Replay_Mode from an unbound optional field."); } } MIPv4__NONE__MIP__Replay__Mode_template::MIPv4__NONE__MIP__Replay__Mode_template(MIPv4__NONE__MIP__Replay__Mode_template* p_precondition, MIPv4__NONE__MIP__Replay__Mode_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } MIPv4__NONE__MIP__Replay__Mode_template::MIPv4__NONE__MIP__Replay__Mode_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; } MIPv4__NONE__MIP__Replay__Mode_template::MIPv4__NONE__MIP__Replay__Mode_template(const MIPv4__NONE__MIP__Replay__Mode_template& other_value) : Base_Template() { copy_template(other_value); } MIPv4__NONE__MIP__Replay__Mode_template::~MIPv4__NONE__MIP__Replay__Mode_template() { clean_up(); } boolean MIPv4__NONE__MIP__Replay__Mode_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean MIPv4__NONE__MIP__Replay__Mode_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != MIPv4__NONE__MIP__Replay__Mode::UNBOUND_VALUE; } void MIPv4__NONE__MIP__Replay__Mode_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } MIPv4__NONE__MIP__Replay__Mode_template& MIPv4__NONE__MIP__Replay__Mode_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } MIPv4__NONE__MIP__Replay__Mode_template& MIPv4__NONE__MIP__Replay__Mode_template::operator=(int other_value) { if (!MIPv4__NONE__MIP__Replay__Mode::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Replay_Mode.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (MIPv4__NONE__MIP__Replay__Mode::enum_type)other_value; return *this; } MIPv4__NONE__MIP__Replay__Mode_template& MIPv4__NONE__MIP__Replay__Mode_template::operator=(MIPv4__NONE__MIP__Replay__Mode::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } MIPv4__NONE__MIP__Replay__Mode_template& MIPv4__NONE__MIP__Replay__Mode_template::operator=(const MIPv4__NONE__MIP__Replay__Mode& other_value) { if (other_value.enum_value == MIPv4__NONE__MIP__Replay__Mode::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Replay_Mode to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } MIPv4__NONE__MIP__Replay__Mode_template& MIPv4__NONE__MIP__Replay__Mode_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (MIPv4__NONE__MIP__Replay__Mode::enum_type)(const MIPv4__NONE__MIP__Replay__Mode&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Replay_Mode."); } return *this; } MIPv4__NONE__MIP__Replay__Mode_template& MIPv4__NONE__MIP__Replay__Mode_template::operator=(const MIPv4__NONE__MIP__Replay__Mode_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean MIPv4__NONE__MIP__Replay__Mode_template::match(MIPv4__NONE__MIP__Replay__Mode::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Replay_Mode."); } return FALSE; } boolean MIPv4__NONE__MIP__Replay__Mode_template::match(const MIPv4__NONE__MIP__Replay__Mode& other_value, boolean) const { if (other_value.enum_value == MIPv4__NONE__MIP__Replay__Mode::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Replay_Mode with an unbound value."); return match(other_value.enum_value); } MIPv4__NONE__MIP__Replay__Mode::enum_type MIPv4__NONE__MIP__Replay__Mode_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Replay_Mode."); return single_value; } void MIPv4__NONE__MIP__Replay__Mode_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Replay_Mode."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new MIPv4__NONE__MIP__Replay__Mode_template[list_length]; } MIPv4__NONE__MIP__Replay__Mode_template& MIPv4__NONE__MIP__Replay__Mode_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Replay_Mode."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Replay_Mode."); return value_list.list_value[list_index]; } void MIPv4__NONE__MIP__Replay__Mode_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(MIPv4__NONE__MIP__Replay__Mode::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void MIPv4__NONE__MIP__Replay__Mode_template::log_match(const MIPv4__NONE__MIP__Replay__Mode& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void MIPv4__NONE__MIP__Replay__Mode_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Replay_Mode."); } } void MIPv4__NONE__MIP__Replay__Mode_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (MIPv4__NONE__MIP__Replay__Mode::enum_type)text_buf.pull_int().get_val(); if (!MIPv4__NONE__MIP__Replay__Mode::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Replay_Mode.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new MIPv4__NONE__MIP__Replay__Mode_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Replay_Mode."); } } boolean MIPv4__NONE__MIP__Replay__Mode_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean MIPv4__NONE__MIP__Replay__Mode_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { MIPv4__NONE__MIP__Replay__Mode_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { MIPv4__NONE__MIP__Replay__Mode::enum_type enum_val = MIPv4__NONE__MIP__Replay__Mode::str_to_enum(m_p->get_enumerated()); if (!MIPv4__NONE__MIP__Replay__Mode::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.MIPv4_NONE_MIP_Replay_Mode."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { MIPv4__NONE__MIP__Replay__Mode_template* precondition = new MIPv4__NONE__MIP__Replay__Mode_template; precondition->set_param(*m_p->get_elem(0)); MIPv4__NONE__MIP__Replay__Mode_template* implied_template = new MIPv4__NONE__MIP__Replay__Mode_template; implied_template->set_param(*m_p->get_elem(1)); *this = MIPv4__NONE__MIP__Replay__Mode_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.MIPv4_NONE_MIP_Replay_Mode"); } is_ifpresent = param.get_ifpresent(); } void MIPv4__NONE__MIP__Replay__Mode_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.MIPv4_NONE_MIP_Replay_Mode"); } DCA__3GPP__Additional__Exception__Reports::DCA__3GPP__Additional__Exception__Reports() { enum_value = UNBOUND_VALUE; } DCA__3GPP__Additional__Exception__Reports::DCA__3GPP__Additional__Exception__Reports(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Additional_Exception_Reports with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } DCA__3GPP__Additional__Exception__Reports::DCA__3GPP__Additional__Exception__Reports(enum_type other_value) { enum_value = other_value; } DCA__3GPP__Additional__Exception__Reports::DCA__3GPP__Additional__Exception__Reports(const DCA__3GPP__Additional__Exception__Reports& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Additional_Exception_Reports."); enum_value = other_value.enum_value; } DCA__3GPP__Additional__Exception__Reports& DCA__3GPP__Additional__Exception__Reports::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Additional_Exception_Reports.", other_value); enum_value = (enum_type)other_value; return *this; } DCA__3GPP__Additional__Exception__Reports& DCA__3GPP__Additional__Exception__Reports::operator=(enum_type other_value) { enum_value = other_value; return *this; } DCA__3GPP__Additional__Exception__Reports& DCA__3GPP__Additional__Exception__Reports::operator=(const DCA__3GPP__Additional__Exception__Reports& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Additional_Exception_Reports."); enum_value = other_value.enum_value; return *this; } boolean DCA__3GPP__Additional__Exception__Reports::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Additional_Exception_Reports."); return enum_value == other_value; } boolean DCA__3GPP__Additional__Exception__Reports::operator==(const DCA__3GPP__Additional__Exception__Reports& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Additional_Exception_Reports."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Additional_Exception_Reports."); return enum_value == other_value.enum_value; } boolean DCA__3GPP__Additional__Exception__Reports::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Additional_Exception_Reports."); return enum_value < other_value; } boolean DCA__3GPP__Additional__Exception__Reports::operator<(const DCA__3GPP__Additional__Exception__Reports& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Additional_Exception_Reports."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Additional_Exception_Reports."); return enum_value < other_value.enum_value; } boolean DCA__3GPP__Additional__Exception__Reports::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Additional_Exception_Reports."); return enum_value > other_value; } boolean DCA__3GPP__Additional__Exception__Reports::operator>(const DCA__3GPP__Additional__Exception__Reports& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Additional_Exception_Reports."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Additional_Exception_Reports."); return enum_value > other_value.enum_value; } const char *DCA__3GPP__Additional__Exception__Reports::enum_to_str(enum_type enum_par) { switch (enum_par) { case NOT__ALLOWED: return "NOT_ALLOWED"; case ALLOWED: return "ALLOWED"; default: return ""; } } DCA__3GPP__Additional__Exception__Reports::enum_type DCA__3GPP__Additional__Exception__Reports::str_to_enum(const char *str_par) { if (!strcmp(str_par, "NOT_ALLOWED")) return NOT__ALLOWED; else if (!strcmp(str_par, "ALLOWED")) return ALLOWED; else return UNKNOWN_VALUE; } boolean DCA__3GPP__Additional__Exception__Reports::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: return TRUE; default: return FALSE; } } int DCA__3GPP__Additional__Exception__Reports::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_Additional_Exception_Reports.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int DCA__3GPP__Additional__Exception__Reports::enum2int(const DCA__3GPP__Additional__Exception__Reports& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_Additional_Exception_Reports.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void DCA__3GPP__Additional__Exception__Reports::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Additional_Exception_Reports.", int_val); enum_value = (enum_type)int_val; } DCA__3GPP__Additional__Exception__Reports::operator DCA__3GPP__Additional__Exception__Reports::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.DCA_3GPP_Additional_Exception_Reports."); return enum_value; } void DCA__3GPP__Additional__Exception__Reports::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void DCA__3GPP__Additional__Exception__Reports::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.DCA_3GPP_Additional_Exception_Reports"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_Additional_Exception_Reports."); } } void DCA__3GPP__Additional__Exception__Reports::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Additional_Exception_Reports."); text_buf.push_int(enum_value); } void DCA__3GPP__Additional__Exception__Reports::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.DCA_3GPP_Additional_Exception_Reports.", enum_value); } void DCA__3GPP__Additional__Exception__Reports::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void DCA__3GPP__Additional__Exception__Reports::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int DCA__3GPP__Additional__Exception__Reports::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int DCA__3GPP__Additional__Exception__Reports::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void DCA__3GPP__Additional__Exception__Reports_template::copy_template(const DCA__3GPP__Additional__Exception__Reports_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new DCA__3GPP__Additional__Exception__Reports_template[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 DCA__3GPP__Additional__Exception__Reports_template(*other_value.implication_.precondition); implication_.implied_template = new DCA__3GPP__Additional__Exception__Reports_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Additional_Exception_Reports."); } } DCA__3GPP__Additional__Exception__Reports_template::DCA__3GPP__Additional__Exception__Reports_template() { } DCA__3GPP__Additional__Exception__Reports_template::DCA__3GPP__Additional__Exception__Reports_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } DCA__3GPP__Additional__Exception__Reports_template::DCA__3GPP__Additional__Exception__Reports_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!DCA__3GPP__Additional__Exception__Reports::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.DCA_3GPP_Additional_Exception_Reports with unknown numeric value %d.", other_value); single_value = (DCA__3GPP__Additional__Exception__Reports::enum_type)other_value; } DCA__3GPP__Additional__Exception__Reports_template::DCA__3GPP__Additional__Exception__Reports_template(DCA__3GPP__Additional__Exception__Reports::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } DCA__3GPP__Additional__Exception__Reports_template::DCA__3GPP__Additional__Exception__Reports_template(const DCA__3GPP__Additional__Exception__Reports& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == DCA__3GPP__Additional__Exception__Reports::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Additional_Exception_Reports."); single_value = other_value.enum_value; } DCA__3GPP__Additional__Exception__Reports_template::DCA__3GPP__Additional__Exception__Reports_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Additional__Exception__Reports::enum_type)(const DCA__3GPP__Additional__Exception__Reports&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.DCA_3GPP_Additional_Exception_Reports from an unbound optional field."); } } DCA__3GPP__Additional__Exception__Reports_template::DCA__3GPP__Additional__Exception__Reports_template(DCA__3GPP__Additional__Exception__Reports_template* p_precondition, DCA__3GPP__Additional__Exception__Reports_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } DCA__3GPP__Additional__Exception__Reports_template::DCA__3GPP__Additional__Exception__Reports_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; } DCA__3GPP__Additional__Exception__Reports_template::DCA__3GPP__Additional__Exception__Reports_template(const DCA__3GPP__Additional__Exception__Reports_template& other_value) : Base_Template() { copy_template(other_value); } DCA__3GPP__Additional__Exception__Reports_template::~DCA__3GPP__Additional__Exception__Reports_template() { clean_up(); } boolean DCA__3GPP__Additional__Exception__Reports_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean DCA__3GPP__Additional__Exception__Reports_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != DCA__3GPP__Additional__Exception__Reports::UNBOUND_VALUE; } void DCA__3GPP__Additional__Exception__Reports_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } DCA__3GPP__Additional__Exception__Reports_template& DCA__3GPP__Additional__Exception__Reports_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } DCA__3GPP__Additional__Exception__Reports_template& DCA__3GPP__Additional__Exception__Reports_template::operator=(int other_value) { if (!DCA__3GPP__Additional__Exception__Reports::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.DCA_3GPP_Additional_Exception_Reports.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Additional__Exception__Reports::enum_type)other_value; return *this; } DCA__3GPP__Additional__Exception__Reports_template& DCA__3GPP__Additional__Exception__Reports_template::operator=(DCA__3GPP__Additional__Exception__Reports::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } DCA__3GPP__Additional__Exception__Reports_template& DCA__3GPP__Additional__Exception__Reports_template::operator=(const DCA__3GPP__Additional__Exception__Reports& other_value) { if (other_value.enum_value == DCA__3GPP__Additional__Exception__Reports::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Additional_Exception_Reports to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } DCA__3GPP__Additional__Exception__Reports_template& DCA__3GPP__Additional__Exception__Reports_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Additional__Exception__Reports::enum_type)(const DCA__3GPP__Additional__Exception__Reports&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.DCA_3GPP_Additional_Exception_Reports."); } return *this; } DCA__3GPP__Additional__Exception__Reports_template& DCA__3GPP__Additional__Exception__Reports_template::operator=(const DCA__3GPP__Additional__Exception__Reports_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean DCA__3GPP__Additional__Exception__Reports_template::match(DCA__3GPP__Additional__Exception__Reports::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Additional_Exception_Reports."); } return FALSE; } boolean DCA__3GPP__Additional__Exception__Reports_template::match(const DCA__3GPP__Additional__Exception__Reports& other_value, boolean) const { if (other_value.enum_value == DCA__3GPP__Additional__Exception__Reports::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.DCA_3GPP_Additional_Exception_Reports with an unbound value."); return match(other_value.enum_value); } DCA__3GPP__Additional__Exception__Reports::enum_type DCA__3GPP__Additional__Exception__Reports_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.DCA_3GPP_Additional_Exception_Reports."); return single_value; } void DCA__3GPP__Additional__Exception__Reports_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Additional_Exception_Reports."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new DCA__3GPP__Additional__Exception__Reports_template[list_length]; } DCA__3GPP__Additional__Exception__Reports_template& DCA__3GPP__Additional__Exception__Reports_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.DCA_3GPP_Additional_Exception_Reports."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.DCA_3GPP_Additional_Exception_Reports."); return value_list.list_value[list_index]; } void DCA__3GPP__Additional__Exception__Reports_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(DCA__3GPP__Additional__Exception__Reports::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void DCA__3GPP__Additional__Exception__Reports_template::log_match(const DCA__3GPP__Additional__Exception__Reports& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void DCA__3GPP__Additional__Exception__Reports_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Additional_Exception_Reports."); } } void DCA__3GPP__Additional__Exception__Reports_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (DCA__3GPP__Additional__Exception__Reports::enum_type)text_buf.pull_int().get_val(); if (!DCA__3GPP__Additional__Exception__Reports::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Additional_Exception_Reports.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new DCA__3GPP__Additional__Exception__Reports_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Additional_Exception_Reports."); } } boolean DCA__3GPP__Additional__Exception__Reports_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean DCA__3GPP__Additional__Exception__Reports_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { DCA__3GPP__Additional__Exception__Reports_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { DCA__3GPP__Additional__Exception__Reports::enum_type enum_val = DCA__3GPP__Additional__Exception__Reports::str_to_enum(m_p->get_enumerated()); if (!DCA__3GPP__Additional__Exception__Reports::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_Additional_Exception_Reports."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { DCA__3GPP__Additional__Exception__Reports_template* precondition = new DCA__3GPP__Additional__Exception__Reports_template; precondition->set_param(*m_p->get_elem(0)); DCA__3GPP__Additional__Exception__Reports_template* implied_template = new DCA__3GPP__Additional__Exception__Reports_template; implied_template->set_param(*m_p->get_elem(1)); *this = DCA__3GPP__Additional__Exception__Reports_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.DCA_3GPP_Additional_Exception_Reports"); } is_ifpresent = param.get_ifpresent(); } void DCA__3GPP__Additional__Exception__Reports_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.DCA_3GPP_Additional_Exception_Reports"); } DCA__3GPP__MMBox__Storage__Requested::DCA__3GPP__MMBox__Storage__Requested() { enum_value = UNBOUND_VALUE; } DCA__3GPP__MMBox__Storage__Requested::DCA__3GPP__MMBox__Storage__Requested(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.DCA_3GPP_MMBox_Storage_Requested with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } DCA__3GPP__MMBox__Storage__Requested::DCA__3GPP__MMBox__Storage__Requested(enum_type other_value) { enum_value = other_value; } DCA__3GPP__MMBox__Storage__Requested::DCA__3GPP__MMBox__Storage__Requested(const DCA__3GPP__MMBox__Storage__Requested& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_MMBox_Storage_Requested."); enum_value = other_value.enum_value; } DCA__3GPP__MMBox__Storage__Requested& DCA__3GPP__MMBox__Storage__Requested::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_MMBox_Storage_Requested.", other_value); enum_value = (enum_type)other_value; return *this; } DCA__3GPP__MMBox__Storage__Requested& DCA__3GPP__MMBox__Storage__Requested::operator=(enum_type other_value) { enum_value = other_value; return *this; } DCA__3GPP__MMBox__Storage__Requested& DCA__3GPP__MMBox__Storage__Requested::operator=(const DCA__3GPP__MMBox__Storage__Requested& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_MMBox_Storage_Requested."); enum_value = other_value.enum_value; return *this; } boolean DCA__3GPP__MMBox__Storage__Requested::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_MMBox_Storage_Requested."); return enum_value == other_value; } boolean DCA__3GPP__MMBox__Storage__Requested::operator==(const DCA__3GPP__MMBox__Storage__Requested& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_MMBox_Storage_Requested."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_MMBox_Storage_Requested."); return enum_value == other_value.enum_value; } boolean DCA__3GPP__MMBox__Storage__Requested::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_MMBox_Storage_Requested."); return enum_value < other_value; } boolean DCA__3GPP__MMBox__Storage__Requested::operator<(const DCA__3GPP__MMBox__Storage__Requested& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_MMBox_Storage_Requested."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_MMBox_Storage_Requested."); return enum_value < other_value.enum_value; } boolean DCA__3GPP__MMBox__Storage__Requested::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_MMBox_Storage_Requested."); return enum_value > other_value; } boolean DCA__3GPP__MMBox__Storage__Requested::operator>(const DCA__3GPP__MMBox__Storage__Requested& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_MMBox_Storage_Requested."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_MMBox_Storage_Requested."); return enum_value > other_value.enum_value; } const char *DCA__3GPP__MMBox__Storage__Requested::enum_to_str(enum_type enum_par) { switch (enum_par) { case NO: return "NO"; case YES: return "YES"; default: return ""; } } DCA__3GPP__MMBox__Storage__Requested::enum_type DCA__3GPP__MMBox__Storage__Requested::str_to_enum(const char *str_par) { if (!strcmp(str_par, "NO")) return NO; else if (!strcmp(str_par, "YES")) return YES; else return UNKNOWN_VALUE; } boolean DCA__3GPP__MMBox__Storage__Requested::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: return TRUE; default: return FALSE; } } int DCA__3GPP__MMBox__Storage__Requested::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_MMBox_Storage_Requested.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int DCA__3GPP__MMBox__Storage__Requested::enum2int(const DCA__3GPP__MMBox__Storage__Requested& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_MMBox_Storage_Requested.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void DCA__3GPP__MMBox__Storage__Requested::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_MMBox_Storage_Requested.", int_val); enum_value = (enum_type)int_val; } DCA__3GPP__MMBox__Storage__Requested::operator DCA__3GPP__MMBox__Storage__Requested::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.DCA_3GPP_MMBox_Storage_Requested."); return enum_value; } void DCA__3GPP__MMBox__Storage__Requested::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void DCA__3GPP__MMBox__Storage__Requested::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.DCA_3GPP_MMBox_Storage_Requested"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_MMBox_Storage_Requested."); } } void DCA__3GPP__MMBox__Storage__Requested::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_MMBox_Storage_Requested."); text_buf.push_int(enum_value); } void DCA__3GPP__MMBox__Storage__Requested::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.DCA_3GPP_MMBox_Storage_Requested.", enum_value); } void DCA__3GPP__MMBox__Storage__Requested::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void DCA__3GPP__MMBox__Storage__Requested::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int DCA__3GPP__MMBox__Storage__Requested::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int DCA__3GPP__MMBox__Storage__Requested::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void DCA__3GPP__MMBox__Storage__Requested_template::copy_template(const DCA__3GPP__MMBox__Storage__Requested_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new DCA__3GPP__MMBox__Storage__Requested_template[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 DCA__3GPP__MMBox__Storage__Requested_template(*other_value.implication_.precondition); implication_.implied_template = new DCA__3GPP__MMBox__Storage__Requested_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_MMBox_Storage_Requested."); } } DCA__3GPP__MMBox__Storage__Requested_template::DCA__3GPP__MMBox__Storage__Requested_template() { } DCA__3GPP__MMBox__Storage__Requested_template::DCA__3GPP__MMBox__Storage__Requested_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } DCA__3GPP__MMBox__Storage__Requested_template::DCA__3GPP__MMBox__Storage__Requested_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!DCA__3GPP__MMBox__Storage__Requested::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.DCA_3GPP_MMBox_Storage_Requested with unknown numeric value %d.", other_value); single_value = (DCA__3GPP__MMBox__Storage__Requested::enum_type)other_value; } DCA__3GPP__MMBox__Storage__Requested_template::DCA__3GPP__MMBox__Storage__Requested_template(DCA__3GPP__MMBox__Storage__Requested::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } DCA__3GPP__MMBox__Storage__Requested_template::DCA__3GPP__MMBox__Storage__Requested_template(const DCA__3GPP__MMBox__Storage__Requested& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == DCA__3GPP__MMBox__Storage__Requested::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_MMBox_Storage_Requested."); single_value = other_value.enum_value; } DCA__3GPP__MMBox__Storage__Requested_template::DCA__3GPP__MMBox__Storage__Requested_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__MMBox__Storage__Requested::enum_type)(const DCA__3GPP__MMBox__Storage__Requested&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.DCA_3GPP_MMBox_Storage_Requested from an unbound optional field."); } } DCA__3GPP__MMBox__Storage__Requested_template::DCA__3GPP__MMBox__Storage__Requested_template(DCA__3GPP__MMBox__Storage__Requested_template* p_precondition, DCA__3GPP__MMBox__Storage__Requested_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } DCA__3GPP__MMBox__Storage__Requested_template::DCA__3GPP__MMBox__Storage__Requested_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; } DCA__3GPP__MMBox__Storage__Requested_template::DCA__3GPP__MMBox__Storage__Requested_template(const DCA__3GPP__MMBox__Storage__Requested_template& other_value) : Base_Template() { copy_template(other_value); } DCA__3GPP__MMBox__Storage__Requested_template::~DCA__3GPP__MMBox__Storage__Requested_template() { clean_up(); } boolean DCA__3GPP__MMBox__Storage__Requested_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean DCA__3GPP__MMBox__Storage__Requested_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != DCA__3GPP__MMBox__Storage__Requested::UNBOUND_VALUE; } void DCA__3GPP__MMBox__Storage__Requested_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } DCA__3GPP__MMBox__Storage__Requested_template& DCA__3GPP__MMBox__Storage__Requested_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } DCA__3GPP__MMBox__Storage__Requested_template& DCA__3GPP__MMBox__Storage__Requested_template::operator=(int other_value) { if (!DCA__3GPP__MMBox__Storage__Requested::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.DCA_3GPP_MMBox_Storage_Requested.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__MMBox__Storage__Requested::enum_type)other_value; return *this; } DCA__3GPP__MMBox__Storage__Requested_template& DCA__3GPP__MMBox__Storage__Requested_template::operator=(DCA__3GPP__MMBox__Storage__Requested::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } DCA__3GPP__MMBox__Storage__Requested_template& DCA__3GPP__MMBox__Storage__Requested_template::operator=(const DCA__3GPP__MMBox__Storage__Requested& other_value) { if (other_value.enum_value == DCA__3GPP__MMBox__Storage__Requested::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_MMBox_Storage_Requested to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } DCA__3GPP__MMBox__Storage__Requested_template& DCA__3GPP__MMBox__Storage__Requested_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__MMBox__Storage__Requested::enum_type)(const DCA__3GPP__MMBox__Storage__Requested&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.DCA_3GPP_MMBox_Storage_Requested."); } return *this; } DCA__3GPP__MMBox__Storage__Requested_template& DCA__3GPP__MMBox__Storage__Requested_template::operator=(const DCA__3GPP__MMBox__Storage__Requested_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean DCA__3GPP__MMBox__Storage__Requested_template::match(DCA__3GPP__MMBox__Storage__Requested::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_MMBox_Storage_Requested."); } return FALSE; } boolean DCA__3GPP__MMBox__Storage__Requested_template::match(const DCA__3GPP__MMBox__Storage__Requested& other_value, boolean) const { if (other_value.enum_value == DCA__3GPP__MMBox__Storage__Requested::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.DCA_3GPP_MMBox_Storage_Requested with an unbound value."); return match(other_value.enum_value); } DCA__3GPP__MMBox__Storage__Requested::enum_type DCA__3GPP__MMBox__Storage__Requested_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.DCA_3GPP_MMBox_Storage_Requested."); return single_value; } void DCA__3GPP__MMBox__Storage__Requested_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.DCA_3GPP_MMBox_Storage_Requested."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new DCA__3GPP__MMBox__Storage__Requested_template[list_length]; } DCA__3GPP__MMBox__Storage__Requested_template& DCA__3GPP__MMBox__Storage__Requested_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.DCA_3GPP_MMBox_Storage_Requested."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.DCA_3GPP_MMBox_Storage_Requested."); return value_list.list_value[list_index]; } void DCA__3GPP__MMBox__Storage__Requested_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(DCA__3GPP__MMBox__Storage__Requested::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void DCA__3GPP__MMBox__Storage__Requested_template::log_match(const DCA__3GPP__MMBox__Storage__Requested& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void DCA__3GPP__MMBox__Storage__Requested_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_MMBox_Storage_Requested."); } } void DCA__3GPP__MMBox__Storage__Requested_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (DCA__3GPP__MMBox__Storage__Requested::enum_type)text_buf.pull_int().get_val(); if (!DCA__3GPP__MMBox__Storage__Requested::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_MMBox_Storage_Requested.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new DCA__3GPP__MMBox__Storage__Requested_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_MMBox_Storage_Requested."); } } boolean DCA__3GPP__MMBox__Storage__Requested_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean DCA__3GPP__MMBox__Storage__Requested_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { DCA__3GPP__MMBox__Storage__Requested_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { DCA__3GPP__MMBox__Storage__Requested::enum_type enum_val = DCA__3GPP__MMBox__Storage__Requested::str_to_enum(m_p->get_enumerated()); if (!DCA__3GPP__MMBox__Storage__Requested::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_MMBox_Storage_Requested."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { DCA__3GPP__MMBox__Storage__Requested_template* precondition = new DCA__3GPP__MMBox__Storage__Requested_template; precondition->set_param(*m_p->get_elem(0)); DCA__3GPP__MMBox__Storage__Requested_template* implied_template = new DCA__3GPP__MMBox__Storage__Requested_template; implied_template->set_param(*m_p->get_elem(1)); *this = DCA__3GPP__MMBox__Storage__Requested_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.DCA_3GPP_MMBox_Storage_Requested"); } is_ifpresent = param.get_ifpresent(); } void DCA__3GPP__MMBox__Storage__Requested_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.DCA_3GPP_MMBox_Storage_Requested"); } RX__3GPP__Flow__Status::RX__3GPP__Flow__Status() { enum_value = UNBOUND_VALUE; } RX__3GPP__Flow__Status::RX__3GPP__Flow__Status(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.RX_3GPP_Flow_Status with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } RX__3GPP__Flow__Status::RX__3GPP__Flow__Status(enum_type other_value) { enum_value = other_value; } RX__3GPP__Flow__Status::RX__3GPP__Flow__Status(const RX__3GPP__Flow__Status& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Flow_Status."); enum_value = other_value.enum_value; } RX__3GPP__Flow__Status& RX__3GPP__Flow__Status::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.RX_3GPP_Flow_Status.", other_value); enum_value = (enum_type)other_value; return *this; } RX__3GPP__Flow__Status& RX__3GPP__Flow__Status::operator=(enum_type other_value) { enum_value = other_value; return *this; } RX__3GPP__Flow__Status& RX__3GPP__Flow__Status::operator=(const RX__3GPP__Flow__Status& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Flow_Status."); enum_value = other_value.enum_value; return *this; } boolean RX__3GPP__Flow__Status::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Flow_Status."); return enum_value == other_value; } boolean RX__3GPP__Flow__Status::operator==(const RX__3GPP__Flow__Status& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Flow_Status."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Flow_Status."); return enum_value == other_value.enum_value; } boolean RX__3GPP__Flow__Status::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Flow_Status."); return enum_value < other_value; } boolean RX__3GPP__Flow__Status::operator<(const RX__3GPP__Flow__Status& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Flow_Status."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Flow_Status."); return enum_value < other_value.enum_value; } boolean RX__3GPP__Flow__Status::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Flow_Status."); return enum_value > other_value; } boolean RX__3GPP__Flow__Status::operator>(const RX__3GPP__Flow__Status& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Flow_Status."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Flow_Status."); return enum_value > other_value.enum_value; } const char *RX__3GPP__Flow__Status::enum_to_str(enum_type enum_par) { switch (enum_par) { case ENABLED__UPLINK: return "ENABLED_UPLINK"; case ENABLED__DOWNLINK: return "ENABLED_DOWNLINK"; case ENABLED: return "ENABLED"; case DISABLED: return "DISABLED"; case REMOVED: return "REMOVED"; default: return ""; } } RX__3GPP__Flow__Status::enum_type RX__3GPP__Flow__Status::str_to_enum(const char *str_par) { if (!strcmp(str_par, "ENABLED_UPLINK")) return ENABLED__UPLINK; else if (!strcmp(str_par, "ENABLED_DOWNLINK")) return ENABLED__DOWNLINK; else if (!strcmp(str_par, "ENABLED")) return ENABLED; else if (!strcmp(str_par, "DISABLED")) return DISABLED; else if (!strcmp(str_par, "REMOVED")) return REMOVED; else return UNKNOWN_VALUE; } boolean RX__3GPP__Flow__Status::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: case 2: case 3: case 4: return TRUE; default: return FALSE; } } int RX__3GPP__Flow__Status::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.RX_3GPP_Flow_Status.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int RX__3GPP__Flow__Status::enum2int(const RX__3GPP__Flow__Status& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.RX_3GPP_Flow_Status.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void RX__3GPP__Flow__Status::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.RX_3GPP_Flow_Status.", int_val); enum_value = (enum_type)int_val; } RX__3GPP__Flow__Status::operator RX__3GPP__Flow__Status::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.RX_3GPP_Flow_Status."); return enum_value; } void RX__3GPP__Flow__Status::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void RX__3GPP__Flow__Status::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.RX_3GPP_Flow_Status"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.RX_3GPP_Flow_Status."); } } void RX__3GPP__Flow__Status::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Flow_Status."); text_buf.push_int(enum_value); } void RX__3GPP__Flow__Status::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.RX_3GPP_Flow_Status.", enum_value); } void RX__3GPP__Flow__Status::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void RX__3GPP__Flow__Status::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int RX__3GPP__Flow__Status::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 3, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int RX__3GPP__Flow__Status::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 3); } void RX__3GPP__Flow__Status_template::copy_template(const RX__3GPP__Flow__Status_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new RX__3GPP__Flow__Status_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].copy_template(other_value.value_list.list_value[list_count]); break; case IMPLICATION_MATCH: implication_.precondition = new RX__3GPP__Flow__Status_template(*other_value.implication_.precondition); implication_.implied_template = new RX__3GPP__Flow__Status_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.RX_3GPP_Flow_Status."); } } RX__3GPP__Flow__Status_template::RX__3GPP__Flow__Status_template() { } RX__3GPP__Flow__Status_template::RX__3GPP__Flow__Status_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } RX__3GPP__Flow__Status_template::RX__3GPP__Flow__Status_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!RX__3GPP__Flow__Status::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.RX_3GPP_Flow_Status with unknown numeric value %d.", other_value); single_value = (RX__3GPP__Flow__Status::enum_type)other_value; } RX__3GPP__Flow__Status_template::RX__3GPP__Flow__Status_template(RX__3GPP__Flow__Status::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } RX__3GPP__Flow__Status_template::RX__3GPP__Flow__Status_template(const RX__3GPP__Flow__Status& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == RX__3GPP__Flow__Status::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Flow_Status."); single_value = other_value.enum_value; } RX__3GPP__Flow__Status_template::RX__3GPP__Flow__Status_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (RX__3GPP__Flow__Status::enum_type)(const RX__3GPP__Flow__Status&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.RX_3GPP_Flow_Status from an unbound optional field."); } } RX__3GPP__Flow__Status_template::RX__3GPP__Flow__Status_template(RX__3GPP__Flow__Status_template* p_precondition, RX__3GPP__Flow__Status_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } RX__3GPP__Flow__Status_template::RX__3GPP__Flow__Status_template(Dynamic_Match_Interface* p_dyn_match) : Base_Template(DYNAMIC_MATCH) { dyn_match = new dynmatch_struct; dyn_match->ptr = p_dyn_match; dyn_match->ref_count = 1; } RX__3GPP__Flow__Status_template::RX__3GPP__Flow__Status_template(const RX__3GPP__Flow__Status_template& other_value) : Base_Template() { copy_template(other_value); } RX__3GPP__Flow__Status_template::~RX__3GPP__Flow__Status_template() { clean_up(); } boolean RX__3GPP__Flow__Status_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean RX__3GPP__Flow__Status_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != RX__3GPP__Flow__Status::UNBOUND_VALUE; } void RX__3GPP__Flow__Status_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } RX__3GPP__Flow__Status_template& RX__3GPP__Flow__Status_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } RX__3GPP__Flow__Status_template& RX__3GPP__Flow__Status_template::operator=(int other_value) { if (!RX__3GPP__Flow__Status::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.RX_3GPP_Flow_Status.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (RX__3GPP__Flow__Status::enum_type)other_value; return *this; } RX__3GPP__Flow__Status_template& RX__3GPP__Flow__Status_template::operator=(RX__3GPP__Flow__Status::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } RX__3GPP__Flow__Status_template& RX__3GPP__Flow__Status_template::operator=(const RX__3GPP__Flow__Status& other_value) { if (other_value.enum_value == RX__3GPP__Flow__Status::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Flow_Status to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } RX__3GPP__Flow__Status_template& RX__3GPP__Flow__Status_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (RX__3GPP__Flow__Status::enum_type)(const RX__3GPP__Flow__Status&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.RX_3GPP_Flow_Status."); } return *this; } RX__3GPP__Flow__Status_template& RX__3GPP__Flow__Status_template::operator=(const RX__3GPP__Flow__Status_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean RX__3GPP__Flow__Status_template::match(RX__3GPP__Flow__Status::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.RX_3GPP_Flow_Status."); } return FALSE; } boolean RX__3GPP__Flow__Status_template::match(const RX__3GPP__Flow__Status& other_value, boolean) const { if (other_value.enum_value == RX__3GPP__Flow__Status::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.RX_3GPP_Flow_Status with an unbound value."); return match(other_value.enum_value); } RX__3GPP__Flow__Status::enum_type RX__3GPP__Flow__Status_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.RX_3GPP_Flow_Status."); return single_value; } void RX__3GPP__Flow__Status_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.RX_3GPP_Flow_Status."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new RX__3GPP__Flow__Status_template[list_length]; } RX__3GPP__Flow__Status_template& RX__3GPP__Flow__Status_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.RX_3GPP_Flow_Status."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.RX_3GPP_Flow_Status."); return value_list.list_value[list_index]; } void RX__3GPP__Flow__Status_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(RX__3GPP__Flow__Status::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void RX__3GPP__Flow__Status_template::log_match(const RX__3GPP__Flow__Status& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void RX__3GPP__Flow__Status_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.RX_3GPP_Flow_Status."); } } void RX__3GPP__Flow__Status_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (RX__3GPP__Flow__Status::enum_type)text_buf.pull_int().get_val(); if (!RX__3GPP__Flow__Status::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.RX_3GPP_Flow_Status.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new RX__3GPP__Flow__Status_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.RX_3GPP_Flow_Status."); } } boolean RX__3GPP__Flow__Status_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean RX__3GPP__Flow__Status_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { RX__3GPP__Flow__Status_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { RX__3GPP__Flow__Status::enum_type enum_val = RX__3GPP__Flow__Status::str_to_enum(m_p->get_enumerated()); if (!RX__3GPP__Flow__Status::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.RX_3GPP_Flow_Status."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { RX__3GPP__Flow__Status_template* precondition = new RX__3GPP__Flow__Status_template; precondition->set_param(*m_p->get_elem(0)); RX__3GPP__Flow__Status_template* implied_template = new RX__3GPP__Flow__Status_template; implied_template->set_param(*m_p->get_elem(1)); *this = RX__3GPP__Flow__Status_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.RX_3GPP_Flow_Status"); } is_ifpresent = param.get_ifpresent(); } void RX__3GPP__Flow__Status_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.RX_3GPP_Flow_Status"); } DCC__NONE__CC__Unit__Type::DCC__NONE__CC__Unit__Type() { enum_value = UNBOUND_VALUE; } DCC__NONE__CC__Unit__Type::DCC__NONE__CC__Unit__Type(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.DCC_NONE_CC_Unit_Type with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } DCC__NONE__CC__Unit__Type::DCC__NONE__CC__Unit__Type(enum_type other_value) { enum_value = other_value; } DCC__NONE__CC__Unit__Type::DCC__NONE__CC__Unit__Type(const DCC__NONE__CC__Unit__Type& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_CC_Unit_Type."); enum_value = other_value.enum_value; } DCC__NONE__CC__Unit__Type& DCC__NONE__CC__Unit__Type::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.DCC_NONE_CC_Unit_Type.", other_value); enum_value = (enum_type)other_value; return *this; } DCC__NONE__CC__Unit__Type& DCC__NONE__CC__Unit__Type::operator=(enum_type other_value) { enum_value = other_value; return *this; } DCC__NONE__CC__Unit__Type& DCC__NONE__CC__Unit__Type::operator=(const DCC__NONE__CC__Unit__Type& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_CC_Unit_Type."); enum_value = other_value.enum_value; return *this; } boolean DCC__NONE__CC__Unit__Type::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_CC_Unit_Type."); return enum_value == other_value; } boolean DCC__NONE__CC__Unit__Type::operator==(const DCC__NONE__CC__Unit__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_CC_Unit_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_CC_Unit_Type."); return enum_value == other_value.enum_value; } boolean DCC__NONE__CC__Unit__Type::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_CC_Unit_Type."); return enum_value < other_value; } boolean DCC__NONE__CC__Unit__Type::operator<(const DCC__NONE__CC__Unit__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_CC_Unit_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_CC_Unit_Type."); return enum_value < other_value.enum_value; } boolean DCC__NONE__CC__Unit__Type::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_CC_Unit_Type."); return enum_value > other_value; } boolean DCC__NONE__CC__Unit__Type::operator>(const DCC__NONE__CC__Unit__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_CC_Unit_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_CC_Unit_Type."); return enum_value > other_value.enum_value; } const char *DCC__NONE__CC__Unit__Type::enum_to_str(enum_type enum_par) { switch (enum_par) { case TIME: return "TIME"; case MONEY: return "MONEY"; case TOTAL__OCTETS: return "TOTAL_OCTETS"; case INPUT__OCTETS: return "INPUT_OCTETS"; case OUTPUT__OCTETS: return "OUTPUT_OCTETS"; case SERVICE__SPECIFIC__UNITS: return "SERVICE_SPECIFIC_UNITS"; default: return ""; } } DCC__NONE__CC__Unit__Type::enum_type DCC__NONE__CC__Unit__Type::str_to_enum(const char *str_par) { if (!strcmp(str_par, "TIME")) return TIME; else if (!strcmp(str_par, "MONEY")) return MONEY; else if (!strcmp(str_par, "TOTAL_OCTETS")) return TOTAL__OCTETS; else if (!strcmp(str_par, "INPUT_OCTETS")) return INPUT__OCTETS; else if (!strcmp(str_par, "OUTPUT_OCTETS")) return OUTPUT__OCTETS; else if (!strcmp(str_par, "SERVICE_SPECIFIC_UNITS")) return SERVICE__SPECIFIC__UNITS; else return UNKNOWN_VALUE; } boolean DCC__NONE__CC__Unit__Type::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: case 2: case 3: case 4: case 5: return TRUE; default: return FALSE; } } int DCC__NONE__CC__Unit__Type::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCC_NONE_CC_Unit_Type.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int DCC__NONE__CC__Unit__Type::enum2int(const DCC__NONE__CC__Unit__Type& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCC_NONE_CC_Unit_Type.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void DCC__NONE__CC__Unit__Type::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.DCC_NONE_CC_Unit_Type.", int_val); enum_value = (enum_type)int_val; } DCC__NONE__CC__Unit__Type::operator DCC__NONE__CC__Unit__Type::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.DCC_NONE_CC_Unit_Type."); return enum_value; } void DCC__NONE__CC__Unit__Type::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void DCC__NONE__CC__Unit__Type::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.DCC_NONE_CC_Unit_Type"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCC_NONE_CC_Unit_Type."); } } void DCC__NONE__CC__Unit__Type::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_CC_Unit_Type."); text_buf.push_int(enum_value); } void DCC__NONE__CC__Unit__Type::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.DCC_NONE_CC_Unit_Type.", enum_value); } void DCC__NONE__CC__Unit__Type::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void DCC__NONE__CC__Unit__Type::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int DCC__NONE__CC__Unit__Type::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 3, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int DCC__NONE__CC__Unit__Type::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 3); } void DCC__NONE__CC__Unit__Type_template::copy_template(const DCC__NONE__CC__Unit__Type_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new DCC__NONE__CC__Unit__Type_template[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 DCC__NONE__CC__Unit__Type_template(*other_value.implication_.precondition); implication_.implied_template = new DCC__NONE__CC__Unit__Type_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCC_NONE_CC_Unit_Type."); } } DCC__NONE__CC__Unit__Type_template::DCC__NONE__CC__Unit__Type_template() { } DCC__NONE__CC__Unit__Type_template::DCC__NONE__CC__Unit__Type_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } DCC__NONE__CC__Unit__Type_template::DCC__NONE__CC__Unit__Type_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!DCC__NONE__CC__Unit__Type::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.DCC_NONE_CC_Unit_Type with unknown numeric value %d.", other_value); single_value = (DCC__NONE__CC__Unit__Type::enum_type)other_value; } DCC__NONE__CC__Unit__Type_template::DCC__NONE__CC__Unit__Type_template(DCC__NONE__CC__Unit__Type::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } DCC__NONE__CC__Unit__Type_template::DCC__NONE__CC__Unit__Type_template(const DCC__NONE__CC__Unit__Type& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == DCC__NONE__CC__Unit__Type::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_CC_Unit_Type."); single_value = other_value.enum_value; } DCC__NONE__CC__Unit__Type_template::DCC__NONE__CC__Unit__Type_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCC__NONE__CC__Unit__Type::enum_type)(const DCC__NONE__CC__Unit__Type&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.DCC_NONE_CC_Unit_Type from an unbound optional field."); } } DCC__NONE__CC__Unit__Type_template::DCC__NONE__CC__Unit__Type_template(DCC__NONE__CC__Unit__Type_template* p_precondition, DCC__NONE__CC__Unit__Type_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } DCC__NONE__CC__Unit__Type_template::DCC__NONE__CC__Unit__Type_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; } DCC__NONE__CC__Unit__Type_template::DCC__NONE__CC__Unit__Type_template(const DCC__NONE__CC__Unit__Type_template& other_value) : Base_Template() { copy_template(other_value); } DCC__NONE__CC__Unit__Type_template::~DCC__NONE__CC__Unit__Type_template() { clean_up(); } boolean DCC__NONE__CC__Unit__Type_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean DCC__NONE__CC__Unit__Type_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != DCC__NONE__CC__Unit__Type::UNBOUND_VALUE; } void DCC__NONE__CC__Unit__Type_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } DCC__NONE__CC__Unit__Type_template& DCC__NONE__CC__Unit__Type_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } DCC__NONE__CC__Unit__Type_template& DCC__NONE__CC__Unit__Type_template::operator=(int other_value) { if (!DCC__NONE__CC__Unit__Type::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.DCC_NONE_CC_Unit_Type.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (DCC__NONE__CC__Unit__Type::enum_type)other_value; return *this; } DCC__NONE__CC__Unit__Type_template& DCC__NONE__CC__Unit__Type_template::operator=(DCC__NONE__CC__Unit__Type::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } DCC__NONE__CC__Unit__Type_template& DCC__NONE__CC__Unit__Type_template::operator=(const DCC__NONE__CC__Unit__Type& other_value) { if (other_value.enum_value == DCC__NONE__CC__Unit__Type::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_CC_Unit_Type to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } DCC__NONE__CC__Unit__Type_template& DCC__NONE__CC__Unit__Type_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCC__NONE__CC__Unit__Type::enum_type)(const DCC__NONE__CC__Unit__Type&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.DCC_NONE_CC_Unit_Type."); } return *this; } DCC__NONE__CC__Unit__Type_template& DCC__NONE__CC__Unit__Type_template::operator=(const DCC__NONE__CC__Unit__Type_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean DCC__NONE__CC__Unit__Type_template::match(DCC__NONE__CC__Unit__Type::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCC_NONE_CC_Unit_Type."); } return FALSE; } boolean DCC__NONE__CC__Unit__Type_template::match(const DCC__NONE__CC__Unit__Type& other_value, boolean) const { if (other_value.enum_value == DCC__NONE__CC__Unit__Type::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.DCC_NONE_CC_Unit_Type with an unbound value."); return match(other_value.enum_value); } DCC__NONE__CC__Unit__Type::enum_type DCC__NONE__CC__Unit__Type_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.DCC_NONE_CC_Unit_Type."); return single_value; } void DCC__NONE__CC__Unit__Type_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.DCC_NONE_CC_Unit_Type."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new DCC__NONE__CC__Unit__Type_template[list_length]; } DCC__NONE__CC__Unit__Type_template& DCC__NONE__CC__Unit__Type_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.DCC_NONE_CC_Unit_Type."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.DCC_NONE_CC_Unit_Type."); return value_list.list_value[list_index]; } void DCC__NONE__CC__Unit__Type_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(DCC__NONE__CC__Unit__Type::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void DCC__NONE__CC__Unit__Type_template::log_match(const DCC__NONE__CC__Unit__Type& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void DCC__NONE__CC__Unit__Type_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCC_NONE_CC_Unit_Type."); } } void DCC__NONE__CC__Unit__Type_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (DCC__NONE__CC__Unit__Type::enum_type)text_buf.pull_int().get_val(); if (!DCC__NONE__CC__Unit__Type::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.DCC_NONE_CC_Unit_Type.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new DCC__NONE__CC__Unit__Type_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.DCC_NONE_CC_Unit_Type."); } } boolean DCC__NONE__CC__Unit__Type_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean DCC__NONE__CC__Unit__Type_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { DCC__NONE__CC__Unit__Type_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { DCC__NONE__CC__Unit__Type::enum_type enum_val = DCC__NONE__CC__Unit__Type::str_to_enum(m_p->get_enumerated()); if (!DCC__NONE__CC__Unit__Type::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCC_NONE_CC_Unit_Type."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { DCC__NONE__CC__Unit__Type_template* precondition = new DCC__NONE__CC__Unit__Type_template; precondition->set_param(*m_p->get_elem(0)); DCC__NONE__CC__Unit__Type_template* implied_template = new DCC__NONE__CC__Unit__Type_template; implied_template->set_param(*m_p->get_elem(1)); *this = DCC__NONE__CC__Unit__Type_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.DCC_NONE_CC_Unit_Type"); } is_ifpresent = param.get_ifpresent(); } void DCC__NONE__CC__Unit__Type_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.DCC_NONE_CC_Unit_Type"); } PCC__3GPP__QoS__Upgrade::PCC__3GPP__QoS__Upgrade() { enum_value = UNBOUND_VALUE; } PCC__3GPP__QoS__Upgrade::PCC__3GPP__QoS__Upgrade(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.PCC_3GPP_QoS_Upgrade with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } PCC__3GPP__QoS__Upgrade::PCC__3GPP__QoS__Upgrade(enum_type other_value) { enum_value = other_value; } PCC__3GPP__QoS__Upgrade::PCC__3GPP__QoS__Upgrade(const PCC__3GPP__QoS__Upgrade& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_QoS_Upgrade."); enum_value = other_value.enum_value; } PCC__3GPP__QoS__Upgrade& PCC__3GPP__QoS__Upgrade::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.PCC_3GPP_QoS_Upgrade.", other_value); enum_value = (enum_type)other_value; return *this; } PCC__3GPP__QoS__Upgrade& PCC__3GPP__QoS__Upgrade::operator=(enum_type other_value) { enum_value = other_value; return *this; } PCC__3GPP__QoS__Upgrade& PCC__3GPP__QoS__Upgrade::operator=(const PCC__3GPP__QoS__Upgrade& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_QoS_Upgrade."); enum_value = other_value.enum_value; return *this; } boolean PCC__3GPP__QoS__Upgrade::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_QoS_Upgrade."); return enum_value == other_value; } boolean PCC__3GPP__QoS__Upgrade::operator==(const PCC__3GPP__QoS__Upgrade& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_QoS_Upgrade."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_QoS_Upgrade."); return enum_value == other_value.enum_value; } boolean PCC__3GPP__QoS__Upgrade::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_QoS_Upgrade."); return enum_value < other_value; } boolean PCC__3GPP__QoS__Upgrade::operator<(const PCC__3GPP__QoS__Upgrade& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_QoS_Upgrade."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_QoS_Upgrade."); return enum_value < other_value.enum_value; } boolean PCC__3GPP__QoS__Upgrade::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_QoS_Upgrade."); return enum_value > other_value; } boolean PCC__3GPP__QoS__Upgrade::operator>(const PCC__3GPP__QoS__Upgrade& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_QoS_Upgrade."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_QoS_Upgrade."); return enum_value > other_value.enum_value; } const char *PCC__3GPP__QoS__Upgrade::enum_to_str(enum_type enum_par) { switch (enum_par) { case QoS__UPGRADE__NOT__SUPPORTED: return "QoS_UPGRADE_NOT_SUPPORTED"; case QoS__UPGRADE__SUPPORTED: return "QoS_UPGRADE_SUPPORTED"; default: return ""; } } PCC__3GPP__QoS__Upgrade::enum_type PCC__3GPP__QoS__Upgrade::str_to_enum(const char *str_par) { if (!strcmp(str_par, "QoS_UPGRADE_NOT_SUPPORTED")) return QoS__UPGRADE__NOT__SUPPORTED; else if (!strcmp(str_par, "QoS_UPGRADE_SUPPORTED")) return QoS__UPGRADE__SUPPORTED; else return UNKNOWN_VALUE; } boolean PCC__3GPP__QoS__Upgrade::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: return TRUE; default: return FALSE; } } int PCC__3GPP__QoS__Upgrade::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.PCC_3GPP_QoS_Upgrade.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int PCC__3GPP__QoS__Upgrade::enum2int(const PCC__3GPP__QoS__Upgrade& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.PCC_3GPP_QoS_Upgrade.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void PCC__3GPP__QoS__Upgrade::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.PCC_3GPP_QoS_Upgrade.", int_val); enum_value = (enum_type)int_val; } PCC__3GPP__QoS__Upgrade::operator PCC__3GPP__QoS__Upgrade::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.PCC_3GPP_QoS_Upgrade."); return enum_value; } void PCC__3GPP__QoS__Upgrade::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void PCC__3GPP__QoS__Upgrade::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.PCC_3GPP_QoS_Upgrade"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.PCC_3GPP_QoS_Upgrade."); } } void PCC__3GPP__QoS__Upgrade::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_QoS_Upgrade."); text_buf.push_int(enum_value); } void PCC__3GPP__QoS__Upgrade::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.PCC_3GPP_QoS_Upgrade.", enum_value); } void PCC__3GPP__QoS__Upgrade::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void PCC__3GPP__QoS__Upgrade::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int PCC__3GPP__QoS__Upgrade::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int PCC__3GPP__QoS__Upgrade::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void PCC__3GPP__QoS__Upgrade_template::copy_template(const PCC__3GPP__QoS__Upgrade_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new PCC__3GPP__QoS__Upgrade_template[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 PCC__3GPP__QoS__Upgrade_template(*other_value.implication_.precondition); implication_.implied_template = new PCC__3GPP__QoS__Upgrade_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.PCC_3GPP_QoS_Upgrade."); } } PCC__3GPP__QoS__Upgrade_template::PCC__3GPP__QoS__Upgrade_template() { } PCC__3GPP__QoS__Upgrade_template::PCC__3GPP__QoS__Upgrade_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } PCC__3GPP__QoS__Upgrade_template::PCC__3GPP__QoS__Upgrade_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!PCC__3GPP__QoS__Upgrade::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.PCC_3GPP_QoS_Upgrade with unknown numeric value %d.", other_value); single_value = (PCC__3GPP__QoS__Upgrade::enum_type)other_value; } PCC__3GPP__QoS__Upgrade_template::PCC__3GPP__QoS__Upgrade_template(PCC__3GPP__QoS__Upgrade::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } PCC__3GPP__QoS__Upgrade_template::PCC__3GPP__QoS__Upgrade_template(const PCC__3GPP__QoS__Upgrade& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == PCC__3GPP__QoS__Upgrade::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_QoS_Upgrade."); single_value = other_value.enum_value; } PCC__3GPP__QoS__Upgrade_template::PCC__3GPP__QoS__Upgrade_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (PCC__3GPP__QoS__Upgrade::enum_type)(const PCC__3GPP__QoS__Upgrade&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.PCC_3GPP_QoS_Upgrade from an unbound optional field."); } } PCC__3GPP__QoS__Upgrade_template::PCC__3GPP__QoS__Upgrade_template(PCC__3GPP__QoS__Upgrade_template* p_precondition, PCC__3GPP__QoS__Upgrade_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } PCC__3GPP__QoS__Upgrade_template::PCC__3GPP__QoS__Upgrade_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; } PCC__3GPP__QoS__Upgrade_template::PCC__3GPP__QoS__Upgrade_template(const PCC__3GPP__QoS__Upgrade_template& other_value) : Base_Template() { copy_template(other_value); } PCC__3GPP__QoS__Upgrade_template::~PCC__3GPP__QoS__Upgrade_template() { clean_up(); } boolean PCC__3GPP__QoS__Upgrade_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean PCC__3GPP__QoS__Upgrade_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != PCC__3GPP__QoS__Upgrade::UNBOUND_VALUE; } void PCC__3GPP__QoS__Upgrade_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } PCC__3GPP__QoS__Upgrade_template& PCC__3GPP__QoS__Upgrade_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } PCC__3GPP__QoS__Upgrade_template& PCC__3GPP__QoS__Upgrade_template::operator=(int other_value) { if (!PCC__3GPP__QoS__Upgrade::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.PCC_3GPP_QoS_Upgrade.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (PCC__3GPP__QoS__Upgrade::enum_type)other_value; return *this; } PCC__3GPP__QoS__Upgrade_template& PCC__3GPP__QoS__Upgrade_template::operator=(PCC__3GPP__QoS__Upgrade::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } PCC__3GPP__QoS__Upgrade_template& PCC__3GPP__QoS__Upgrade_template::operator=(const PCC__3GPP__QoS__Upgrade& other_value) { if (other_value.enum_value == PCC__3GPP__QoS__Upgrade::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_QoS_Upgrade to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } PCC__3GPP__QoS__Upgrade_template& PCC__3GPP__QoS__Upgrade_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (PCC__3GPP__QoS__Upgrade::enum_type)(const PCC__3GPP__QoS__Upgrade&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.PCC_3GPP_QoS_Upgrade."); } return *this; } PCC__3GPP__QoS__Upgrade_template& PCC__3GPP__QoS__Upgrade_template::operator=(const PCC__3GPP__QoS__Upgrade_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean PCC__3GPP__QoS__Upgrade_template::match(PCC__3GPP__QoS__Upgrade::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.PCC_3GPP_QoS_Upgrade."); } return FALSE; } boolean PCC__3GPP__QoS__Upgrade_template::match(const PCC__3GPP__QoS__Upgrade& other_value, boolean) const { if (other_value.enum_value == PCC__3GPP__QoS__Upgrade::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.PCC_3GPP_QoS_Upgrade with an unbound value."); return match(other_value.enum_value); } PCC__3GPP__QoS__Upgrade::enum_type PCC__3GPP__QoS__Upgrade_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.PCC_3GPP_QoS_Upgrade."); return single_value; } void PCC__3GPP__QoS__Upgrade_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.PCC_3GPP_QoS_Upgrade."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new PCC__3GPP__QoS__Upgrade_template[list_length]; } PCC__3GPP__QoS__Upgrade_template& PCC__3GPP__QoS__Upgrade_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.PCC_3GPP_QoS_Upgrade."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.PCC_3GPP_QoS_Upgrade."); return value_list.list_value[list_index]; } void PCC__3GPP__QoS__Upgrade_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(PCC__3GPP__QoS__Upgrade::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void PCC__3GPP__QoS__Upgrade_template::log_match(const PCC__3GPP__QoS__Upgrade& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void PCC__3GPP__QoS__Upgrade_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.PCC_3GPP_QoS_Upgrade."); } } void PCC__3GPP__QoS__Upgrade_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (PCC__3GPP__QoS__Upgrade::enum_type)text_buf.pull_int().get_val(); if (!PCC__3GPP__QoS__Upgrade::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.PCC_3GPP_QoS_Upgrade.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new PCC__3GPP__QoS__Upgrade_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.PCC_3GPP_QoS_Upgrade."); } } boolean PCC__3GPP__QoS__Upgrade_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean PCC__3GPP__QoS__Upgrade_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { PCC__3GPP__QoS__Upgrade_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { PCC__3GPP__QoS__Upgrade::enum_type enum_val = PCC__3GPP__QoS__Upgrade::str_to_enum(m_p->get_enumerated()); if (!PCC__3GPP__QoS__Upgrade::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.PCC_3GPP_QoS_Upgrade."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { PCC__3GPP__QoS__Upgrade_template* precondition = new PCC__3GPP__QoS__Upgrade_template; precondition->set_param(*m_p->get_elem(0)); PCC__3GPP__QoS__Upgrade_template* implied_template = new PCC__3GPP__QoS__Upgrade_template; implied_template->set_param(*m_p->get_elem(1)); *this = PCC__3GPP__QoS__Upgrade_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.PCC_3GPP_QoS_Upgrade"); } is_ifpresent = param.get_ifpresent(); } void PCC__3GPP__QoS__Upgrade_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.PCC_3GPP_QoS_Upgrade"); } DCA__3GPP__PS__Append__Free__Format__Data::DCA__3GPP__PS__Append__Free__Format__Data() { enum_value = UNBOUND_VALUE; } DCA__3GPP__PS__Append__Free__Format__Data::DCA__3GPP__PS__Append__Free__Format__Data(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.DCA_3GPP_PS_Append_Free_Format_Data with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } DCA__3GPP__PS__Append__Free__Format__Data::DCA__3GPP__PS__Append__Free__Format__Data(enum_type other_value) { enum_value = other_value; } DCA__3GPP__PS__Append__Free__Format__Data::DCA__3GPP__PS__Append__Free__Format__Data(const DCA__3GPP__PS__Append__Free__Format__Data& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_PS_Append_Free_Format_Data."); enum_value = other_value.enum_value; } DCA__3GPP__PS__Append__Free__Format__Data& DCA__3GPP__PS__Append__Free__Format__Data::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_PS_Append_Free_Format_Data.", other_value); enum_value = (enum_type)other_value; return *this; } DCA__3GPP__PS__Append__Free__Format__Data& DCA__3GPP__PS__Append__Free__Format__Data::operator=(enum_type other_value) { enum_value = other_value; return *this; } DCA__3GPP__PS__Append__Free__Format__Data& DCA__3GPP__PS__Append__Free__Format__Data::operator=(const DCA__3GPP__PS__Append__Free__Format__Data& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_PS_Append_Free_Format_Data."); enum_value = other_value.enum_value; return *this; } boolean DCA__3GPP__PS__Append__Free__Format__Data::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_PS_Append_Free_Format_Data."); return enum_value == other_value; } boolean DCA__3GPP__PS__Append__Free__Format__Data::operator==(const DCA__3GPP__PS__Append__Free__Format__Data& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_PS_Append_Free_Format_Data."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_PS_Append_Free_Format_Data."); return enum_value == other_value.enum_value; } boolean DCA__3GPP__PS__Append__Free__Format__Data::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_PS_Append_Free_Format_Data."); return enum_value < other_value; } boolean DCA__3GPP__PS__Append__Free__Format__Data::operator<(const DCA__3GPP__PS__Append__Free__Format__Data& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_PS_Append_Free_Format_Data."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_PS_Append_Free_Format_Data."); return enum_value < other_value.enum_value; } boolean DCA__3GPP__PS__Append__Free__Format__Data::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_PS_Append_Free_Format_Data."); return enum_value > other_value; } boolean DCA__3GPP__PS__Append__Free__Format__Data::operator>(const DCA__3GPP__PS__Append__Free__Format__Data& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_PS_Append_Free_Format_Data."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_PS_Append_Free_Format_Data."); return enum_value > other_value.enum_value; } const char *DCA__3GPP__PS__Append__Free__Format__Data::enum_to_str(enum_type enum_par) { switch (enum_par) { case APPEND: return "APPEND"; case OVERWRITE: return "OVERWRITE"; default: return ""; } } DCA__3GPP__PS__Append__Free__Format__Data::enum_type DCA__3GPP__PS__Append__Free__Format__Data::str_to_enum(const char *str_par) { if (!strcmp(str_par, "APPEND")) return APPEND; else if (!strcmp(str_par, "OVERWRITE")) return OVERWRITE; else return UNKNOWN_VALUE; } boolean DCA__3GPP__PS__Append__Free__Format__Data::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: return TRUE; default: return FALSE; } } int DCA__3GPP__PS__Append__Free__Format__Data::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_PS_Append_Free_Format_Data.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int DCA__3GPP__PS__Append__Free__Format__Data::enum2int(const DCA__3GPP__PS__Append__Free__Format__Data& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_PS_Append_Free_Format_Data.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void DCA__3GPP__PS__Append__Free__Format__Data::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_PS_Append_Free_Format_Data.", int_val); enum_value = (enum_type)int_val; } DCA__3GPP__PS__Append__Free__Format__Data::operator DCA__3GPP__PS__Append__Free__Format__Data::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.DCA_3GPP_PS_Append_Free_Format_Data."); return enum_value; } void DCA__3GPP__PS__Append__Free__Format__Data::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void DCA__3GPP__PS__Append__Free__Format__Data::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.DCA_3GPP_PS_Append_Free_Format_Data"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_PS_Append_Free_Format_Data."); } } void DCA__3GPP__PS__Append__Free__Format__Data::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_PS_Append_Free_Format_Data."); text_buf.push_int(enum_value); } void DCA__3GPP__PS__Append__Free__Format__Data::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.DCA_3GPP_PS_Append_Free_Format_Data.", enum_value); } void DCA__3GPP__PS__Append__Free__Format__Data::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void DCA__3GPP__PS__Append__Free__Format__Data::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int DCA__3GPP__PS__Append__Free__Format__Data::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int DCA__3GPP__PS__Append__Free__Format__Data::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void DCA__3GPP__PS__Append__Free__Format__Data_template::copy_template(const DCA__3GPP__PS__Append__Free__Format__Data_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new DCA__3GPP__PS__Append__Free__Format__Data_template[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 DCA__3GPP__PS__Append__Free__Format__Data_template(*other_value.implication_.precondition); implication_.implied_template = new DCA__3GPP__PS__Append__Free__Format__Data_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_PS_Append_Free_Format_Data."); } } DCA__3GPP__PS__Append__Free__Format__Data_template::DCA__3GPP__PS__Append__Free__Format__Data_template() { } DCA__3GPP__PS__Append__Free__Format__Data_template::DCA__3GPP__PS__Append__Free__Format__Data_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } DCA__3GPP__PS__Append__Free__Format__Data_template::DCA__3GPP__PS__Append__Free__Format__Data_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!DCA__3GPP__PS__Append__Free__Format__Data::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.DCA_3GPP_PS_Append_Free_Format_Data with unknown numeric value %d.", other_value); single_value = (DCA__3GPP__PS__Append__Free__Format__Data::enum_type)other_value; } DCA__3GPP__PS__Append__Free__Format__Data_template::DCA__3GPP__PS__Append__Free__Format__Data_template(DCA__3GPP__PS__Append__Free__Format__Data::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } DCA__3GPP__PS__Append__Free__Format__Data_template::DCA__3GPP__PS__Append__Free__Format__Data_template(const DCA__3GPP__PS__Append__Free__Format__Data& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == DCA__3GPP__PS__Append__Free__Format__Data::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_PS_Append_Free_Format_Data."); single_value = other_value.enum_value; } DCA__3GPP__PS__Append__Free__Format__Data_template::DCA__3GPP__PS__Append__Free__Format__Data_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__PS__Append__Free__Format__Data::enum_type)(const DCA__3GPP__PS__Append__Free__Format__Data&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.DCA_3GPP_PS_Append_Free_Format_Data from an unbound optional field."); } } DCA__3GPP__PS__Append__Free__Format__Data_template::DCA__3GPP__PS__Append__Free__Format__Data_template(DCA__3GPP__PS__Append__Free__Format__Data_template* p_precondition, DCA__3GPP__PS__Append__Free__Format__Data_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } DCA__3GPP__PS__Append__Free__Format__Data_template::DCA__3GPP__PS__Append__Free__Format__Data_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; } DCA__3GPP__PS__Append__Free__Format__Data_template::DCA__3GPP__PS__Append__Free__Format__Data_template(const DCA__3GPP__PS__Append__Free__Format__Data_template& other_value) : Base_Template() { copy_template(other_value); } DCA__3GPP__PS__Append__Free__Format__Data_template::~DCA__3GPP__PS__Append__Free__Format__Data_template() { clean_up(); } boolean DCA__3GPP__PS__Append__Free__Format__Data_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean DCA__3GPP__PS__Append__Free__Format__Data_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != DCA__3GPP__PS__Append__Free__Format__Data::UNBOUND_VALUE; } void DCA__3GPP__PS__Append__Free__Format__Data_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } DCA__3GPP__PS__Append__Free__Format__Data_template& DCA__3GPP__PS__Append__Free__Format__Data_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } DCA__3GPP__PS__Append__Free__Format__Data_template& DCA__3GPP__PS__Append__Free__Format__Data_template::operator=(int other_value) { if (!DCA__3GPP__PS__Append__Free__Format__Data::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.DCA_3GPP_PS_Append_Free_Format_Data.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__PS__Append__Free__Format__Data::enum_type)other_value; return *this; } DCA__3GPP__PS__Append__Free__Format__Data_template& DCA__3GPP__PS__Append__Free__Format__Data_template::operator=(DCA__3GPP__PS__Append__Free__Format__Data::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } DCA__3GPP__PS__Append__Free__Format__Data_template& DCA__3GPP__PS__Append__Free__Format__Data_template::operator=(const DCA__3GPP__PS__Append__Free__Format__Data& other_value) { if (other_value.enum_value == DCA__3GPP__PS__Append__Free__Format__Data::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_PS_Append_Free_Format_Data to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } DCA__3GPP__PS__Append__Free__Format__Data_template& DCA__3GPP__PS__Append__Free__Format__Data_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__PS__Append__Free__Format__Data::enum_type)(const DCA__3GPP__PS__Append__Free__Format__Data&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.DCA_3GPP_PS_Append_Free_Format_Data."); } return *this; } DCA__3GPP__PS__Append__Free__Format__Data_template& DCA__3GPP__PS__Append__Free__Format__Data_template::operator=(const DCA__3GPP__PS__Append__Free__Format__Data_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean DCA__3GPP__PS__Append__Free__Format__Data_template::match(DCA__3GPP__PS__Append__Free__Format__Data::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_PS_Append_Free_Format_Data."); } return FALSE; } boolean DCA__3GPP__PS__Append__Free__Format__Data_template::match(const DCA__3GPP__PS__Append__Free__Format__Data& other_value, boolean) const { if (other_value.enum_value == DCA__3GPP__PS__Append__Free__Format__Data::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.DCA_3GPP_PS_Append_Free_Format_Data with an unbound value."); return match(other_value.enum_value); } DCA__3GPP__PS__Append__Free__Format__Data::enum_type DCA__3GPP__PS__Append__Free__Format__Data_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.DCA_3GPP_PS_Append_Free_Format_Data."); return single_value; } void DCA__3GPP__PS__Append__Free__Format__Data_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.DCA_3GPP_PS_Append_Free_Format_Data."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new DCA__3GPP__PS__Append__Free__Format__Data_template[list_length]; } DCA__3GPP__PS__Append__Free__Format__Data_template& DCA__3GPP__PS__Append__Free__Format__Data_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.DCA_3GPP_PS_Append_Free_Format_Data."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.DCA_3GPP_PS_Append_Free_Format_Data."); return value_list.list_value[list_index]; } void DCA__3GPP__PS__Append__Free__Format__Data_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(DCA__3GPP__PS__Append__Free__Format__Data::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void DCA__3GPP__PS__Append__Free__Format__Data_template::log_match(const DCA__3GPP__PS__Append__Free__Format__Data& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void DCA__3GPP__PS__Append__Free__Format__Data_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_PS_Append_Free_Format_Data."); } } void DCA__3GPP__PS__Append__Free__Format__Data_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (DCA__3GPP__PS__Append__Free__Format__Data::enum_type)text_buf.pull_int().get_val(); if (!DCA__3GPP__PS__Append__Free__Format__Data::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_PS_Append_Free_Format_Data.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new DCA__3GPP__PS__Append__Free__Format__Data_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_PS_Append_Free_Format_Data."); } } boolean DCA__3GPP__PS__Append__Free__Format__Data_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean DCA__3GPP__PS__Append__Free__Format__Data_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { DCA__3GPP__PS__Append__Free__Format__Data_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { DCA__3GPP__PS__Append__Free__Format__Data::enum_type enum_val = DCA__3GPP__PS__Append__Free__Format__Data::str_to_enum(m_p->get_enumerated()); if (!DCA__3GPP__PS__Append__Free__Format__Data::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_PS_Append_Free_Format_Data."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { DCA__3GPP__PS__Append__Free__Format__Data_template* precondition = new DCA__3GPP__PS__Append__Free__Format__Data_template; precondition->set_param(*m_p->get_elem(0)); DCA__3GPP__PS__Append__Free__Format__Data_template* implied_template = new DCA__3GPP__PS__Append__Free__Format__Data_template; implied_template->set_param(*m_p->get_elem(1)); *this = DCA__3GPP__PS__Append__Free__Format__Data_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.DCA_3GPP_PS_Append_Free_Format_Data"); } is_ifpresent = param.get_ifpresent(); } void DCA__3GPP__PS__Append__Free__Format__Data_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.DCA_3GPP_PS_Append_Free_Format_Data"); } PCC__3GPP__AN__GW__Status::PCC__3GPP__AN__GW__Status() { enum_value = UNBOUND_VALUE; } PCC__3GPP__AN__GW__Status::PCC__3GPP__AN__GW__Status(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.PCC_3GPP_AN_GW_Status with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } PCC__3GPP__AN__GW__Status::PCC__3GPP__AN__GW__Status(enum_type other_value) { enum_value = other_value; } PCC__3GPP__AN__GW__Status::PCC__3GPP__AN__GW__Status(const PCC__3GPP__AN__GW__Status& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_AN_GW_Status."); enum_value = other_value.enum_value; } PCC__3GPP__AN__GW__Status& PCC__3GPP__AN__GW__Status::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.PCC_3GPP_AN_GW_Status.", other_value); enum_value = (enum_type)other_value; return *this; } PCC__3GPP__AN__GW__Status& PCC__3GPP__AN__GW__Status::operator=(enum_type other_value) { enum_value = other_value; return *this; } PCC__3GPP__AN__GW__Status& PCC__3GPP__AN__GW__Status::operator=(const PCC__3GPP__AN__GW__Status& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_AN_GW_Status."); enum_value = other_value.enum_value; return *this; } boolean PCC__3GPP__AN__GW__Status::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_AN_GW_Status."); return enum_value == other_value; } boolean PCC__3GPP__AN__GW__Status::operator==(const PCC__3GPP__AN__GW__Status& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_AN_GW_Status."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_AN_GW_Status."); return enum_value == other_value.enum_value; } boolean PCC__3GPP__AN__GW__Status::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_AN_GW_Status."); return enum_value < other_value; } boolean PCC__3GPP__AN__GW__Status::operator<(const PCC__3GPP__AN__GW__Status& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_AN_GW_Status."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_AN_GW_Status."); return enum_value < other_value.enum_value; } boolean PCC__3GPP__AN__GW__Status::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_AN_GW_Status."); return enum_value > other_value; } boolean PCC__3GPP__AN__GW__Status::operator>(const PCC__3GPP__AN__GW__Status& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_AN_GW_Status."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_AN_GW_Status."); return enum_value > other_value.enum_value; } const char *PCC__3GPP__AN__GW__Status::enum_to_str(enum_type enum_par) { switch (enum_par) { case AN__GW__FAILED: return "AN_GW_FAILED"; default: return ""; } } PCC__3GPP__AN__GW__Status::enum_type PCC__3GPP__AN__GW__Status::str_to_enum(const char *str_par) { if (!strcmp(str_par, "AN_GW_FAILED")) return AN__GW__FAILED; else return UNKNOWN_VALUE; } boolean PCC__3GPP__AN__GW__Status::is_valid_enum(int int_par) { switch (int_par) { case 0: return TRUE; default: return FALSE; } } int PCC__3GPP__AN__GW__Status::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.PCC_3GPP_AN_GW_Status.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int PCC__3GPP__AN__GW__Status::enum2int(const PCC__3GPP__AN__GW__Status& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.PCC_3GPP_AN_GW_Status.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void PCC__3GPP__AN__GW__Status::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.PCC_3GPP_AN_GW_Status.", int_val); enum_value = (enum_type)int_val; } PCC__3GPP__AN__GW__Status::operator PCC__3GPP__AN__GW__Status::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.PCC_3GPP_AN_GW_Status."); return enum_value; } void PCC__3GPP__AN__GW__Status::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void PCC__3GPP__AN__GW__Status::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.PCC_3GPP_AN_GW_Status"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.PCC_3GPP_AN_GW_Status."); } } void PCC__3GPP__AN__GW__Status::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_AN_GW_Status."); text_buf.push_int(enum_value); } void PCC__3GPP__AN__GW__Status::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.PCC_3GPP_AN_GW_Status.", enum_value); } void PCC__3GPP__AN__GW__Status::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void PCC__3GPP__AN__GW__Status::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int PCC__3GPP__AN__GW__Status::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 1, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int PCC__3GPP__AN__GW__Status::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 1); } void PCC__3GPP__AN__GW__Status_template::copy_template(const PCC__3GPP__AN__GW__Status_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new PCC__3GPP__AN__GW__Status_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].copy_template(other_value.value_list.list_value[list_count]); break; case IMPLICATION_MATCH: implication_.precondition = new PCC__3GPP__AN__GW__Status_template(*other_value.implication_.precondition); implication_.implied_template = new PCC__3GPP__AN__GW__Status_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.PCC_3GPP_AN_GW_Status."); } } PCC__3GPP__AN__GW__Status_template::PCC__3GPP__AN__GW__Status_template() { } PCC__3GPP__AN__GW__Status_template::PCC__3GPP__AN__GW__Status_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } PCC__3GPP__AN__GW__Status_template::PCC__3GPP__AN__GW__Status_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!PCC__3GPP__AN__GW__Status::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.PCC_3GPP_AN_GW_Status with unknown numeric value %d.", other_value); single_value = (PCC__3GPP__AN__GW__Status::enum_type)other_value; } PCC__3GPP__AN__GW__Status_template::PCC__3GPP__AN__GW__Status_template(PCC__3GPP__AN__GW__Status::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } PCC__3GPP__AN__GW__Status_template::PCC__3GPP__AN__GW__Status_template(const PCC__3GPP__AN__GW__Status& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == PCC__3GPP__AN__GW__Status::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_AN_GW_Status."); single_value = other_value.enum_value; } PCC__3GPP__AN__GW__Status_template::PCC__3GPP__AN__GW__Status_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (PCC__3GPP__AN__GW__Status::enum_type)(const PCC__3GPP__AN__GW__Status&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.PCC_3GPP_AN_GW_Status from an unbound optional field."); } } PCC__3GPP__AN__GW__Status_template::PCC__3GPP__AN__GW__Status_template(PCC__3GPP__AN__GW__Status_template* p_precondition, PCC__3GPP__AN__GW__Status_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } PCC__3GPP__AN__GW__Status_template::PCC__3GPP__AN__GW__Status_template(Dynamic_Match_Interface* p_dyn_match) : Base_Template(DYNAMIC_MATCH) { dyn_match = new dynmatch_struct; dyn_match->ptr = p_dyn_match; dyn_match->ref_count = 1; } PCC__3GPP__AN__GW__Status_template::PCC__3GPP__AN__GW__Status_template(const PCC__3GPP__AN__GW__Status_template& other_value) : Base_Template() { copy_template(other_value); } PCC__3GPP__AN__GW__Status_template::~PCC__3GPP__AN__GW__Status_template() { clean_up(); } boolean PCC__3GPP__AN__GW__Status_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean PCC__3GPP__AN__GW__Status_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != PCC__3GPP__AN__GW__Status::UNBOUND_VALUE; } void PCC__3GPP__AN__GW__Status_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } PCC__3GPP__AN__GW__Status_template& PCC__3GPP__AN__GW__Status_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } PCC__3GPP__AN__GW__Status_template& PCC__3GPP__AN__GW__Status_template::operator=(int other_value) { if (!PCC__3GPP__AN__GW__Status::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.PCC_3GPP_AN_GW_Status.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (PCC__3GPP__AN__GW__Status::enum_type)other_value; return *this; } PCC__3GPP__AN__GW__Status_template& PCC__3GPP__AN__GW__Status_template::operator=(PCC__3GPP__AN__GW__Status::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } PCC__3GPP__AN__GW__Status_template& PCC__3GPP__AN__GW__Status_template::operator=(const PCC__3GPP__AN__GW__Status& other_value) { if (other_value.enum_value == PCC__3GPP__AN__GW__Status::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_AN_GW_Status to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } PCC__3GPP__AN__GW__Status_template& PCC__3GPP__AN__GW__Status_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (PCC__3GPP__AN__GW__Status::enum_type)(const PCC__3GPP__AN__GW__Status&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.PCC_3GPP_AN_GW_Status."); } return *this; } PCC__3GPP__AN__GW__Status_template& PCC__3GPP__AN__GW__Status_template::operator=(const PCC__3GPP__AN__GW__Status_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean PCC__3GPP__AN__GW__Status_template::match(PCC__3GPP__AN__GW__Status::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.PCC_3GPP_AN_GW_Status."); } return FALSE; } boolean PCC__3GPP__AN__GW__Status_template::match(const PCC__3GPP__AN__GW__Status& other_value, boolean) const { if (other_value.enum_value == PCC__3GPP__AN__GW__Status::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.PCC_3GPP_AN_GW_Status with an unbound value."); return match(other_value.enum_value); } PCC__3GPP__AN__GW__Status::enum_type PCC__3GPP__AN__GW__Status_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.PCC_3GPP_AN_GW_Status."); return single_value; } void PCC__3GPP__AN__GW__Status_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.PCC_3GPP_AN_GW_Status."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new PCC__3GPP__AN__GW__Status_template[list_length]; } PCC__3GPP__AN__GW__Status_template& PCC__3GPP__AN__GW__Status_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.PCC_3GPP_AN_GW_Status."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.PCC_3GPP_AN_GW_Status."); return value_list.list_value[list_index]; } void PCC__3GPP__AN__GW__Status_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(PCC__3GPP__AN__GW__Status::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void PCC__3GPP__AN__GW__Status_template::log_match(const PCC__3GPP__AN__GW__Status& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void PCC__3GPP__AN__GW__Status_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.PCC_3GPP_AN_GW_Status."); } } void PCC__3GPP__AN__GW__Status_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (PCC__3GPP__AN__GW__Status::enum_type)text_buf.pull_int().get_val(); if (!PCC__3GPP__AN__GW__Status::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.PCC_3GPP_AN_GW_Status.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new PCC__3GPP__AN__GW__Status_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.PCC_3GPP_AN_GW_Status."); } } boolean PCC__3GPP__AN__GW__Status_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean PCC__3GPP__AN__GW__Status_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { PCC__3GPP__AN__GW__Status_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { PCC__3GPP__AN__GW__Status::enum_type enum_val = PCC__3GPP__AN__GW__Status::str_to_enum(m_p->get_enumerated()); if (!PCC__3GPP__AN__GW__Status::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.PCC_3GPP_AN_GW_Status."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { PCC__3GPP__AN__GW__Status_template* precondition = new PCC__3GPP__AN__GW__Status_template; precondition->set_param(*m_p->get_elem(0)); PCC__3GPP__AN__GW__Status_template* implied_template = new PCC__3GPP__AN__GW__Status_template; implied_template->set_param(*m_p->get_elem(1)); *this = PCC__3GPP__AN__GW__Status_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.PCC_3GPP_AN_GW_Status"); } is_ifpresent = param.get_ifpresent(); } void PCC__3GPP__AN__GW__Status_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.PCC_3GPP_AN_GW_Status"); } AAA__3GPP__Measurement__Period__UMTS::AAA__3GPP__Measurement__Period__UMTS() { enum_value = UNBOUND_VALUE; } AAA__3GPP__Measurement__Period__UMTS::AAA__3GPP__Measurement__Period__UMTS(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.AAA_3GPP_Measurement_Period_UMTS with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } AAA__3GPP__Measurement__Period__UMTS::AAA__3GPP__Measurement__Period__UMTS(enum_type other_value) { enum_value = other_value; } AAA__3GPP__Measurement__Period__UMTS::AAA__3GPP__Measurement__Period__UMTS(const AAA__3GPP__Measurement__Period__UMTS& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Measurement_Period_UMTS."); enum_value = other_value.enum_value; } AAA__3GPP__Measurement__Period__UMTS& AAA__3GPP__Measurement__Period__UMTS::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.AAA_3GPP_Measurement_Period_UMTS.", other_value); enum_value = (enum_type)other_value; return *this; } AAA__3GPP__Measurement__Period__UMTS& AAA__3GPP__Measurement__Period__UMTS::operator=(enum_type other_value) { enum_value = other_value; return *this; } AAA__3GPP__Measurement__Period__UMTS& AAA__3GPP__Measurement__Period__UMTS::operator=(const AAA__3GPP__Measurement__Period__UMTS& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Measurement_Period_UMTS."); enum_value = other_value.enum_value; return *this; } boolean AAA__3GPP__Measurement__Period__UMTS::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Measurement_Period_UMTS."); return enum_value == other_value; } boolean AAA__3GPP__Measurement__Period__UMTS::operator==(const AAA__3GPP__Measurement__Period__UMTS& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Measurement_Period_UMTS."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Measurement_Period_UMTS."); return enum_value == other_value.enum_value; } boolean AAA__3GPP__Measurement__Period__UMTS::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Measurement_Period_UMTS."); return enum_value < other_value; } boolean AAA__3GPP__Measurement__Period__UMTS::operator<(const AAA__3GPP__Measurement__Period__UMTS& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Measurement_Period_UMTS."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Measurement_Period_UMTS."); return enum_value < other_value.enum_value; } boolean AAA__3GPP__Measurement__Period__UMTS::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Measurement_Period_UMTS."); return enum_value > other_value; } boolean AAA__3GPP__Measurement__Period__UMTS::operator>(const AAA__3GPP__Measurement__Period__UMTS& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Measurement_Period_UMTS."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Measurement_Period_UMTS."); return enum_value > other_value.enum_value; } const char *AAA__3GPP__Measurement__Period__UMTS::enum_to_str(enum_type enum_par) { switch (enum_par) { case PERIOD__250__ms: return "PERIOD_250_ms"; case PERIOD__500__ms: return "PERIOD_500_ms"; case PERIOD__1000__ms: return "PERIOD_1000_ms"; case PERIOD__2000__ms: return "PERIOD_2000_ms"; case PERIOD__3000__ms: return "PERIOD_3000_ms"; case PERIOD__4000__ms: return "PERIOD_4000_ms"; case PERIOD__6000__ms: return "PERIOD_6000_ms"; case PERIOD__8000__ms: return "PERIOD_8000_ms"; case PERIOD__12000__ms: return "PERIOD_12000_ms"; case PERIOD__16000__ms: return "PERIOD_16000_ms"; case PERIOD__20000__ms: return "PERIOD_20000_ms"; case PERIOD__24000__ms: return "PERIOD_24000_ms"; case PERIOD__28000__ms: return "PERIOD_28000_ms"; case PERIOD__32000__ms: return "PERIOD_32000_ms"; case PERIOD__64000__ms: return "PERIOD_64000_ms"; default: return ""; } } AAA__3GPP__Measurement__Period__UMTS::enum_type AAA__3GPP__Measurement__Period__UMTS::str_to_enum(const char *str_par) { if (!strcmp(str_par, "PERIOD_250_ms")) return PERIOD__250__ms; else if (!strcmp(str_par, "PERIOD_500_ms")) return PERIOD__500__ms; else if (!strcmp(str_par, "PERIOD_1000_ms")) return PERIOD__1000__ms; else if (!strcmp(str_par, "PERIOD_2000_ms")) return PERIOD__2000__ms; else if (!strcmp(str_par, "PERIOD_3000_ms")) return PERIOD__3000__ms; else if (!strcmp(str_par, "PERIOD_4000_ms")) return PERIOD__4000__ms; else if (!strcmp(str_par, "PERIOD_6000_ms")) return PERIOD__6000__ms; else if (!strcmp(str_par, "PERIOD_8000_ms")) return PERIOD__8000__ms; else if (!strcmp(str_par, "PERIOD_12000_ms")) return PERIOD__12000__ms; else if (!strcmp(str_par, "PERIOD_16000_ms")) return PERIOD__16000__ms; else if (!strcmp(str_par, "PERIOD_20000_ms")) return PERIOD__20000__ms; else if (!strcmp(str_par, "PERIOD_24000_ms")) return PERIOD__24000__ms; else if (!strcmp(str_par, "PERIOD_28000_ms")) return PERIOD__28000__ms; else if (!strcmp(str_par, "PERIOD_32000_ms")) return PERIOD__32000__ms; else if (!strcmp(str_par, "PERIOD_64000_ms")) return PERIOD__64000__ms; else return UNKNOWN_VALUE; } boolean AAA__3GPP__Measurement__Period__UMTS::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: case 12: case 13: case 14: return TRUE; default: return FALSE; } } int AAA__3GPP__Measurement__Period__UMTS::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.AAA_3GPP_Measurement_Period_UMTS.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int AAA__3GPP__Measurement__Period__UMTS::enum2int(const AAA__3GPP__Measurement__Period__UMTS& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.AAA_3GPP_Measurement_Period_UMTS.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void AAA__3GPP__Measurement__Period__UMTS::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.AAA_3GPP_Measurement_Period_UMTS.", int_val); enum_value = (enum_type)int_val; } AAA__3GPP__Measurement__Period__UMTS::operator AAA__3GPP__Measurement__Period__UMTS::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.AAA_3GPP_Measurement_Period_UMTS."); return enum_value; } void AAA__3GPP__Measurement__Period__UMTS::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void AAA__3GPP__Measurement__Period__UMTS::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.AAA_3GPP_Measurement_Period_UMTS"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.AAA_3GPP_Measurement_Period_UMTS."); } } void AAA__3GPP__Measurement__Period__UMTS::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Measurement_Period_UMTS."); text_buf.push_int(enum_value); } void AAA__3GPP__Measurement__Period__UMTS::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.AAA_3GPP_Measurement_Period_UMTS.", enum_value); } void AAA__3GPP__Measurement__Period__UMTS::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void AAA__3GPP__Measurement__Period__UMTS::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int AAA__3GPP__Measurement__Period__UMTS::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 4, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int AAA__3GPP__Measurement__Period__UMTS::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 4); } void AAA__3GPP__Measurement__Period__UMTS_template::copy_template(const AAA__3GPP__Measurement__Period__UMTS_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new AAA__3GPP__Measurement__Period__UMTS_template[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 AAA__3GPP__Measurement__Period__UMTS_template(*other_value.implication_.precondition); implication_.implied_template = new AAA__3GPP__Measurement__Period__UMTS_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_Measurement_Period_UMTS."); } } AAA__3GPP__Measurement__Period__UMTS_template::AAA__3GPP__Measurement__Period__UMTS_template() { } AAA__3GPP__Measurement__Period__UMTS_template::AAA__3GPP__Measurement__Period__UMTS_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } AAA__3GPP__Measurement__Period__UMTS_template::AAA__3GPP__Measurement__Period__UMTS_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!AAA__3GPP__Measurement__Period__UMTS::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.AAA_3GPP_Measurement_Period_UMTS with unknown numeric value %d.", other_value); single_value = (AAA__3GPP__Measurement__Period__UMTS::enum_type)other_value; } AAA__3GPP__Measurement__Period__UMTS_template::AAA__3GPP__Measurement__Period__UMTS_template(AAA__3GPP__Measurement__Period__UMTS::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } AAA__3GPP__Measurement__Period__UMTS_template::AAA__3GPP__Measurement__Period__UMTS_template(const AAA__3GPP__Measurement__Period__UMTS& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == AAA__3GPP__Measurement__Period__UMTS::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Measurement_Period_UMTS."); single_value = other_value.enum_value; } AAA__3GPP__Measurement__Period__UMTS_template::AAA__3GPP__Measurement__Period__UMTS_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__Measurement__Period__UMTS::enum_type)(const AAA__3GPP__Measurement__Period__UMTS&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.AAA_3GPP_Measurement_Period_UMTS from an unbound optional field."); } } AAA__3GPP__Measurement__Period__UMTS_template::AAA__3GPP__Measurement__Period__UMTS_template(AAA__3GPP__Measurement__Period__UMTS_template* p_precondition, AAA__3GPP__Measurement__Period__UMTS_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } AAA__3GPP__Measurement__Period__UMTS_template::AAA__3GPP__Measurement__Period__UMTS_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; } AAA__3GPP__Measurement__Period__UMTS_template::AAA__3GPP__Measurement__Period__UMTS_template(const AAA__3GPP__Measurement__Period__UMTS_template& other_value) : Base_Template() { copy_template(other_value); } AAA__3GPP__Measurement__Period__UMTS_template::~AAA__3GPP__Measurement__Period__UMTS_template() { clean_up(); } boolean AAA__3GPP__Measurement__Period__UMTS_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean AAA__3GPP__Measurement__Period__UMTS_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != AAA__3GPP__Measurement__Period__UMTS::UNBOUND_VALUE; } void AAA__3GPP__Measurement__Period__UMTS_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } AAA__3GPP__Measurement__Period__UMTS_template& AAA__3GPP__Measurement__Period__UMTS_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } AAA__3GPP__Measurement__Period__UMTS_template& AAA__3GPP__Measurement__Period__UMTS_template::operator=(int other_value) { if (!AAA__3GPP__Measurement__Period__UMTS::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.AAA_3GPP_Measurement_Period_UMTS.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__Measurement__Period__UMTS::enum_type)other_value; return *this; } AAA__3GPP__Measurement__Period__UMTS_template& AAA__3GPP__Measurement__Period__UMTS_template::operator=(AAA__3GPP__Measurement__Period__UMTS::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } AAA__3GPP__Measurement__Period__UMTS_template& AAA__3GPP__Measurement__Period__UMTS_template::operator=(const AAA__3GPP__Measurement__Period__UMTS& other_value) { if (other_value.enum_value == AAA__3GPP__Measurement__Period__UMTS::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Measurement_Period_UMTS to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } AAA__3GPP__Measurement__Period__UMTS_template& AAA__3GPP__Measurement__Period__UMTS_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__Measurement__Period__UMTS::enum_type)(const AAA__3GPP__Measurement__Period__UMTS&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.AAA_3GPP_Measurement_Period_UMTS."); } return *this; } AAA__3GPP__Measurement__Period__UMTS_template& AAA__3GPP__Measurement__Period__UMTS_template::operator=(const AAA__3GPP__Measurement__Period__UMTS_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean AAA__3GPP__Measurement__Period__UMTS_template::match(AAA__3GPP__Measurement__Period__UMTS::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_Measurement_Period_UMTS."); } return FALSE; } boolean AAA__3GPP__Measurement__Period__UMTS_template::match(const AAA__3GPP__Measurement__Period__UMTS& other_value, boolean) const { if (other_value.enum_value == AAA__3GPP__Measurement__Period__UMTS::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.AAA_3GPP_Measurement_Period_UMTS with an unbound value."); return match(other_value.enum_value); } AAA__3GPP__Measurement__Period__UMTS::enum_type AAA__3GPP__Measurement__Period__UMTS_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.AAA_3GPP_Measurement_Period_UMTS."); return single_value; } void AAA__3GPP__Measurement__Period__UMTS_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.AAA_3GPP_Measurement_Period_UMTS."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new AAA__3GPP__Measurement__Period__UMTS_template[list_length]; } AAA__3GPP__Measurement__Period__UMTS_template& AAA__3GPP__Measurement__Period__UMTS_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.AAA_3GPP_Measurement_Period_UMTS."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.AAA_3GPP_Measurement_Period_UMTS."); return value_list.list_value[list_index]; } void AAA__3GPP__Measurement__Period__UMTS_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(AAA__3GPP__Measurement__Period__UMTS::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void AAA__3GPP__Measurement__Period__UMTS_template::log_match(const AAA__3GPP__Measurement__Period__UMTS& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void AAA__3GPP__Measurement__Period__UMTS_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_Measurement_Period_UMTS."); } } void AAA__3GPP__Measurement__Period__UMTS_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (AAA__3GPP__Measurement__Period__UMTS::enum_type)text_buf.pull_int().get_val(); if (!AAA__3GPP__Measurement__Period__UMTS::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.AAA_3GPP_Measurement_Period_UMTS.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new AAA__3GPP__Measurement__Period__UMTS_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.AAA_3GPP_Measurement_Period_UMTS."); } } boolean AAA__3GPP__Measurement__Period__UMTS_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean AAA__3GPP__Measurement__Period__UMTS_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { AAA__3GPP__Measurement__Period__UMTS_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { AAA__3GPP__Measurement__Period__UMTS::enum_type enum_val = AAA__3GPP__Measurement__Period__UMTS::str_to_enum(m_p->get_enumerated()); if (!AAA__3GPP__Measurement__Period__UMTS::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.AAA_3GPP_Measurement_Period_UMTS."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { AAA__3GPP__Measurement__Period__UMTS_template* precondition = new AAA__3GPP__Measurement__Period__UMTS_template; precondition->set_param(*m_p->get_elem(0)); AAA__3GPP__Measurement__Period__UMTS_template* implied_template = new AAA__3GPP__Measurement__Period__UMTS_template; implied_template->set_param(*m_p->get_elem(1)); *this = AAA__3GPP__Measurement__Period__UMTS_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.AAA_3GPP_Measurement_Period_UMTS"); } is_ifpresent = param.get_ifpresent(); } void AAA__3GPP__Measurement__Period__UMTS_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.AAA_3GPP_Measurement_Period_UMTS"); } DCA__3GPP__Media__Initiator__Flag::DCA__3GPP__Media__Initiator__Flag() { enum_value = UNBOUND_VALUE; } DCA__3GPP__Media__Initiator__Flag::DCA__3GPP__Media__Initiator__Flag(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Media_Initiator_Flag with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } DCA__3GPP__Media__Initiator__Flag::DCA__3GPP__Media__Initiator__Flag(enum_type other_value) { enum_value = other_value; } DCA__3GPP__Media__Initiator__Flag::DCA__3GPP__Media__Initiator__Flag(const DCA__3GPP__Media__Initiator__Flag& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Media_Initiator_Flag."); enum_value = other_value.enum_value; } DCA__3GPP__Media__Initiator__Flag& DCA__3GPP__Media__Initiator__Flag::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Media_Initiator_Flag.", other_value); enum_value = (enum_type)other_value; return *this; } DCA__3GPP__Media__Initiator__Flag& DCA__3GPP__Media__Initiator__Flag::operator=(enum_type other_value) { enum_value = other_value; return *this; } DCA__3GPP__Media__Initiator__Flag& DCA__3GPP__Media__Initiator__Flag::operator=(const DCA__3GPP__Media__Initiator__Flag& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Media_Initiator_Flag."); enum_value = other_value.enum_value; return *this; } boolean DCA__3GPP__Media__Initiator__Flag::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Media_Initiator_Flag."); return enum_value == other_value; } boolean DCA__3GPP__Media__Initiator__Flag::operator==(const DCA__3GPP__Media__Initiator__Flag& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Media_Initiator_Flag."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Media_Initiator_Flag."); return enum_value == other_value.enum_value; } boolean DCA__3GPP__Media__Initiator__Flag::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Media_Initiator_Flag."); return enum_value < other_value; } boolean DCA__3GPP__Media__Initiator__Flag::operator<(const DCA__3GPP__Media__Initiator__Flag& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Media_Initiator_Flag."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Media_Initiator_Flag."); return enum_value < other_value.enum_value; } boolean DCA__3GPP__Media__Initiator__Flag::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Media_Initiator_Flag."); return enum_value > other_value; } boolean DCA__3GPP__Media__Initiator__Flag::operator>(const DCA__3GPP__Media__Initiator__Flag& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Media_Initiator_Flag."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Media_Initiator_Flag."); return enum_value > other_value.enum_value; } const char *DCA__3GPP__Media__Initiator__Flag::enum_to_str(enum_type enum_par) { switch (enum_par) { case CALLED__PARTY: return "CALLED_PARTY"; case CALLING__PARTY: return "CALLING_PARTY"; case UNKNOWN: return "UNKNOWN"; default: return ""; } } DCA__3GPP__Media__Initiator__Flag::enum_type DCA__3GPP__Media__Initiator__Flag::str_to_enum(const char *str_par) { if (!strcmp(str_par, "CALLED_PARTY")) return CALLED__PARTY; else if (!strcmp(str_par, "CALLING_PARTY")) return CALLING__PARTY; else if (!strcmp(str_par, "UNKNOWN")) return UNKNOWN; else return UNKNOWN_VALUE; } boolean DCA__3GPP__Media__Initiator__Flag::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: case 2: return TRUE; default: return FALSE; } } int DCA__3GPP__Media__Initiator__Flag::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_Media_Initiator_Flag.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int DCA__3GPP__Media__Initiator__Flag::enum2int(const DCA__3GPP__Media__Initiator__Flag& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_Media_Initiator_Flag.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void DCA__3GPP__Media__Initiator__Flag::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Media_Initiator_Flag.", int_val); enum_value = (enum_type)int_val; } DCA__3GPP__Media__Initiator__Flag::operator DCA__3GPP__Media__Initiator__Flag::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.DCA_3GPP_Media_Initiator_Flag."); return enum_value; } void DCA__3GPP__Media__Initiator__Flag::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void DCA__3GPP__Media__Initiator__Flag::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.DCA_3GPP_Media_Initiator_Flag"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_Media_Initiator_Flag."); } } void DCA__3GPP__Media__Initiator__Flag::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Media_Initiator_Flag."); text_buf.push_int(enum_value); } void DCA__3GPP__Media__Initiator__Flag::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.DCA_3GPP_Media_Initiator_Flag.", enum_value); } void DCA__3GPP__Media__Initiator__Flag::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void DCA__3GPP__Media__Initiator__Flag::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int DCA__3GPP__Media__Initiator__Flag::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int DCA__3GPP__Media__Initiator__Flag::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void DCA__3GPP__Media__Initiator__Flag_template::copy_template(const DCA__3GPP__Media__Initiator__Flag_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new DCA__3GPP__Media__Initiator__Flag_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].copy_template(other_value.value_list.list_value[list_count]); break; case IMPLICATION_MATCH: implication_.precondition = new DCA__3GPP__Media__Initiator__Flag_template(*other_value.implication_.precondition); implication_.implied_template = new DCA__3GPP__Media__Initiator__Flag_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Media_Initiator_Flag."); } } DCA__3GPP__Media__Initiator__Flag_template::DCA__3GPP__Media__Initiator__Flag_template() { } DCA__3GPP__Media__Initiator__Flag_template::DCA__3GPP__Media__Initiator__Flag_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } DCA__3GPP__Media__Initiator__Flag_template::DCA__3GPP__Media__Initiator__Flag_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!DCA__3GPP__Media__Initiator__Flag::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.DCA_3GPP_Media_Initiator_Flag with unknown numeric value %d.", other_value); single_value = (DCA__3GPP__Media__Initiator__Flag::enum_type)other_value; } DCA__3GPP__Media__Initiator__Flag_template::DCA__3GPP__Media__Initiator__Flag_template(DCA__3GPP__Media__Initiator__Flag::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } DCA__3GPP__Media__Initiator__Flag_template::DCA__3GPP__Media__Initiator__Flag_template(const DCA__3GPP__Media__Initiator__Flag& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == DCA__3GPP__Media__Initiator__Flag::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Media_Initiator_Flag."); single_value = other_value.enum_value; } DCA__3GPP__Media__Initiator__Flag_template::DCA__3GPP__Media__Initiator__Flag_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Media__Initiator__Flag::enum_type)(const DCA__3GPP__Media__Initiator__Flag&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.DCA_3GPP_Media_Initiator_Flag from an unbound optional field."); } } DCA__3GPP__Media__Initiator__Flag_template::DCA__3GPP__Media__Initiator__Flag_template(DCA__3GPP__Media__Initiator__Flag_template* p_precondition, DCA__3GPP__Media__Initiator__Flag_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } DCA__3GPP__Media__Initiator__Flag_template::DCA__3GPP__Media__Initiator__Flag_template(Dynamic_Match_Interface* p_dyn_match) : Base_Template(DYNAMIC_MATCH) { dyn_match = new dynmatch_struct; dyn_match->ptr = p_dyn_match; dyn_match->ref_count = 1; } DCA__3GPP__Media__Initiator__Flag_template::DCA__3GPP__Media__Initiator__Flag_template(const DCA__3GPP__Media__Initiator__Flag_template& other_value) : Base_Template() { copy_template(other_value); } DCA__3GPP__Media__Initiator__Flag_template::~DCA__3GPP__Media__Initiator__Flag_template() { clean_up(); } boolean DCA__3GPP__Media__Initiator__Flag_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean DCA__3GPP__Media__Initiator__Flag_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != DCA__3GPP__Media__Initiator__Flag::UNBOUND_VALUE; } void DCA__3GPP__Media__Initiator__Flag_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } DCA__3GPP__Media__Initiator__Flag_template& DCA__3GPP__Media__Initiator__Flag_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } DCA__3GPP__Media__Initiator__Flag_template& DCA__3GPP__Media__Initiator__Flag_template::operator=(int other_value) { if (!DCA__3GPP__Media__Initiator__Flag::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.DCA_3GPP_Media_Initiator_Flag.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Media__Initiator__Flag::enum_type)other_value; return *this; } DCA__3GPP__Media__Initiator__Flag_template& DCA__3GPP__Media__Initiator__Flag_template::operator=(DCA__3GPP__Media__Initiator__Flag::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } DCA__3GPP__Media__Initiator__Flag_template& DCA__3GPP__Media__Initiator__Flag_template::operator=(const DCA__3GPP__Media__Initiator__Flag& other_value) { if (other_value.enum_value == DCA__3GPP__Media__Initiator__Flag::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Media_Initiator_Flag to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } DCA__3GPP__Media__Initiator__Flag_template& DCA__3GPP__Media__Initiator__Flag_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Media__Initiator__Flag::enum_type)(const DCA__3GPP__Media__Initiator__Flag&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.DCA_3GPP_Media_Initiator_Flag."); } return *this; } DCA__3GPP__Media__Initiator__Flag_template& DCA__3GPP__Media__Initiator__Flag_template::operator=(const DCA__3GPP__Media__Initiator__Flag_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean DCA__3GPP__Media__Initiator__Flag_template::match(DCA__3GPP__Media__Initiator__Flag::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Media_Initiator_Flag."); } return FALSE; } boolean DCA__3GPP__Media__Initiator__Flag_template::match(const DCA__3GPP__Media__Initiator__Flag& other_value, boolean) const { if (other_value.enum_value == DCA__3GPP__Media__Initiator__Flag::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.DCA_3GPP_Media_Initiator_Flag with an unbound value."); return match(other_value.enum_value); } DCA__3GPP__Media__Initiator__Flag::enum_type DCA__3GPP__Media__Initiator__Flag_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.DCA_3GPP_Media_Initiator_Flag."); return single_value; } void DCA__3GPP__Media__Initiator__Flag_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Media_Initiator_Flag."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new DCA__3GPP__Media__Initiator__Flag_template[list_length]; } DCA__3GPP__Media__Initiator__Flag_template& DCA__3GPP__Media__Initiator__Flag_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.DCA_3GPP_Media_Initiator_Flag."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.DCA_3GPP_Media_Initiator_Flag."); return value_list.list_value[list_index]; } void DCA__3GPP__Media__Initiator__Flag_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(DCA__3GPP__Media__Initiator__Flag::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void DCA__3GPP__Media__Initiator__Flag_template::log_match(const DCA__3GPP__Media__Initiator__Flag& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void DCA__3GPP__Media__Initiator__Flag_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Media_Initiator_Flag."); } } void DCA__3GPP__Media__Initiator__Flag_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (DCA__3GPP__Media__Initiator__Flag::enum_type)text_buf.pull_int().get_val(); if (!DCA__3GPP__Media__Initiator__Flag::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Media_Initiator_Flag.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new DCA__3GPP__Media__Initiator__Flag_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Media_Initiator_Flag."); } } boolean DCA__3GPP__Media__Initiator__Flag_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean DCA__3GPP__Media__Initiator__Flag_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { DCA__3GPP__Media__Initiator__Flag_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { DCA__3GPP__Media__Initiator__Flag::enum_type enum_val = DCA__3GPP__Media__Initiator__Flag::str_to_enum(m_p->get_enumerated()); if (!DCA__3GPP__Media__Initiator__Flag::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_Media_Initiator_Flag."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { DCA__3GPP__Media__Initiator__Flag_template* precondition = new DCA__3GPP__Media__Initiator__Flag_template; precondition->set_param(*m_p->get_elem(0)); DCA__3GPP__Media__Initiator__Flag_template* implied_template = new DCA__3GPP__Media__Initiator__Flag_template; implied_template->set_param(*m_p->get_elem(1)); *this = DCA__3GPP__Media__Initiator__Flag_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.DCA_3GPP_Media_Initiator_Flag"); } is_ifpresent = param.get_ifpresent(); } void DCA__3GPP__Media__Initiator__Flag_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.DCA_3GPP_Media_Initiator_Flag"); } PCC__3GPP__3GPP__PS__Data__Off__Status::PCC__3GPP__3GPP__PS__Data__Off__Status() { enum_value = UNBOUND_VALUE; } PCC__3GPP__3GPP__PS__Data__Off__Status::PCC__3GPP__3GPP__PS__Data__Off__Status(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.PCC_3GPP_3GPP_PS_Data_Off_Status with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } PCC__3GPP__3GPP__PS__Data__Off__Status::PCC__3GPP__3GPP__PS__Data__Off__Status(enum_type other_value) { enum_value = other_value; } PCC__3GPP__3GPP__PS__Data__Off__Status::PCC__3GPP__3GPP__PS__Data__Off__Status(const PCC__3GPP__3GPP__PS__Data__Off__Status& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_3GPP_PS_Data_Off_Status."); enum_value = other_value.enum_value; } PCC__3GPP__3GPP__PS__Data__Off__Status& PCC__3GPP__3GPP__PS__Data__Off__Status::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.PCC_3GPP_3GPP_PS_Data_Off_Status.", other_value); enum_value = (enum_type)other_value; return *this; } PCC__3GPP__3GPP__PS__Data__Off__Status& PCC__3GPP__3GPP__PS__Data__Off__Status::operator=(enum_type other_value) { enum_value = other_value; return *this; } PCC__3GPP__3GPP__PS__Data__Off__Status& PCC__3GPP__3GPP__PS__Data__Off__Status::operator=(const PCC__3GPP__3GPP__PS__Data__Off__Status& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_3GPP_PS_Data_Off_Status."); enum_value = other_value.enum_value; return *this; } boolean PCC__3GPP__3GPP__PS__Data__Off__Status::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_3GPP_PS_Data_Off_Status."); return enum_value == other_value; } boolean PCC__3GPP__3GPP__PS__Data__Off__Status::operator==(const PCC__3GPP__3GPP__PS__Data__Off__Status& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_3GPP_PS_Data_Off_Status."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_3GPP_PS_Data_Off_Status."); return enum_value == other_value.enum_value; } boolean PCC__3GPP__3GPP__PS__Data__Off__Status::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_3GPP_PS_Data_Off_Status."); return enum_value < other_value; } boolean PCC__3GPP__3GPP__PS__Data__Off__Status::operator<(const PCC__3GPP__3GPP__PS__Data__Off__Status& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_3GPP_PS_Data_Off_Status."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_3GPP_PS_Data_Off_Status."); return enum_value < other_value.enum_value; } boolean PCC__3GPP__3GPP__PS__Data__Off__Status::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_3GPP_PS_Data_Off_Status."); return enum_value > other_value; } boolean PCC__3GPP__3GPP__PS__Data__Off__Status::operator>(const PCC__3GPP__3GPP__PS__Data__Off__Status& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_3GPP_PS_Data_Off_Status."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_3GPP_PS_Data_Off_Status."); return enum_value > other_value.enum_value; } const char *PCC__3GPP__3GPP__PS__Data__Off__Status::enum_to_str(enum_type enum_par) { switch (enum_par) { case ACTIVE: return "ACTIVE"; case INACTIVE: return "INACTIVE"; default: return ""; } } PCC__3GPP__3GPP__PS__Data__Off__Status::enum_type PCC__3GPP__3GPP__PS__Data__Off__Status::str_to_enum(const char *str_par) { if (!strcmp(str_par, "ACTIVE")) return ACTIVE; else if (!strcmp(str_par, "INACTIVE")) return INACTIVE; else return UNKNOWN_VALUE; } boolean PCC__3GPP__3GPP__PS__Data__Off__Status::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: return TRUE; default: return FALSE; } } int PCC__3GPP__3GPP__PS__Data__Off__Status::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.PCC_3GPP_3GPP_PS_Data_Off_Status.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int PCC__3GPP__3GPP__PS__Data__Off__Status::enum2int(const PCC__3GPP__3GPP__PS__Data__Off__Status& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.PCC_3GPP_3GPP_PS_Data_Off_Status.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void PCC__3GPP__3GPP__PS__Data__Off__Status::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.PCC_3GPP_3GPP_PS_Data_Off_Status.", int_val); enum_value = (enum_type)int_val; } PCC__3GPP__3GPP__PS__Data__Off__Status::operator PCC__3GPP__3GPP__PS__Data__Off__Status::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.PCC_3GPP_3GPP_PS_Data_Off_Status."); return enum_value; } void PCC__3GPP__3GPP__PS__Data__Off__Status::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void PCC__3GPP__3GPP__PS__Data__Off__Status::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.PCC_3GPP_3GPP_PS_Data_Off_Status"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.PCC_3GPP_3GPP_PS_Data_Off_Status."); } } void PCC__3GPP__3GPP__PS__Data__Off__Status::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_3GPP_PS_Data_Off_Status."); text_buf.push_int(enum_value); } void PCC__3GPP__3GPP__PS__Data__Off__Status::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.PCC_3GPP_3GPP_PS_Data_Off_Status.", enum_value); } void PCC__3GPP__3GPP__PS__Data__Off__Status::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void PCC__3GPP__3GPP__PS__Data__Off__Status::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int PCC__3GPP__3GPP__PS__Data__Off__Status::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int PCC__3GPP__3GPP__PS__Data__Off__Status::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void PCC__3GPP__3GPP__PS__Data__Off__Status_template::copy_template(const PCC__3GPP__3GPP__PS__Data__Off__Status_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new PCC__3GPP__3GPP__PS__Data__Off__Status_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].copy_template(other_value.value_list.list_value[list_count]); break; case IMPLICATION_MATCH: implication_.precondition = new PCC__3GPP__3GPP__PS__Data__Off__Status_template(*other_value.implication_.precondition); implication_.implied_template = new PCC__3GPP__3GPP__PS__Data__Off__Status_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.PCC_3GPP_3GPP_PS_Data_Off_Status."); } } PCC__3GPP__3GPP__PS__Data__Off__Status_template::PCC__3GPP__3GPP__PS__Data__Off__Status_template() { } PCC__3GPP__3GPP__PS__Data__Off__Status_template::PCC__3GPP__3GPP__PS__Data__Off__Status_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } PCC__3GPP__3GPP__PS__Data__Off__Status_template::PCC__3GPP__3GPP__PS__Data__Off__Status_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!PCC__3GPP__3GPP__PS__Data__Off__Status::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.PCC_3GPP_3GPP_PS_Data_Off_Status with unknown numeric value %d.", other_value); single_value = (PCC__3GPP__3GPP__PS__Data__Off__Status::enum_type)other_value; } PCC__3GPP__3GPP__PS__Data__Off__Status_template::PCC__3GPP__3GPP__PS__Data__Off__Status_template(PCC__3GPP__3GPP__PS__Data__Off__Status::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } PCC__3GPP__3GPP__PS__Data__Off__Status_template::PCC__3GPP__3GPP__PS__Data__Off__Status_template(const PCC__3GPP__3GPP__PS__Data__Off__Status& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == PCC__3GPP__3GPP__PS__Data__Off__Status::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_3GPP_PS_Data_Off_Status."); single_value = other_value.enum_value; } PCC__3GPP__3GPP__PS__Data__Off__Status_template::PCC__3GPP__3GPP__PS__Data__Off__Status_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (PCC__3GPP__3GPP__PS__Data__Off__Status::enum_type)(const PCC__3GPP__3GPP__PS__Data__Off__Status&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.PCC_3GPP_3GPP_PS_Data_Off_Status from an unbound optional field."); } } PCC__3GPP__3GPP__PS__Data__Off__Status_template::PCC__3GPP__3GPP__PS__Data__Off__Status_template(PCC__3GPP__3GPP__PS__Data__Off__Status_template* p_precondition, PCC__3GPP__3GPP__PS__Data__Off__Status_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } PCC__3GPP__3GPP__PS__Data__Off__Status_template::PCC__3GPP__3GPP__PS__Data__Off__Status_template(Dynamic_Match_Interface* p_dyn_match) : Base_Template(DYNAMIC_MATCH) { dyn_match = new dynmatch_struct; dyn_match->ptr = p_dyn_match; dyn_match->ref_count = 1; } PCC__3GPP__3GPP__PS__Data__Off__Status_template::PCC__3GPP__3GPP__PS__Data__Off__Status_template(const PCC__3GPP__3GPP__PS__Data__Off__Status_template& other_value) : Base_Template() { copy_template(other_value); } PCC__3GPP__3GPP__PS__Data__Off__Status_template::~PCC__3GPP__3GPP__PS__Data__Off__Status_template() { clean_up(); } boolean PCC__3GPP__3GPP__PS__Data__Off__Status_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean PCC__3GPP__3GPP__PS__Data__Off__Status_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != PCC__3GPP__3GPP__PS__Data__Off__Status::UNBOUND_VALUE; } void PCC__3GPP__3GPP__PS__Data__Off__Status_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } PCC__3GPP__3GPP__PS__Data__Off__Status_template& PCC__3GPP__3GPP__PS__Data__Off__Status_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } PCC__3GPP__3GPP__PS__Data__Off__Status_template& PCC__3GPP__3GPP__PS__Data__Off__Status_template::operator=(int other_value) { if (!PCC__3GPP__3GPP__PS__Data__Off__Status::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.PCC_3GPP_3GPP_PS_Data_Off_Status.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (PCC__3GPP__3GPP__PS__Data__Off__Status::enum_type)other_value; return *this; } PCC__3GPP__3GPP__PS__Data__Off__Status_template& PCC__3GPP__3GPP__PS__Data__Off__Status_template::operator=(PCC__3GPP__3GPP__PS__Data__Off__Status::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } PCC__3GPP__3GPP__PS__Data__Off__Status_template& PCC__3GPP__3GPP__PS__Data__Off__Status_template::operator=(const PCC__3GPP__3GPP__PS__Data__Off__Status& other_value) { if (other_value.enum_value == PCC__3GPP__3GPP__PS__Data__Off__Status::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_3GPP_PS_Data_Off_Status to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } PCC__3GPP__3GPP__PS__Data__Off__Status_template& PCC__3GPP__3GPP__PS__Data__Off__Status_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (PCC__3GPP__3GPP__PS__Data__Off__Status::enum_type)(const PCC__3GPP__3GPP__PS__Data__Off__Status&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.PCC_3GPP_3GPP_PS_Data_Off_Status."); } return *this; } PCC__3GPP__3GPP__PS__Data__Off__Status_template& PCC__3GPP__3GPP__PS__Data__Off__Status_template::operator=(const PCC__3GPP__3GPP__PS__Data__Off__Status_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean PCC__3GPP__3GPP__PS__Data__Off__Status_template::match(PCC__3GPP__3GPP__PS__Data__Off__Status::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.PCC_3GPP_3GPP_PS_Data_Off_Status."); } return FALSE; } boolean PCC__3GPP__3GPP__PS__Data__Off__Status_template::match(const PCC__3GPP__3GPP__PS__Data__Off__Status& other_value, boolean) const { if (other_value.enum_value == PCC__3GPP__3GPP__PS__Data__Off__Status::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.PCC_3GPP_3GPP_PS_Data_Off_Status with an unbound value."); return match(other_value.enum_value); } PCC__3GPP__3GPP__PS__Data__Off__Status::enum_type PCC__3GPP__3GPP__PS__Data__Off__Status_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.PCC_3GPP_3GPP_PS_Data_Off_Status."); return single_value; } void PCC__3GPP__3GPP__PS__Data__Off__Status_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.PCC_3GPP_3GPP_PS_Data_Off_Status."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new PCC__3GPP__3GPP__PS__Data__Off__Status_template[list_length]; } PCC__3GPP__3GPP__PS__Data__Off__Status_template& PCC__3GPP__3GPP__PS__Data__Off__Status_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.PCC_3GPP_3GPP_PS_Data_Off_Status."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.PCC_3GPP_3GPP_PS_Data_Off_Status."); return value_list.list_value[list_index]; } void PCC__3GPP__3GPP__PS__Data__Off__Status_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(PCC__3GPP__3GPP__PS__Data__Off__Status::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void PCC__3GPP__3GPP__PS__Data__Off__Status_template::log_match(const PCC__3GPP__3GPP__PS__Data__Off__Status& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void PCC__3GPP__3GPP__PS__Data__Off__Status_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.PCC_3GPP_3GPP_PS_Data_Off_Status."); } } void PCC__3GPP__3GPP__PS__Data__Off__Status_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (PCC__3GPP__3GPP__PS__Data__Off__Status::enum_type)text_buf.pull_int().get_val(); if (!PCC__3GPP__3GPP__PS__Data__Off__Status::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.PCC_3GPP_3GPP_PS_Data_Off_Status.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new PCC__3GPP__3GPP__PS__Data__Off__Status_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.PCC_3GPP_3GPP_PS_Data_Off_Status."); } } boolean PCC__3GPP__3GPP__PS__Data__Off__Status_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean PCC__3GPP__3GPP__PS__Data__Off__Status_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { PCC__3GPP__3GPP__PS__Data__Off__Status_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { PCC__3GPP__3GPP__PS__Data__Off__Status::enum_type enum_val = PCC__3GPP__3GPP__PS__Data__Off__Status::str_to_enum(m_p->get_enumerated()); if (!PCC__3GPP__3GPP__PS__Data__Off__Status::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.PCC_3GPP_3GPP_PS_Data_Off_Status."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { PCC__3GPP__3GPP__PS__Data__Off__Status_template* precondition = new PCC__3GPP__3GPP__PS__Data__Off__Status_template; precondition->set_param(*m_p->get_elem(0)); PCC__3GPP__3GPP__PS__Data__Off__Status_template* implied_template = new PCC__3GPP__3GPP__PS__Data__Off__Status_template; implied_template->set_param(*m_p->get_elem(1)); *this = PCC__3GPP__3GPP__PS__Data__Off__Status_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.PCC_3GPP_3GPP_PS_Data_Off_Status"); } is_ifpresent = param.get_ifpresent(); } void PCC__3GPP__3GPP__PS__Data__Off__Status_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.PCC_3GPP_3GPP_PS_Data_Off_Status"); } CxDx__3GPP__Server__Assignment__Type::CxDx__3GPP__Server__Assignment__Type() { enum_value = UNBOUND_VALUE; } CxDx__3GPP__Server__Assignment__Type::CxDx__3GPP__Server__Assignment__Type(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.CxDx_3GPP_Server_Assignment_Type with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } CxDx__3GPP__Server__Assignment__Type::CxDx__3GPP__Server__Assignment__Type(enum_type other_value) { enum_value = other_value; } CxDx__3GPP__Server__Assignment__Type::CxDx__3GPP__Server__Assignment__Type(const CxDx__3GPP__Server__Assignment__Type& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.CxDx_3GPP_Server_Assignment_Type."); enum_value = other_value.enum_value; } CxDx__3GPP__Server__Assignment__Type& CxDx__3GPP__Server__Assignment__Type::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.CxDx_3GPP_Server_Assignment_Type.", other_value); enum_value = (enum_type)other_value; return *this; } CxDx__3GPP__Server__Assignment__Type& CxDx__3GPP__Server__Assignment__Type::operator=(enum_type other_value) { enum_value = other_value; return *this; } CxDx__3GPP__Server__Assignment__Type& CxDx__3GPP__Server__Assignment__Type::operator=(const CxDx__3GPP__Server__Assignment__Type& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.CxDx_3GPP_Server_Assignment_Type."); enum_value = other_value.enum_value; return *this; } boolean CxDx__3GPP__Server__Assignment__Type::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.CxDx_3GPP_Server_Assignment_Type."); return enum_value == other_value; } boolean CxDx__3GPP__Server__Assignment__Type::operator==(const CxDx__3GPP__Server__Assignment__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.CxDx_3GPP_Server_Assignment_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.CxDx_3GPP_Server_Assignment_Type."); return enum_value == other_value.enum_value; } boolean CxDx__3GPP__Server__Assignment__Type::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.CxDx_3GPP_Server_Assignment_Type."); return enum_value < other_value; } boolean CxDx__3GPP__Server__Assignment__Type::operator<(const CxDx__3GPP__Server__Assignment__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.CxDx_3GPP_Server_Assignment_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.CxDx_3GPP_Server_Assignment_Type."); return enum_value < other_value.enum_value; } boolean CxDx__3GPP__Server__Assignment__Type::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.CxDx_3GPP_Server_Assignment_Type."); return enum_value > other_value; } boolean CxDx__3GPP__Server__Assignment__Type::operator>(const CxDx__3GPP__Server__Assignment__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.CxDx_3GPP_Server_Assignment_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.CxDx_3GPP_Server_Assignment_Type."); return enum_value > other_value.enum_value; } const char *CxDx__3GPP__Server__Assignment__Type::enum_to_str(enum_type enum_par) { switch (enum_par) { case NO__ASSIGNMENT: return "NO_ASSIGNMENT"; case REGISTRATION: return "REGISTRATION"; case RE__REGISTRATION: return "RE_REGISTRATION"; case UNREGISTERED__USER: return "UNREGISTERED_USER"; case TIMEOUT__DEREGISTRATION: return "TIMEOUT_DEREGISTRATION"; case USER__DEREGISTRATION: return "USER_DEREGISTRATION"; case TIMEOUT__DEREGISTRATION__STORE__SERVER__NAME: return "TIMEOUT_DEREGISTRATION_STORE_SERVER_NAME"; case USER__DEREGISTRATION__STORE__SERVER__NAME: return "USER_DEREGISTRATION_STORE_SERVER_NAME"; case ADMINISTRATIVE__DEREGISTRATION: return "ADMINISTRATIVE_DEREGISTRATION"; case AUTHENTICATION__FAILURE: return "AUTHENTICATION_FAILURE"; case AUTHENTICATION__TIMEOUT: return "AUTHENTICATION_TIMEOUT"; case DEREGISTRATION__TOO__MUCH__DATA: return "DEREGISTRATION_TOO_MUCH_DATA"; case AAA__USER__DATA__REQUEST: return "AAA_USER_DATA_REQUEST"; case PGW__UPDATE: return "PGW_UPDATE"; case RESTORATION: return "RESTORATION"; default: return ""; } } CxDx__3GPP__Server__Assignment__Type::enum_type CxDx__3GPP__Server__Assignment__Type::str_to_enum(const char *str_par) { if (!strcmp(str_par, "NO_ASSIGNMENT")) return NO__ASSIGNMENT; else if (!strcmp(str_par, "REGISTRATION")) return REGISTRATION; else if (!strcmp(str_par, "RE_REGISTRATION")) return RE__REGISTRATION; else if (!strcmp(str_par, "UNREGISTERED_USER")) return UNREGISTERED__USER; else if (!strcmp(str_par, "TIMEOUT_DEREGISTRATION")) return TIMEOUT__DEREGISTRATION; else if (!strcmp(str_par, "USER_DEREGISTRATION")) return USER__DEREGISTRATION; else if (!strcmp(str_par, "TIMEOUT_DEREGISTRATION_STORE_SERVER_NAME")) return TIMEOUT__DEREGISTRATION__STORE__SERVER__NAME; else if (!strcmp(str_par, "USER_DEREGISTRATION_STORE_SERVER_NAME")) return USER__DEREGISTRATION__STORE__SERVER__NAME; else if (!strcmp(str_par, "ADMINISTRATIVE_DEREGISTRATION")) return ADMINISTRATIVE__DEREGISTRATION; else if (!strcmp(str_par, "AUTHENTICATION_FAILURE")) return AUTHENTICATION__FAILURE; else if (!strcmp(str_par, "AUTHENTICATION_TIMEOUT")) return AUTHENTICATION__TIMEOUT; else if (!strcmp(str_par, "DEREGISTRATION_TOO_MUCH_DATA")) return DEREGISTRATION__TOO__MUCH__DATA; else if (!strcmp(str_par, "AAA_USER_DATA_REQUEST")) return AAA__USER__DATA__REQUEST; else if (!strcmp(str_par, "PGW_UPDATE")) return PGW__UPDATE; else if (!strcmp(str_par, "RESTORATION")) return RESTORATION; else return UNKNOWN_VALUE; } boolean CxDx__3GPP__Server__Assignment__Type::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: case 12: case 13: case 14: return TRUE; default: return FALSE; } } int CxDx__3GPP__Server__Assignment__Type::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.CxDx_3GPP_Server_Assignment_Type.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int CxDx__3GPP__Server__Assignment__Type::enum2int(const CxDx__3GPP__Server__Assignment__Type& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.CxDx_3GPP_Server_Assignment_Type.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void CxDx__3GPP__Server__Assignment__Type::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.CxDx_3GPP_Server_Assignment_Type.", int_val); enum_value = (enum_type)int_val; } CxDx__3GPP__Server__Assignment__Type::operator CxDx__3GPP__Server__Assignment__Type::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.CxDx_3GPP_Server_Assignment_Type."); return enum_value; } void CxDx__3GPP__Server__Assignment__Type::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void CxDx__3GPP__Server__Assignment__Type::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.CxDx_3GPP_Server_Assignment_Type"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.CxDx_3GPP_Server_Assignment_Type."); } } void CxDx__3GPP__Server__Assignment__Type::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.CxDx_3GPP_Server_Assignment_Type."); text_buf.push_int(enum_value); } void CxDx__3GPP__Server__Assignment__Type::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.CxDx_3GPP_Server_Assignment_Type.", enum_value); } void CxDx__3GPP__Server__Assignment__Type::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void CxDx__3GPP__Server__Assignment__Type::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int CxDx__3GPP__Server__Assignment__Type::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 4, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int CxDx__3GPP__Server__Assignment__Type::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 4); } void CxDx__3GPP__Server__Assignment__Type_template::copy_template(const CxDx__3GPP__Server__Assignment__Type_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new CxDx__3GPP__Server__Assignment__Type_template[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 CxDx__3GPP__Server__Assignment__Type_template(*other_value.implication_.precondition); implication_.implied_template = new CxDx__3GPP__Server__Assignment__Type_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.CxDx_3GPP_Server_Assignment_Type."); } } CxDx__3GPP__Server__Assignment__Type_template::CxDx__3GPP__Server__Assignment__Type_template() { } CxDx__3GPP__Server__Assignment__Type_template::CxDx__3GPP__Server__Assignment__Type_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } CxDx__3GPP__Server__Assignment__Type_template::CxDx__3GPP__Server__Assignment__Type_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!CxDx__3GPP__Server__Assignment__Type::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.CxDx_3GPP_Server_Assignment_Type with unknown numeric value %d.", other_value); single_value = (CxDx__3GPP__Server__Assignment__Type::enum_type)other_value; } CxDx__3GPP__Server__Assignment__Type_template::CxDx__3GPP__Server__Assignment__Type_template(CxDx__3GPP__Server__Assignment__Type::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } CxDx__3GPP__Server__Assignment__Type_template::CxDx__3GPP__Server__Assignment__Type_template(const CxDx__3GPP__Server__Assignment__Type& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == CxDx__3GPP__Server__Assignment__Type::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.CxDx_3GPP_Server_Assignment_Type."); single_value = other_value.enum_value; } CxDx__3GPP__Server__Assignment__Type_template::CxDx__3GPP__Server__Assignment__Type_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (CxDx__3GPP__Server__Assignment__Type::enum_type)(const CxDx__3GPP__Server__Assignment__Type&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.CxDx_3GPP_Server_Assignment_Type from an unbound optional field."); } } CxDx__3GPP__Server__Assignment__Type_template::CxDx__3GPP__Server__Assignment__Type_template(CxDx__3GPP__Server__Assignment__Type_template* p_precondition, CxDx__3GPP__Server__Assignment__Type_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } CxDx__3GPP__Server__Assignment__Type_template::CxDx__3GPP__Server__Assignment__Type_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; } CxDx__3GPP__Server__Assignment__Type_template::CxDx__3GPP__Server__Assignment__Type_template(const CxDx__3GPP__Server__Assignment__Type_template& other_value) : Base_Template() { copy_template(other_value); } CxDx__3GPP__Server__Assignment__Type_template::~CxDx__3GPP__Server__Assignment__Type_template() { clean_up(); } boolean CxDx__3GPP__Server__Assignment__Type_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean CxDx__3GPP__Server__Assignment__Type_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != CxDx__3GPP__Server__Assignment__Type::UNBOUND_VALUE; } void CxDx__3GPP__Server__Assignment__Type_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } CxDx__3GPP__Server__Assignment__Type_template& CxDx__3GPP__Server__Assignment__Type_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } CxDx__3GPP__Server__Assignment__Type_template& CxDx__3GPP__Server__Assignment__Type_template::operator=(int other_value) { if (!CxDx__3GPP__Server__Assignment__Type::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.CxDx_3GPP_Server_Assignment_Type.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (CxDx__3GPP__Server__Assignment__Type::enum_type)other_value; return *this; } CxDx__3GPP__Server__Assignment__Type_template& CxDx__3GPP__Server__Assignment__Type_template::operator=(CxDx__3GPP__Server__Assignment__Type::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } CxDx__3GPP__Server__Assignment__Type_template& CxDx__3GPP__Server__Assignment__Type_template::operator=(const CxDx__3GPP__Server__Assignment__Type& other_value) { if (other_value.enum_value == CxDx__3GPP__Server__Assignment__Type::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.CxDx_3GPP_Server_Assignment_Type to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } CxDx__3GPP__Server__Assignment__Type_template& CxDx__3GPP__Server__Assignment__Type_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (CxDx__3GPP__Server__Assignment__Type::enum_type)(const CxDx__3GPP__Server__Assignment__Type&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.CxDx_3GPP_Server_Assignment_Type."); } return *this; } CxDx__3GPP__Server__Assignment__Type_template& CxDx__3GPP__Server__Assignment__Type_template::operator=(const CxDx__3GPP__Server__Assignment__Type_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean CxDx__3GPP__Server__Assignment__Type_template::match(CxDx__3GPP__Server__Assignment__Type::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.CxDx_3GPP_Server_Assignment_Type."); } return FALSE; } boolean CxDx__3GPP__Server__Assignment__Type_template::match(const CxDx__3GPP__Server__Assignment__Type& other_value, boolean) const { if (other_value.enum_value == CxDx__3GPP__Server__Assignment__Type::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.CxDx_3GPP_Server_Assignment_Type with an unbound value."); return match(other_value.enum_value); } CxDx__3GPP__Server__Assignment__Type::enum_type CxDx__3GPP__Server__Assignment__Type_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.CxDx_3GPP_Server_Assignment_Type."); return single_value; } void CxDx__3GPP__Server__Assignment__Type_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.CxDx_3GPP_Server_Assignment_Type."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new CxDx__3GPP__Server__Assignment__Type_template[list_length]; } CxDx__3GPP__Server__Assignment__Type_template& CxDx__3GPP__Server__Assignment__Type_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.CxDx_3GPP_Server_Assignment_Type."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.CxDx_3GPP_Server_Assignment_Type."); return value_list.list_value[list_index]; } void CxDx__3GPP__Server__Assignment__Type_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(CxDx__3GPP__Server__Assignment__Type::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void CxDx__3GPP__Server__Assignment__Type_template::log_match(const CxDx__3GPP__Server__Assignment__Type& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void CxDx__3GPP__Server__Assignment__Type_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.CxDx_3GPP_Server_Assignment_Type."); } } void CxDx__3GPP__Server__Assignment__Type_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (CxDx__3GPP__Server__Assignment__Type::enum_type)text_buf.pull_int().get_val(); if (!CxDx__3GPP__Server__Assignment__Type::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.CxDx_3GPP_Server_Assignment_Type.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new CxDx__3GPP__Server__Assignment__Type_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.CxDx_3GPP_Server_Assignment_Type."); } } boolean CxDx__3GPP__Server__Assignment__Type_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean CxDx__3GPP__Server__Assignment__Type_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { CxDx__3GPP__Server__Assignment__Type_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { CxDx__3GPP__Server__Assignment__Type::enum_type enum_val = CxDx__3GPP__Server__Assignment__Type::str_to_enum(m_p->get_enumerated()); if (!CxDx__3GPP__Server__Assignment__Type::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.CxDx_3GPP_Server_Assignment_Type."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { CxDx__3GPP__Server__Assignment__Type_template* precondition = new CxDx__3GPP__Server__Assignment__Type_template; precondition->set_param(*m_p->get_elem(0)); CxDx__3GPP__Server__Assignment__Type_template* implied_template = new CxDx__3GPP__Server__Assignment__Type_template; implied_template->set_param(*m_p->get_elem(1)); *this = CxDx__3GPP__Server__Assignment__Type_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.CxDx_3GPP_Server_Assignment_Type"); } is_ifpresent = param.get_ifpresent(); } void CxDx__3GPP__Server__Assignment__Type_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.CxDx_3GPP_Server_Assignment_Type"); } PCC__3GPP__IP__CAN__Session__Charging__Scope::PCC__3GPP__IP__CAN__Session__Charging__Scope() { enum_value = UNBOUND_VALUE; } PCC__3GPP__IP__CAN__Session__Charging__Scope::PCC__3GPP__IP__CAN__Session__Charging__Scope(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Session_Charging_Scope with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } PCC__3GPP__IP__CAN__Session__Charging__Scope::PCC__3GPP__IP__CAN__Session__Charging__Scope(enum_type other_value) { enum_value = other_value; } PCC__3GPP__IP__CAN__Session__Charging__Scope::PCC__3GPP__IP__CAN__Session__Charging__Scope(const PCC__3GPP__IP__CAN__Session__Charging__Scope& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Session_Charging_Scope."); enum_value = other_value.enum_value; } PCC__3GPP__IP__CAN__Session__Charging__Scope& PCC__3GPP__IP__CAN__Session__Charging__Scope::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Session_Charging_Scope.", other_value); enum_value = (enum_type)other_value; return *this; } PCC__3GPP__IP__CAN__Session__Charging__Scope& PCC__3GPP__IP__CAN__Session__Charging__Scope::operator=(enum_type other_value) { enum_value = other_value; return *this; } PCC__3GPP__IP__CAN__Session__Charging__Scope& PCC__3GPP__IP__CAN__Session__Charging__Scope::operator=(const PCC__3GPP__IP__CAN__Session__Charging__Scope& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Session_Charging_Scope."); enum_value = other_value.enum_value; return *this; } boolean PCC__3GPP__IP__CAN__Session__Charging__Scope::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Session_Charging_Scope."); return enum_value == other_value; } boolean PCC__3GPP__IP__CAN__Session__Charging__Scope::operator==(const PCC__3GPP__IP__CAN__Session__Charging__Scope& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Session_Charging_Scope."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Session_Charging_Scope."); return enum_value == other_value.enum_value; } boolean PCC__3GPP__IP__CAN__Session__Charging__Scope::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Session_Charging_Scope."); return enum_value < other_value; } boolean PCC__3GPP__IP__CAN__Session__Charging__Scope::operator<(const PCC__3GPP__IP__CAN__Session__Charging__Scope& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Session_Charging_Scope."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Session_Charging_Scope."); return enum_value < other_value.enum_value; } boolean PCC__3GPP__IP__CAN__Session__Charging__Scope::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Session_Charging_Scope."); return enum_value > other_value; } boolean PCC__3GPP__IP__CAN__Session__Charging__Scope::operator>(const PCC__3GPP__IP__CAN__Session__Charging__Scope& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Session_Charging_Scope."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Session_Charging_Scope."); return enum_value > other_value.enum_value; } const char *PCC__3GPP__IP__CAN__Session__Charging__Scope::enum_to_str(enum_type enum_par) { switch (enum_par) { case IP__CAN__SESSION__SCOPE: return "IP_CAN_SESSION_SCOPE"; default: return ""; } } PCC__3GPP__IP__CAN__Session__Charging__Scope::enum_type PCC__3GPP__IP__CAN__Session__Charging__Scope::str_to_enum(const char *str_par) { if (!strcmp(str_par, "IP_CAN_SESSION_SCOPE")) return IP__CAN__SESSION__SCOPE; else return UNKNOWN_VALUE; } boolean PCC__3GPP__IP__CAN__Session__Charging__Scope::is_valid_enum(int int_par) { switch (int_par) { case 0: return TRUE; default: return FALSE; } } int PCC__3GPP__IP__CAN__Session__Charging__Scope::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Session_Charging_Scope.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int PCC__3GPP__IP__CAN__Session__Charging__Scope::enum2int(const PCC__3GPP__IP__CAN__Session__Charging__Scope& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Session_Charging_Scope.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void PCC__3GPP__IP__CAN__Session__Charging__Scope::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Session_Charging_Scope.", int_val); enum_value = (enum_type)int_val; } PCC__3GPP__IP__CAN__Session__Charging__Scope::operator PCC__3GPP__IP__CAN__Session__Charging__Scope::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Session_Charging_Scope."); return enum_value; } void PCC__3GPP__IP__CAN__Session__Charging__Scope::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void PCC__3GPP__IP__CAN__Session__Charging__Scope::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.PCC_3GPP_IP_CAN_Session_Charging_Scope"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.PCC_3GPP_IP_CAN_Session_Charging_Scope."); } } void PCC__3GPP__IP__CAN__Session__Charging__Scope::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Session_Charging_Scope."); text_buf.push_int(enum_value); } void PCC__3GPP__IP__CAN__Session__Charging__Scope::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Session_Charging_Scope.", enum_value); } void PCC__3GPP__IP__CAN__Session__Charging__Scope::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void PCC__3GPP__IP__CAN__Session__Charging__Scope::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int PCC__3GPP__IP__CAN__Session__Charging__Scope::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 1, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int PCC__3GPP__IP__CAN__Session__Charging__Scope::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 1); } void PCC__3GPP__IP__CAN__Session__Charging__Scope_template::copy_template(const PCC__3GPP__IP__CAN__Session__Charging__Scope_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new PCC__3GPP__IP__CAN__Session__Charging__Scope_template[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 PCC__3GPP__IP__CAN__Session__Charging__Scope_template(*other_value.implication_.precondition); implication_.implied_template = new PCC__3GPP__IP__CAN__Session__Charging__Scope_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Session_Charging_Scope."); } } PCC__3GPP__IP__CAN__Session__Charging__Scope_template::PCC__3GPP__IP__CAN__Session__Charging__Scope_template() { } PCC__3GPP__IP__CAN__Session__Charging__Scope_template::PCC__3GPP__IP__CAN__Session__Charging__Scope_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } PCC__3GPP__IP__CAN__Session__Charging__Scope_template::PCC__3GPP__IP__CAN__Session__Charging__Scope_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!PCC__3GPP__IP__CAN__Session__Charging__Scope::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Session_Charging_Scope with unknown numeric value %d.", other_value); single_value = (PCC__3GPP__IP__CAN__Session__Charging__Scope::enum_type)other_value; } PCC__3GPP__IP__CAN__Session__Charging__Scope_template::PCC__3GPP__IP__CAN__Session__Charging__Scope_template(PCC__3GPP__IP__CAN__Session__Charging__Scope::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } PCC__3GPP__IP__CAN__Session__Charging__Scope_template::PCC__3GPP__IP__CAN__Session__Charging__Scope_template(const PCC__3GPP__IP__CAN__Session__Charging__Scope& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == PCC__3GPP__IP__CAN__Session__Charging__Scope::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Session_Charging_Scope."); single_value = other_value.enum_value; } PCC__3GPP__IP__CAN__Session__Charging__Scope_template::PCC__3GPP__IP__CAN__Session__Charging__Scope_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (PCC__3GPP__IP__CAN__Session__Charging__Scope::enum_type)(const PCC__3GPP__IP__CAN__Session__Charging__Scope&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Session_Charging_Scope from an unbound optional field."); } } PCC__3GPP__IP__CAN__Session__Charging__Scope_template::PCC__3GPP__IP__CAN__Session__Charging__Scope_template(PCC__3GPP__IP__CAN__Session__Charging__Scope_template* p_precondition, PCC__3GPP__IP__CAN__Session__Charging__Scope_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } PCC__3GPP__IP__CAN__Session__Charging__Scope_template::PCC__3GPP__IP__CAN__Session__Charging__Scope_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; } PCC__3GPP__IP__CAN__Session__Charging__Scope_template::PCC__3GPP__IP__CAN__Session__Charging__Scope_template(const PCC__3GPP__IP__CAN__Session__Charging__Scope_template& other_value) : Base_Template() { copy_template(other_value); } PCC__3GPP__IP__CAN__Session__Charging__Scope_template::~PCC__3GPP__IP__CAN__Session__Charging__Scope_template() { clean_up(); } boolean PCC__3GPP__IP__CAN__Session__Charging__Scope_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean PCC__3GPP__IP__CAN__Session__Charging__Scope_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != PCC__3GPP__IP__CAN__Session__Charging__Scope::UNBOUND_VALUE; } void PCC__3GPP__IP__CAN__Session__Charging__Scope_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } PCC__3GPP__IP__CAN__Session__Charging__Scope_template& PCC__3GPP__IP__CAN__Session__Charging__Scope_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } PCC__3GPP__IP__CAN__Session__Charging__Scope_template& PCC__3GPP__IP__CAN__Session__Charging__Scope_template::operator=(int other_value) { if (!PCC__3GPP__IP__CAN__Session__Charging__Scope::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Session_Charging_Scope.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (PCC__3GPP__IP__CAN__Session__Charging__Scope::enum_type)other_value; return *this; } PCC__3GPP__IP__CAN__Session__Charging__Scope_template& PCC__3GPP__IP__CAN__Session__Charging__Scope_template::operator=(PCC__3GPP__IP__CAN__Session__Charging__Scope::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } PCC__3GPP__IP__CAN__Session__Charging__Scope_template& PCC__3GPP__IP__CAN__Session__Charging__Scope_template::operator=(const PCC__3GPP__IP__CAN__Session__Charging__Scope& other_value) { if (other_value.enum_value == PCC__3GPP__IP__CAN__Session__Charging__Scope::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Session_Charging_Scope to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } PCC__3GPP__IP__CAN__Session__Charging__Scope_template& PCC__3GPP__IP__CAN__Session__Charging__Scope_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (PCC__3GPP__IP__CAN__Session__Charging__Scope::enum_type)(const PCC__3GPP__IP__CAN__Session__Charging__Scope&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Session_Charging_Scope."); } return *this; } PCC__3GPP__IP__CAN__Session__Charging__Scope_template& PCC__3GPP__IP__CAN__Session__Charging__Scope_template::operator=(const PCC__3GPP__IP__CAN__Session__Charging__Scope_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean PCC__3GPP__IP__CAN__Session__Charging__Scope_template::match(PCC__3GPP__IP__CAN__Session__Charging__Scope::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Session_Charging_Scope."); } return FALSE; } boolean PCC__3GPP__IP__CAN__Session__Charging__Scope_template::match(const PCC__3GPP__IP__CAN__Session__Charging__Scope& other_value, boolean) const { if (other_value.enum_value == PCC__3GPP__IP__CAN__Session__Charging__Scope::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Session_Charging_Scope with an unbound value."); return match(other_value.enum_value); } PCC__3GPP__IP__CAN__Session__Charging__Scope::enum_type PCC__3GPP__IP__CAN__Session__Charging__Scope_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Session_Charging_Scope."); return single_value; } void PCC__3GPP__IP__CAN__Session__Charging__Scope_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Session_Charging_Scope."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new PCC__3GPP__IP__CAN__Session__Charging__Scope_template[list_length]; } PCC__3GPP__IP__CAN__Session__Charging__Scope_template& PCC__3GPP__IP__CAN__Session__Charging__Scope_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Session_Charging_Scope."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Session_Charging_Scope."); return value_list.list_value[list_index]; } void PCC__3GPP__IP__CAN__Session__Charging__Scope_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(PCC__3GPP__IP__CAN__Session__Charging__Scope::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void PCC__3GPP__IP__CAN__Session__Charging__Scope_template::log_match(const PCC__3GPP__IP__CAN__Session__Charging__Scope& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void PCC__3GPP__IP__CAN__Session__Charging__Scope_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Session_Charging_Scope."); } } void PCC__3GPP__IP__CAN__Session__Charging__Scope_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (PCC__3GPP__IP__CAN__Session__Charging__Scope::enum_type)text_buf.pull_int().get_val(); if (!PCC__3GPP__IP__CAN__Session__Charging__Scope::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Session_Charging_Scope.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new PCC__3GPP__IP__CAN__Session__Charging__Scope_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.PCC_3GPP_IP_CAN_Session_Charging_Scope."); } } boolean PCC__3GPP__IP__CAN__Session__Charging__Scope_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean PCC__3GPP__IP__CAN__Session__Charging__Scope_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { PCC__3GPP__IP__CAN__Session__Charging__Scope_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { PCC__3GPP__IP__CAN__Session__Charging__Scope::enum_type enum_val = PCC__3GPP__IP__CAN__Session__Charging__Scope::str_to_enum(m_p->get_enumerated()); if (!PCC__3GPP__IP__CAN__Session__Charging__Scope::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.PCC_3GPP_IP_CAN_Session_Charging_Scope."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { PCC__3GPP__IP__CAN__Session__Charging__Scope_template* precondition = new PCC__3GPP__IP__CAN__Session__Charging__Scope_template; precondition->set_param(*m_p->get_elem(0)); PCC__3GPP__IP__CAN__Session__Charging__Scope_template* implied_template = new PCC__3GPP__IP__CAN__Session__Charging__Scope_template; implied_template->set_param(*m_p->get_elem(1)); *this = PCC__3GPP__IP__CAN__Session__Charging__Scope_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.PCC_3GPP_IP_CAN_Session_Charging_Scope"); } is_ifpresent = param.get_ifpresent(); } void PCC__3GPP__IP__CAN__Session__Charging__Scope_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.PCC_3GPP_IP_CAN_Session_Charging_Scope"); } DNAS__NONE__Framed__Routing::DNAS__NONE__Framed__Routing() { enum_value = UNBOUND_VALUE; } DNAS__NONE__Framed__Routing::DNAS__NONE__Framed__Routing(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Routing with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } DNAS__NONE__Framed__Routing::DNAS__NONE__Framed__Routing(enum_type other_value) { enum_value = other_value; } DNAS__NONE__Framed__Routing::DNAS__NONE__Framed__Routing(const DNAS__NONE__Framed__Routing& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Routing."); enum_value = other_value.enum_value; } DNAS__NONE__Framed__Routing& DNAS__NONE__Framed__Routing::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Routing.", other_value); enum_value = (enum_type)other_value; return *this; } DNAS__NONE__Framed__Routing& DNAS__NONE__Framed__Routing::operator=(enum_type other_value) { enum_value = other_value; return *this; } DNAS__NONE__Framed__Routing& DNAS__NONE__Framed__Routing::operator=(const DNAS__NONE__Framed__Routing& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Routing."); enum_value = other_value.enum_value; return *this; } boolean DNAS__NONE__Framed__Routing::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Routing."); return enum_value == other_value; } boolean DNAS__NONE__Framed__Routing::operator==(const DNAS__NONE__Framed__Routing& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Routing."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Routing."); return enum_value == other_value.enum_value; } boolean DNAS__NONE__Framed__Routing::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Routing."); return enum_value < other_value; } boolean DNAS__NONE__Framed__Routing::operator<(const DNAS__NONE__Framed__Routing& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Routing."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Routing."); return enum_value < other_value.enum_value; } boolean DNAS__NONE__Framed__Routing::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Routing."); return enum_value > other_value; } boolean DNAS__NONE__Framed__Routing::operator>(const DNAS__NONE__Framed__Routing& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Routing."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Routing."); return enum_value > other_value.enum_value; } const char *DNAS__NONE__Framed__Routing::enum_to_str(enum_type enum_par) { switch (enum_par) { case NONE_: return "NONE"; case SEND__ROUTING__PACKETS: return "SEND_ROUTING_PACKETS"; case LISTEN__FOR__ROUTING__PACKETS: return "LISTEN_FOR_ROUTING_PACKETS"; case SEND__AND__LISTEN: return "SEND_AND_LISTEN"; default: return ""; } } DNAS__NONE__Framed__Routing::enum_type DNAS__NONE__Framed__Routing::str_to_enum(const char *str_par) { if (!strcmp(str_par, "NONE")) return NONE_; else if (!strcmp(str_par, "SEND_ROUTING_PACKETS")) return SEND__ROUTING__PACKETS; else if (!strcmp(str_par, "LISTEN_FOR_ROUTING_PACKETS")) return LISTEN__FOR__ROUTING__PACKETS; else if (!strcmp(str_par, "SEND_AND_LISTEN")) return SEND__AND__LISTEN; else return UNKNOWN_VALUE; } boolean DNAS__NONE__Framed__Routing::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: case 2: case 3: return TRUE; default: return FALSE; } } int DNAS__NONE__Framed__Routing::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Routing.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int DNAS__NONE__Framed__Routing::enum2int(const DNAS__NONE__Framed__Routing& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Routing.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void DNAS__NONE__Framed__Routing::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Routing.", int_val); enum_value = (enum_type)int_val; } DNAS__NONE__Framed__Routing::operator DNAS__NONE__Framed__Routing::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Routing."); return enum_value; } void DNAS__NONE__Framed__Routing::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void DNAS__NONE__Framed__Routing::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.DNAS_NONE_Framed_Routing"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DNAS_NONE_Framed_Routing."); } } void DNAS__NONE__Framed__Routing::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Routing."); text_buf.push_int(enum_value); } void DNAS__NONE__Framed__Routing::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Routing.", enum_value); } void DNAS__NONE__Framed__Routing::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void DNAS__NONE__Framed__Routing::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int DNAS__NONE__Framed__Routing::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 3, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int DNAS__NONE__Framed__Routing::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 3); } void DNAS__NONE__Framed__Routing_template::copy_template(const DNAS__NONE__Framed__Routing_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new DNAS__NONE__Framed__Routing_template[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 DNAS__NONE__Framed__Routing_template(*other_value.implication_.precondition); implication_.implied_template = new DNAS__NONE__Framed__Routing_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Routing."); } } DNAS__NONE__Framed__Routing_template::DNAS__NONE__Framed__Routing_template() { } DNAS__NONE__Framed__Routing_template::DNAS__NONE__Framed__Routing_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } DNAS__NONE__Framed__Routing_template::DNAS__NONE__Framed__Routing_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!DNAS__NONE__Framed__Routing::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Routing with unknown numeric value %d.", other_value); single_value = (DNAS__NONE__Framed__Routing::enum_type)other_value; } DNAS__NONE__Framed__Routing_template::DNAS__NONE__Framed__Routing_template(DNAS__NONE__Framed__Routing::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } DNAS__NONE__Framed__Routing_template::DNAS__NONE__Framed__Routing_template(const DNAS__NONE__Framed__Routing& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == DNAS__NONE__Framed__Routing::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Routing."); single_value = other_value.enum_value; } DNAS__NONE__Framed__Routing_template::DNAS__NONE__Framed__Routing_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DNAS__NONE__Framed__Routing::enum_type)(const DNAS__NONE__Framed__Routing&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Routing from an unbound optional field."); } } DNAS__NONE__Framed__Routing_template::DNAS__NONE__Framed__Routing_template(DNAS__NONE__Framed__Routing_template* p_precondition, DNAS__NONE__Framed__Routing_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } DNAS__NONE__Framed__Routing_template::DNAS__NONE__Framed__Routing_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; } DNAS__NONE__Framed__Routing_template::DNAS__NONE__Framed__Routing_template(const DNAS__NONE__Framed__Routing_template& other_value) : Base_Template() { copy_template(other_value); } DNAS__NONE__Framed__Routing_template::~DNAS__NONE__Framed__Routing_template() { clean_up(); } boolean DNAS__NONE__Framed__Routing_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean DNAS__NONE__Framed__Routing_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != DNAS__NONE__Framed__Routing::UNBOUND_VALUE; } void DNAS__NONE__Framed__Routing_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } DNAS__NONE__Framed__Routing_template& DNAS__NONE__Framed__Routing_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } DNAS__NONE__Framed__Routing_template& DNAS__NONE__Framed__Routing_template::operator=(int other_value) { if (!DNAS__NONE__Framed__Routing::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Routing.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (DNAS__NONE__Framed__Routing::enum_type)other_value; return *this; } DNAS__NONE__Framed__Routing_template& DNAS__NONE__Framed__Routing_template::operator=(DNAS__NONE__Framed__Routing::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } DNAS__NONE__Framed__Routing_template& DNAS__NONE__Framed__Routing_template::operator=(const DNAS__NONE__Framed__Routing& other_value) { if (other_value.enum_value == DNAS__NONE__Framed__Routing::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Routing to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } DNAS__NONE__Framed__Routing_template& DNAS__NONE__Framed__Routing_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DNAS__NONE__Framed__Routing::enum_type)(const DNAS__NONE__Framed__Routing&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Routing."); } return *this; } DNAS__NONE__Framed__Routing_template& DNAS__NONE__Framed__Routing_template::operator=(const DNAS__NONE__Framed__Routing_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean DNAS__NONE__Framed__Routing_template::match(DNAS__NONE__Framed__Routing::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Routing."); } return FALSE; } boolean DNAS__NONE__Framed__Routing_template::match(const DNAS__NONE__Framed__Routing& other_value, boolean) const { if (other_value.enum_value == DNAS__NONE__Framed__Routing::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Routing with an unbound value."); return match(other_value.enum_value); } DNAS__NONE__Framed__Routing::enum_type DNAS__NONE__Framed__Routing_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Routing."); return single_value; } void DNAS__NONE__Framed__Routing_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Routing."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new DNAS__NONE__Framed__Routing_template[list_length]; } DNAS__NONE__Framed__Routing_template& DNAS__NONE__Framed__Routing_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Routing."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Routing."); return value_list.list_value[list_index]; } void DNAS__NONE__Framed__Routing_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(DNAS__NONE__Framed__Routing::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void DNAS__NONE__Framed__Routing_template::log_match(const DNAS__NONE__Framed__Routing& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void DNAS__NONE__Framed__Routing_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Routing."); } } void DNAS__NONE__Framed__Routing_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (DNAS__NONE__Framed__Routing::enum_type)text_buf.pull_int().get_val(); if (!DNAS__NONE__Framed__Routing::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Routing.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new DNAS__NONE__Framed__Routing_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Routing."); } } boolean DNAS__NONE__Framed__Routing_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean DNAS__NONE__Framed__Routing_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { DNAS__NONE__Framed__Routing_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { DNAS__NONE__Framed__Routing::enum_type enum_val = DNAS__NONE__Framed__Routing::str_to_enum(m_p->get_enumerated()); if (!DNAS__NONE__Framed__Routing::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DNAS_NONE_Framed_Routing."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { DNAS__NONE__Framed__Routing_template* precondition = new DNAS__NONE__Framed__Routing_template; precondition->set_param(*m_p->get_elem(0)); DNAS__NONE__Framed__Routing_template* implied_template = new DNAS__NONE__Framed__Routing_template; implied_template->set_param(*m_p->get_elem(1)); *this = DNAS__NONE__Framed__Routing_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.DNAS_NONE_Framed_Routing"); } is_ifpresent = param.get_ifpresent(); } void DNAS__NONE__Framed__Routing_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.DNAS_NONE_Framed_Routing"); } DCA__3GPP__Time__Quota__Type::DCA__3GPP__Time__Quota__Type() { enum_value = UNBOUND_VALUE; } DCA__3GPP__Time__Quota__Type::DCA__3GPP__Time__Quota__Type(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Time_Quota_Type with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } DCA__3GPP__Time__Quota__Type::DCA__3GPP__Time__Quota__Type(enum_type other_value) { enum_value = other_value; } DCA__3GPP__Time__Quota__Type::DCA__3GPP__Time__Quota__Type(const DCA__3GPP__Time__Quota__Type& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Time_Quota_Type."); enum_value = other_value.enum_value; } DCA__3GPP__Time__Quota__Type& DCA__3GPP__Time__Quota__Type::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Time_Quota_Type.", other_value); enum_value = (enum_type)other_value; return *this; } DCA__3GPP__Time__Quota__Type& DCA__3GPP__Time__Quota__Type::operator=(enum_type other_value) { enum_value = other_value; return *this; } DCA__3GPP__Time__Quota__Type& DCA__3GPP__Time__Quota__Type::operator=(const DCA__3GPP__Time__Quota__Type& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Time_Quota_Type."); enum_value = other_value.enum_value; return *this; } boolean DCA__3GPP__Time__Quota__Type::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Time_Quota_Type."); return enum_value == other_value; } boolean DCA__3GPP__Time__Quota__Type::operator==(const DCA__3GPP__Time__Quota__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Time_Quota_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Time_Quota_Type."); return enum_value == other_value.enum_value; } boolean DCA__3GPP__Time__Quota__Type::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Time_Quota_Type."); return enum_value < other_value; } boolean DCA__3GPP__Time__Quota__Type::operator<(const DCA__3GPP__Time__Quota__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Time_Quota_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Time_Quota_Type."); return enum_value < other_value.enum_value; } boolean DCA__3GPP__Time__Quota__Type::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Time_Quota_Type."); return enum_value > other_value; } boolean DCA__3GPP__Time__Quota__Type::operator>(const DCA__3GPP__Time__Quota__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Time_Quota_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Time_Quota_Type."); return enum_value > other_value.enum_value; } const char *DCA__3GPP__Time__Quota__Type::enum_to_str(enum_type enum_par) { switch (enum_par) { case DISCRETE__TIME__PERIOD: return "DISCRETE_TIME_PERIOD"; case CONTINUOUS__TIME__PERIOD: return "CONTINUOUS_TIME_PERIOD"; default: return ""; } } DCA__3GPP__Time__Quota__Type::enum_type DCA__3GPP__Time__Quota__Type::str_to_enum(const char *str_par) { if (!strcmp(str_par, "DISCRETE_TIME_PERIOD")) return DISCRETE__TIME__PERIOD; else if (!strcmp(str_par, "CONTINUOUS_TIME_PERIOD")) return CONTINUOUS__TIME__PERIOD; else return UNKNOWN_VALUE; } boolean DCA__3GPP__Time__Quota__Type::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: return TRUE; default: return FALSE; } } int DCA__3GPP__Time__Quota__Type::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_Time_Quota_Type.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int DCA__3GPP__Time__Quota__Type::enum2int(const DCA__3GPP__Time__Quota__Type& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_Time_Quota_Type.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void DCA__3GPP__Time__Quota__Type::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Time_Quota_Type.", int_val); enum_value = (enum_type)int_val; } DCA__3GPP__Time__Quota__Type::operator DCA__3GPP__Time__Quota__Type::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.DCA_3GPP_Time_Quota_Type."); return enum_value; } void DCA__3GPP__Time__Quota__Type::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void DCA__3GPP__Time__Quota__Type::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.DCA_3GPP_Time_Quota_Type"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_Time_Quota_Type."); } } void DCA__3GPP__Time__Quota__Type::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Time_Quota_Type."); text_buf.push_int(enum_value); } void DCA__3GPP__Time__Quota__Type::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.DCA_3GPP_Time_Quota_Type.", enum_value); } void DCA__3GPP__Time__Quota__Type::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void DCA__3GPP__Time__Quota__Type::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int DCA__3GPP__Time__Quota__Type::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int DCA__3GPP__Time__Quota__Type::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void DCA__3GPP__Time__Quota__Type_template::copy_template(const DCA__3GPP__Time__Quota__Type_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new DCA__3GPP__Time__Quota__Type_template[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 DCA__3GPP__Time__Quota__Type_template(*other_value.implication_.precondition); implication_.implied_template = new DCA__3GPP__Time__Quota__Type_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Time_Quota_Type."); } } DCA__3GPP__Time__Quota__Type_template::DCA__3GPP__Time__Quota__Type_template() { } DCA__3GPP__Time__Quota__Type_template::DCA__3GPP__Time__Quota__Type_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } DCA__3GPP__Time__Quota__Type_template::DCA__3GPP__Time__Quota__Type_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!DCA__3GPP__Time__Quota__Type::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.DCA_3GPP_Time_Quota_Type with unknown numeric value %d.", other_value); single_value = (DCA__3GPP__Time__Quota__Type::enum_type)other_value; } DCA__3GPP__Time__Quota__Type_template::DCA__3GPP__Time__Quota__Type_template(DCA__3GPP__Time__Quota__Type::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } DCA__3GPP__Time__Quota__Type_template::DCA__3GPP__Time__Quota__Type_template(const DCA__3GPP__Time__Quota__Type& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == DCA__3GPP__Time__Quota__Type::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Time_Quota_Type."); single_value = other_value.enum_value; } DCA__3GPP__Time__Quota__Type_template::DCA__3GPP__Time__Quota__Type_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Time__Quota__Type::enum_type)(const DCA__3GPP__Time__Quota__Type&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.DCA_3GPP_Time_Quota_Type from an unbound optional field."); } } DCA__3GPP__Time__Quota__Type_template::DCA__3GPP__Time__Quota__Type_template(DCA__3GPP__Time__Quota__Type_template* p_precondition, DCA__3GPP__Time__Quota__Type_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } DCA__3GPP__Time__Quota__Type_template::DCA__3GPP__Time__Quota__Type_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; } DCA__3GPP__Time__Quota__Type_template::DCA__3GPP__Time__Quota__Type_template(const DCA__3GPP__Time__Quota__Type_template& other_value) : Base_Template() { copy_template(other_value); } DCA__3GPP__Time__Quota__Type_template::~DCA__3GPP__Time__Quota__Type_template() { clean_up(); } boolean DCA__3GPP__Time__Quota__Type_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean DCA__3GPP__Time__Quota__Type_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != DCA__3GPP__Time__Quota__Type::UNBOUND_VALUE; } void DCA__3GPP__Time__Quota__Type_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } DCA__3GPP__Time__Quota__Type_template& DCA__3GPP__Time__Quota__Type_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } DCA__3GPP__Time__Quota__Type_template& DCA__3GPP__Time__Quota__Type_template::operator=(int other_value) { if (!DCA__3GPP__Time__Quota__Type::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.DCA_3GPP_Time_Quota_Type.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Time__Quota__Type::enum_type)other_value; return *this; } DCA__3GPP__Time__Quota__Type_template& DCA__3GPP__Time__Quota__Type_template::operator=(DCA__3GPP__Time__Quota__Type::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } DCA__3GPP__Time__Quota__Type_template& DCA__3GPP__Time__Quota__Type_template::operator=(const DCA__3GPP__Time__Quota__Type& other_value) { if (other_value.enum_value == DCA__3GPP__Time__Quota__Type::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Time_Quota_Type to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } DCA__3GPP__Time__Quota__Type_template& DCA__3GPP__Time__Quota__Type_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Time__Quota__Type::enum_type)(const DCA__3GPP__Time__Quota__Type&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.DCA_3GPP_Time_Quota_Type."); } return *this; } DCA__3GPP__Time__Quota__Type_template& DCA__3GPP__Time__Quota__Type_template::operator=(const DCA__3GPP__Time__Quota__Type_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean DCA__3GPP__Time__Quota__Type_template::match(DCA__3GPP__Time__Quota__Type::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Time_Quota_Type."); } return FALSE; } boolean DCA__3GPP__Time__Quota__Type_template::match(const DCA__3GPP__Time__Quota__Type& other_value, boolean) const { if (other_value.enum_value == DCA__3GPP__Time__Quota__Type::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.DCA_3GPP_Time_Quota_Type with an unbound value."); return match(other_value.enum_value); } DCA__3GPP__Time__Quota__Type::enum_type DCA__3GPP__Time__Quota__Type_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.DCA_3GPP_Time_Quota_Type."); return single_value; } void DCA__3GPP__Time__Quota__Type_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Time_Quota_Type."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new DCA__3GPP__Time__Quota__Type_template[list_length]; } DCA__3GPP__Time__Quota__Type_template& DCA__3GPP__Time__Quota__Type_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.DCA_3GPP_Time_Quota_Type."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.DCA_3GPP_Time_Quota_Type."); return value_list.list_value[list_index]; } void DCA__3GPP__Time__Quota__Type_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(DCA__3GPP__Time__Quota__Type::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void DCA__3GPP__Time__Quota__Type_template::log_match(const DCA__3GPP__Time__Quota__Type& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void DCA__3GPP__Time__Quota__Type_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Time_Quota_Type."); } } void DCA__3GPP__Time__Quota__Type_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (DCA__3GPP__Time__Quota__Type::enum_type)text_buf.pull_int().get_val(); if (!DCA__3GPP__Time__Quota__Type::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Time_Quota_Type.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new DCA__3GPP__Time__Quota__Type_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Time_Quota_Type."); } } boolean DCA__3GPP__Time__Quota__Type_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean DCA__3GPP__Time__Quota__Type_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { DCA__3GPP__Time__Quota__Type_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { DCA__3GPP__Time__Quota__Type::enum_type enum_val = DCA__3GPP__Time__Quota__Type::str_to_enum(m_p->get_enumerated()); if (!DCA__3GPP__Time__Quota__Type::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_Time_Quota_Type."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { DCA__3GPP__Time__Quota__Type_template* precondition = new DCA__3GPP__Time__Quota__Type_template; precondition->set_param(*m_p->get_elem(0)); DCA__3GPP__Time__Quota__Type_template* implied_template = new DCA__3GPP__Time__Quota__Type_template; implied_template->set_param(*m_p->get_elem(1)); *this = DCA__3GPP__Time__Quota__Type_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.DCA_3GPP_Time_Quota_Type"); } is_ifpresent = param.get_ifpresent(); } void DCA__3GPP__Time__Quota__Type_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.DCA_3GPP_Time_Quota_Type"); } RX__3GPP__Priority__Sharing__Indicator::RX__3GPP__Priority__Sharing__Indicator() { enum_value = UNBOUND_VALUE; } RX__3GPP__Priority__Sharing__Indicator::RX__3GPP__Priority__Sharing__Indicator(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.RX_3GPP_Priority_Sharing_Indicator with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } RX__3GPP__Priority__Sharing__Indicator::RX__3GPP__Priority__Sharing__Indicator(enum_type other_value) { enum_value = other_value; } RX__3GPP__Priority__Sharing__Indicator::RX__3GPP__Priority__Sharing__Indicator(const RX__3GPP__Priority__Sharing__Indicator& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Priority_Sharing_Indicator."); enum_value = other_value.enum_value; } RX__3GPP__Priority__Sharing__Indicator& RX__3GPP__Priority__Sharing__Indicator::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.RX_3GPP_Priority_Sharing_Indicator.", other_value); enum_value = (enum_type)other_value; return *this; } RX__3GPP__Priority__Sharing__Indicator& RX__3GPP__Priority__Sharing__Indicator::operator=(enum_type other_value) { enum_value = other_value; return *this; } RX__3GPP__Priority__Sharing__Indicator& RX__3GPP__Priority__Sharing__Indicator::operator=(const RX__3GPP__Priority__Sharing__Indicator& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Priority_Sharing_Indicator."); enum_value = other_value.enum_value; return *this; } boolean RX__3GPP__Priority__Sharing__Indicator::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Priority_Sharing_Indicator."); return enum_value == other_value; } boolean RX__3GPP__Priority__Sharing__Indicator::operator==(const RX__3GPP__Priority__Sharing__Indicator& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Priority_Sharing_Indicator."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Priority_Sharing_Indicator."); return enum_value == other_value.enum_value; } boolean RX__3GPP__Priority__Sharing__Indicator::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Priority_Sharing_Indicator."); return enum_value < other_value; } boolean RX__3GPP__Priority__Sharing__Indicator::operator<(const RX__3GPP__Priority__Sharing__Indicator& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Priority_Sharing_Indicator."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Priority_Sharing_Indicator."); return enum_value < other_value.enum_value; } boolean RX__3GPP__Priority__Sharing__Indicator::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Priority_Sharing_Indicator."); return enum_value > other_value; } boolean RX__3GPP__Priority__Sharing__Indicator::operator>(const RX__3GPP__Priority__Sharing__Indicator& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Priority_Sharing_Indicator."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Priority_Sharing_Indicator."); return enum_value > other_value.enum_value; } const char *RX__3GPP__Priority__Sharing__Indicator::enum_to_str(enum_type enum_par) { switch (enum_par) { case PRIORITY__SHARING__ENABLED: return "PRIORITY_SHARING_ENABLED"; case PRIORITY__SHARING__DISABLED: return "PRIORITY_SHARING_DISABLED"; default: return ""; } } RX__3GPP__Priority__Sharing__Indicator::enum_type RX__3GPP__Priority__Sharing__Indicator::str_to_enum(const char *str_par) { if (!strcmp(str_par, "PRIORITY_SHARING_ENABLED")) return PRIORITY__SHARING__ENABLED; else if (!strcmp(str_par, "PRIORITY_SHARING_DISABLED")) return PRIORITY__SHARING__DISABLED; else return UNKNOWN_VALUE; } boolean RX__3GPP__Priority__Sharing__Indicator::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: return TRUE; default: return FALSE; } } int RX__3GPP__Priority__Sharing__Indicator::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.RX_3GPP_Priority_Sharing_Indicator.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int RX__3GPP__Priority__Sharing__Indicator::enum2int(const RX__3GPP__Priority__Sharing__Indicator& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.RX_3GPP_Priority_Sharing_Indicator.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void RX__3GPP__Priority__Sharing__Indicator::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.RX_3GPP_Priority_Sharing_Indicator.", int_val); enum_value = (enum_type)int_val; } RX__3GPP__Priority__Sharing__Indicator::operator RX__3GPP__Priority__Sharing__Indicator::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.RX_3GPP_Priority_Sharing_Indicator."); return enum_value; } void RX__3GPP__Priority__Sharing__Indicator::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void RX__3GPP__Priority__Sharing__Indicator::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.RX_3GPP_Priority_Sharing_Indicator"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.RX_3GPP_Priority_Sharing_Indicator."); } } void RX__3GPP__Priority__Sharing__Indicator::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Priority_Sharing_Indicator."); text_buf.push_int(enum_value); } void RX__3GPP__Priority__Sharing__Indicator::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.RX_3GPP_Priority_Sharing_Indicator.", enum_value); } void RX__3GPP__Priority__Sharing__Indicator::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void RX__3GPP__Priority__Sharing__Indicator::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int RX__3GPP__Priority__Sharing__Indicator::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int RX__3GPP__Priority__Sharing__Indicator::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void RX__3GPP__Priority__Sharing__Indicator_template::copy_template(const RX__3GPP__Priority__Sharing__Indicator_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new RX__3GPP__Priority__Sharing__Indicator_template[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 RX__3GPP__Priority__Sharing__Indicator_template(*other_value.implication_.precondition); implication_.implied_template = new RX__3GPP__Priority__Sharing__Indicator_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.RX_3GPP_Priority_Sharing_Indicator."); } } RX__3GPP__Priority__Sharing__Indicator_template::RX__3GPP__Priority__Sharing__Indicator_template() { } RX__3GPP__Priority__Sharing__Indicator_template::RX__3GPP__Priority__Sharing__Indicator_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } RX__3GPP__Priority__Sharing__Indicator_template::RX__3GPP__Priority__Sharing__Indicator_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!RX__3GPP__Priority__Sharing__Indicator::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.RX_3GPP_Priority_Sharing_Indicator with unknown numeric value %d.", other_value); single_value = (RX__3GPP__Priority__Sharing__Indicator::enum_type)other_value; } RX__3GPP__Priority__Sharing__Indicator_template::RX__3GPP__Priority__Sharing__Indicator_template(RX__3GPP__Priority__Sharing__Indicator::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } RX__3GPP__Priority__Sharing__Indicator_template::RX__3GPP__Priority__Sharing__Indicator_template(const RX__3GPP__Priority__Sharing__Indicator& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == RX__3GPP__Priority__Sharing__Indicator::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Priority_Sharing_Indicator."); single_value = other_value.enum_value; } RX__3GPP__Priority__Sharing__Indicator_template::RX__3GPP__Priority__Sharing__Indicator_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (RX__3GPP__Priority__Sharing__Indicator::enum_type)(const RX__3GPP__Priority__Sharing__Indicator&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.RX_3GPP_Priority_Sharing_Indicator from an unbound optional field."); } } RX__3GPP__Priority__Sharing__Indicator_template::RX__3GPP__Priority__Sharing__Indicator_template(RX__3GPP__Priority__Sharing__Indicator_template* p_precondition, RX__3GPP__Priority__Sharing__Indicator_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } RX__3GPP__Priority__Sharing__Indicator_template::RX__3GPP__Priority__Sharing__Indicator_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; } RX__3GPP__Priority__Sharing__Indicator_template::RX__3GPP__Priority__Sharing__Indicator_template(const RX__3GPP__Priority__Sharing__Indicator_template& other_value) : Base_Template() { copy_template(other_value); } RX__3GPP__Priority__Sharing__Indicator_template::~RX__3GPP__Priority__Sharing__Indicator_template() { clean_up(); } boolean RX__3GPP__Priority__Sharing__Indicator_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean RX__3GPP__Priority__Sharing__Indicator_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != RX__3GPP__Priority__Sharing__Indicator::UNBOUND_VALUE; } void RX__3GPP__Priority__Sharing__Indicator_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } RX__3GPP__Priority__Sharing__Indicator_template& RX__3GPP__Priority__Sharing__Indicator_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } RX__3GPP__Priority__Sharing__Indicator_template& RX__3GPP__Priority__Sharing__Indicator_template::operator=(int other_value) { if (!RX__3GPP__Priority__Sharing__Indicator::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.RX_3GPP_Priority_Sharing_Indicator.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (RX__3GPP__Priority__Sharing__Indicator::enum_type)other_value; return *this; } RX__3GPP__Priority__Sharing__Indicator_template& RX__3GPP__Priority__Sharing__Indicator_template::operator=(RX__3GPP__Priority__Sharing__Indicator::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } RX__3GPP__Priority__Sharing__Indicator_template& RX__3GPP__Priority__Sharing__Indicator_template::operator=(const RX__3GPP__Priority__Sharing__Indicator& other_value) { if (other_value.enum_value == RX__3GPP__Priority__Sharing__Indicator::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Priority_Sharing_Indicator to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } RX__3GPP__Priority__Sharing__Indicator_template& RX__3GPP__Priority__Sharing__Indicator_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (RX__3GPP__Priority__Sharing__Indicator::enum_type)(const RX__3GPP__Priority__Sharing__Indicator&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.RX_3GPP_Priority_Sharing_Indicator."); } return *this; } RX__3GPP__Priority__Sharing__Indicator_template& RX__3GPP__Priority__Sharing__Indicator_template::operator=(const RX__3GPP__Priority__Sharing__Indicator_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean RX__3GPP__Priority__Sharing__Indicator_template::match(RX__3GPP__Priority__Sharing__Indicator::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.RX_3GPP_Priority_Sharing_Indicator."); } return FALSE; } boolean RX__3GPP__Priority__Sharing__Indicator_template::match(const RX__3GPP__Priority__Sharing__Indicator& other_value, boolean) const { if (other_value.enum_value == RX__3GPP__Priority__Sharing__Indicator::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.RX_3GPP_Priority_Sharing_Indicator with an unbound value."); return match(other_value.enum_value); } RX__3GPP__Priority__Sharing__Indicator::enum_type RX__3GPP__Priority__Sharing__Indicator_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.RX_3GPP_Priority_Sharing_Indicator."); return single_value; } void RX__3GPP__Priority__Sharing__Indicator_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.RX_3GPP_Priority_Sharing_Indicator."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new RX__3GPP__Priority__Sharing__Indicator_template[list_length]; } RX__3GPP__Priority__Sharing__Indicator_template& RX__3GPP__Priority__Sharing__Indicator_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.RX_3GPP_Priority_Sharing_Indicator."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.RX_3GPP_Priority_Sharing_Indicator."); return value_list.list_value[list_index]; } void RX__3GPP__Priority__Sharing__Indicator_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(RX__3GPP__Priority__Sharing__Indicator::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void RX__3GPP__Priority__Sharing__Indicator_template::log_match(const RX__3GPP__Priority__Sharing__Indicator& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void RX__3GPP__Priority__Sharing__Indicator_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.RX_3GPP_Priority_Sharing_Indicator."); } } void RX__3GPP__Priority__Sharing__Indicator_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (RX__3GPP__Priority__Sharing__Indicator::enum_type)text_buf.pull_int().get_val(); if (!RX__3GPP__Priority__Sharing__Indicator::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.RX_3GPP_Priority_Sharing_Indicator.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new RX__3GPP__Priority__Sharing__Indicator_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.RX_3GPP_Priority_Sharing_Indicator."); } } boolean RX__3GPP__Priority__Sharing__Indicator_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean RX__3GPP__Priority__Sharing__Indicator_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { RX__3GPP__Priority__Sharing__Indicator_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { RX__3GPP__Priority__Sharing__Indicator::enum_type enum_val = RX__3GPP__Priority__Sharing__Indicator::str_to_enum(m_p->get_enumerated()); if (!RX__3GPP__Priority__Sharing__Indicator::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.RX_3GPP_Priority_Sharing_Indicator."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { RX__3GPP__Priority__Sharing__Indicator_template* precondition = new RX__3GPP__Priority__Sharing__Indicator_template; precondition->set_param(*m_p->get_elem(0)); RX__3GPP__Priority__Sharing__Indicator_template* implied_template = new RX__3GPP__Priority__Sharing__Indicator_template; implied_template->set_param(*m_p->get_elem(1)); *this = RX__3GPP__Priority__Sharing__Indicator_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.RX_3GPP_Priority_Sharing_Indicator"); } is_ifpresent = param.get_ifpresent(); } void RX__3GPP__Priority__Sharing__Indicator_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.RX_3GPP_Priority_Sharing_Indicator"); } DCA__3GPP__Trigger__Type::DCA__3GPP__Trigger__Type() { enum_value = UNBOUND_VALUE; } DCA__3GPP__Trigger__Type::DCA__3GPP__Trigger__Type(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Trigger_Type with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } DCA__3GPP__Trigger__Type::DCA__3GPP__Trigger__Type(enum_type other_value) { enum_value = other_value; } DCA__3GPP__Trigger__Type::DCA__3GPP__Trigger__Type(const DCA__3GPP__Trigger__Type& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Trigger_Type."); enum_value = other_value.enum_value; } DCA__3GPP__Trigger__Type& DCA__3GPP__Trigger__Type::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Trigger_Type.", other_value); enum_value = (enum_type)other_value; return *this; } DCA__3GPP__Trigger__Type& DCA__3GPP__Trigger__Type::operator=(enum_type other_value) { enum_value = other_value; return *this; } DCA__3GPP__Trigger__Type& DCA__3GPP__Trigger__Type::operator=(const DCA__3GPP__Trigger__Type& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Trigger_Type."); enum_value = other_value.enum_value; return *this; } boolean DCA__3GPP__Trigger__Type::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Trigger_Type."); return enum_value == other_value; } boolean DCA__3GPP__Trigger__Type::operator==(const DCA__3GPP__Trigger__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Trigger_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Trigger_Type."); return enum_value == other_value.enum_value; } boolean DCA__3GPP__Trigger__Type::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Trigger_Type."); return enum_value < other_value; } boolean DCA__3GPP__Trigger__Type::operator<(const DCA__3GPP__Trigger__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Trigger_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Trigger_Type."); return enum_value < other_value.enum_value; } boolean DCA__3GPP__Trigger__Type::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Trigger_Type."); return enum_value > other_value; } boolean DCA__3GPP__Trigger__Type::operator>(const DCA__3GPP__Trigger__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Trigger_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Trigger_Type."); return enum_value > other_value.enum_value; } const char *DCA__3GPP__Trigger__Type::enum_to_str(enum_type enum_par) { switch (enum_par) { case CHANGE__IN__SGSN__IP__ADDRESS: return "CHANGE_IN_SGSN_IP_ADDRESS"; case CHANGE__IN__QOS: return "CHANGE_IN_QOS"; case CHANGE__IN__LOCATION: return "CHANGE_IN_LOCATION"; case CHANGE__IN__RAT: return "CHANGE_IN_RAT"; case CHANGE__IN__UE__TIMEZONE: return "CHANGE_IN_UE_TIMEZONE"; case CHANGEINQOS__TRAFFIC__CLASS: return "CHANGEINQOS_TRAFFIC_CLASS"; case CHANGEINQOS__RELIABILITY__CLASS: return "CHANGEINQOS_RELIABILITY_CLASS"; case CHANGEINQOS__DELAY__CLASS: return "CHANGEINQOS_DELAY_CLASS"; case CHANGEINQOS__PEAK__THROUGHPUT: return "CHANGEINQOS_PEAK_THROUGHPUT"; case CHANGEINQOS__PRECEDENCE__CLASS: return "CHANGEINQOS_PRECEDENCE_CLASS"; case CHANGEINQOS__MEAN__THROUGHPUT: return "CHANGEINQOS_MEAN_THROUGHPUT"; case CHANGEINQOS__MAXIMUM__BIT__RATE__FOR__UPLINK: return "CHANGEINQOS_MAXIMUM_BIT_RATE_FOR_UPLINK"; case CHANGEINQOS__MAXIMUM__BIT__RATE__FOR__DOWNLINK: return "CHANGEINQOS_MAXIMUM_BIT_RATE_FOR_DOWNLINK"; case CHANGEINQOS__RESIDUAL__BER: return "CHANGEINQOS_RESIDUAL_BER"; case CHANGEINQOS__SDU__ERROR__RATIO: return "CHANGEINQOS_SDU_ERROR_RATIO"; case CHANGEINQOS__TRANSFER__DELAY: return "CHANGEINQOS_TRANSFER_DELAY"; case CHANGEINQOS__TRAFFIC__HANDLING__PRIORITY: return "CHANGEINQOS_TRAFFIC_HANDLING_PRIORITY"; case CHANGEINQOS__GUARANTEED__BIT__RATE__FOR__UPLINK: return "CHANGEINQOS_GUARANTEED_BIT_RATE_FOR_UPLINK"; case CHANGEINQOS__GUARANTEED__BIT__RATE__FOR__DOWNLINK: return "CHANGEINQOS_GUARANTEED_BIT_RATE_FOR_DOWNLINK"; case CHANGEINQOS__APN__AGGREGATE__MAXIMUM__BIT__RATE: return "CHANGEINQOS_APN_AGGREGATE_MAXIMUM_BIT_RATE"; case CHANGEINLOCATION__MCC: return "CHANGEINLOCATION_MCC"; case CHANGEINLOCATION__MNC: return "CHANGEINLOCATION_MNC"; case CHANGEINLOCATION__RAC: return "CHANGEINLOCATION_RAC"; case CHANGEINLOCATION__LAC: return "CHANGEINLOCATION_LAC"; case CHANGEINLOCATION__CellId: return "CHANGEINLOCATION_CellId"; case CHANGEINLOCATION__TAC: return "CHANGEINLOCATION_TAC"; case CHANGEINLOCATION__ECGI: return "CHANGEINLOCATION_ECGI"; case CHANGE__IN__MEDIA__COMPOSITION: return "CHANGE_IN_MEDIA_COMPOSITION"; case CHANGE__IN__PARTICIPANTS__NMB: return "CHANGE_IN_PARTICIPANTS_NMB"; case CHANGE__IN__THRSHLD__OF__PARTICIPANTS__NMB: return "CHANGE_IN_THRSHLD_OF_PARTICIPANTS_NMB"; case CHANGE__IN__USER__PARTICIPATING__TYPE: return "CHANGE_IN_USER_PARTICIPATING_TYPE"; case CHANGE__IN__SERVICE__CONDITION: return "CHANGE_IN_SERVICE_CONDITION"; case CHANGE__IN__SERVING__NODE: return "CHANGE_IN_SERVING_NODE"; case CHANGE__IN__ACCESS__FOR__A__SERVICE__DATA__FLOW: return "CHANGE_IN_ACCESS_FOR_A_SERVICE_DATA_FLOW"; case CHANGE__IN__USER__CSG__INFORMATION: return "CHANGE_IN_USER_CSG_INFORMATION"; case CHANGE__IN__HYBRID__SUBSCRIBED__USER__CSG__INFORMATION: return "CHANGE_IN_HYBRID_SUBSCRIBED_USER_CSG_INFORMATION"; case CHANGE__IN__HYBRID__UNSUBSCRIBED__USER__CSG__INFORMATION: return "CHANGE_IN_HYBRID_UNSUBSCRIBED_USER_CSG_INFORMATION"; case CHANGE__OF__UE__PRESENCE__IN__PRESENCE__REPORTING__AREA: return "CHANGE_OF_UE_PRESENCE_IN_PRESENCE_REPORTING_AREA"; case CHANGE__IN__SERVING__PLMN__RATE__CONTROL: return "CHANGE_IN_SERVING_PLMN_RATE_CONTROL"; case CHANGE__IN__APN__RATE__CONTROL: return "CHANGE_IN_APN_RATE_CONTROL"; default: return ""; } } DCA__3GPP__Trigger__Type::enum_type DCA__3GPP__Trigger__Type::str_to_enum(const char *str_par) { if (!strcmp(str_par, "CHANGE_IN_SGSN_IP_ADDRESS")) return CHANGE__IN__SGSN__IP__ADDRESS; else if (!strcmp(str_par, "CHANGE_IN_QOS")) return CHANGE__IN__QOS; else if (!strcmp(str_par, "CHANGE_IN_LOCATION")) return CHANGE__IN__LOCATION; else if (!strcmp(str_par, "CHANGE_IN_RAT")) return CHANGE__IN__RAT; else if (!strcmp(str_par, "CHANGE_IN_UE_TIMEZONE")) return CHANGE__IN__UE__TIMEZONE; else if (!strcmp(str_par, "CHANGEINQOS_TRAFFIC_CLASS")) return CHANGEINQOS__TRAFFIC__CLASS; else if (!strcmp(str_par, "CHANGEINQOS_RELIABILITY_CLASS")) return CHANGEINQOS__RELIABILITY__CLASS; else if (!strcmp(str_par, "CHANGEINQOS_DELAY_CLASS")) return CHANGEINQOS__DELAY__CLASS; else if (!strcmp(str_par, "CHANGEINQOS_PEAK_THROUGHPUT")) return CHANGEINQOS__PEAK__THROUGHPUT; else if (!strcmp(str_par, "CHANGEINQOS_PRECEDENCE_CLASS")) return CHANGEINQOS__PRECEDENCE__CLASS; else if (!strcmp(str_par, "CHANGEINQOS_MEAN_THROUGHPUT")) return CHANGEINQOS__MEAN__THROUGHPUT; else if (!strcmp(str_par, "CHANGEINQOS_MAXIMUM_BIT_RATE_FOR_UPLINK")) return CHANGEINQOS__MAXIMUM__BIT__RATE__FOR__UPLINK; else if (!strcmp(str_par, "CHANGEINQOS_MAXIMUM_BIT_RATE_FOR_DOWNLINK")) return CHANGEINQOS__MAXIMUM__BIT__RATE__FOR__DOWNLINK; else if (!strcmp(str_par, "CHANGEINQOS_RESIDUAL_BER")) return CHANGEINQOS__RESIDUAL__BER; else if (!strcmp(str_par, "CHANGEINQOS_SDU_ERROR_RATIO")) return CHANGEINQOS__SDU__ERROR__RATIO; else if (!strcmp(str_par, "CHANGEINQOS_TRANSFER_DELAY")) return CHANGEINQOS__TRANSFER__DELAY; else if (!strcmp(str_par, "CHANGEINQOS_TRAFFIC_HANDLING_PRIORITY")) return CHANGEINQOS__TRAFFIC__HANDLING__PRIORITY; else if (!strcmp(str_par, "CHANGEINQOS_GUARANTEED_BIT_RATE_FOR_UPLINK")) return CHANGEINQOS__GUARANTEED__BIT__RATE__FOR__UPLINK; else if (!strcmp(str_par, "CHANGEINQOS_GUARANTEED_BIT_RATE_FOR_DOWNLINK")) return CHANGEINQOS__GUARANTEED__BIT__RATE__FOR__DOWNLINK; else if (!strcmp(str_par, "CHANGEINQOS_APN_AGGREGATE_MAXIMUM_BIT_RATE")) return CHANGEINQOS__APN__AGGREGATE__MAXIMUM__BIT__RATE; else if (!strcmp(str_par, "CHANGEINLOCATION_MCC")) return CHANGEINLOCATION__MCC; else if (!strcmp(str_par, "CHANGEINLOCATION_MNC")) return CHANGEINLOCATION__MNC; else if (!strcmp(str_par, "CHANGEINLOCATION_RAC")) return CHANGEINLOCATION__RAC; else if (!strcmp(str_par, "CHANGEINLOCATION_LAC")) return CHANGEINLOCATION__LAC; else if (!strcmp(str_par, "CHANGEINLOCATION_CellId")) return CHANGEINLOCATION__CellId; else if (!strcmp(str_par, "CHANGEINLOCATION_TAC")) return CHANGEINLOCATION__TAC; else if (!strcmp(str_par, "CHANGEINLOCATION_ECGI")) return CHANGEINLOCATION__ECGI; else if (!strcmp(str_par, "CHANGE_IN_MEDIA_COMPOSITION")) return CHANGE__IN__MEDIA__COMPOSITION; else if (!strcmp(str_par, "CHANGE_IN_PARTICIPANTS_NMB")) return CHANGE__IN__PARTICIPANTS__NMB; else if (!strcmp(str_par, "CHANGE_IN_THRSHLD_OF_PARTICIPANTS_NMB")) return CHANGE__IN__THRSHLD__OF__PARTICIPANTS__NMB; else if (!strcmp(str_par, "CHANGE_IN_USER_PARTICIPATING_TYPE")) return CHANGE__IN__USER__PARTICIPATING__TYPE; else if (!strcmp(str_par, "CHANGE_IN_SERVICE_CONDITION")) return CHANGE__IN__SERVICE__CONDITION; else if (!strcmp(str_par, "CHANGE_IN_SERVING_NODE")) return CHANGE__IN__SERVING__NODE; else if (!strcmp(str_par, "CHANGE_IN_ACCESS_FOR_A_SERVICE_DATA_FLOW")) return CHANGE__IN__ACCESS__FOR__A__SERVICE__DATA__FLOW; else if (!strcmp(str_par, "CHANGE_IN_USER_CSG_INFORMATION")) return CHANGE__IN__USER__CSG__INFORMATION; else if (!strcmp(str_par, "CHANGE_IN_HYBRID_SUBSCRIBED_USER_CSG_INFORMATION")) return CHANGE__IN__HYBRID__SUBSCRIBED__USER__CSG__INFORMATION; else if (!strcmp(str_par, "CHANGE_IN_HYBRID_UNSUBSCRIBED_USER_CSG_INFORMATION")) return CHANGE__IN__HYBRID__UNSUBSCRIBED__USER__CSG__INFORMATION; else if (!strcmp(str_par, "CHANGE_OF_UE_PRESENCE_IN_PRESENCE_REPORTING_AREA")) return CHANGE__OF__UE__PRESENCE__IN__PRESENCE__REPORTING__AREA; else if (!strcmp(str_par, "CHANGE_IN_SERVING_PLMN_RATE_CONTROL")) return CHANGE__IN__SERVING__PLMN__RATE__CONTROL; else if (!strcmp(str_par, "CHANGE_IN_APN_RATE_CONTROL")) return CHANGE__IN__APN__RATE__CONTROL; else return UNKNOWN_VALUE; } boolean DCA__3GPP__Trigger__Type::is_valid_enum(int int_par) { switch (int_par) { case 1: case 2: case 3: case 4: case 5: case 10: case 11: case 12: case 13: case 14: case 15: case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23: case 24: case 30: case 31: case 32: case 33: case 34: case 35: case 36: case 40: case 50: case 51: case 52: case 60: case 61: case 62: case 70: case 71: case 72: case 73: case 74: case 75: return TRUE; default: return FALSE; } } int DCA__3GPP__Trigger__Type::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_Trigger_Type.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int DCA__3GPP__Trigger__Type::enum2int(const DCA__3GPP__Trigger__Type& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_Trigger_Type.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void DCA__3GPP__Trigger__Type::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Trigger_Type.", int_val); enum_value = (enum_type)int_val; } DCA__3GPP__Trigger__Type::operator DCA__3GPP__Trigger__Type::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.DCA_3GPP_Trigger_Type."); return enum_value; } void DCA__3GPP__Trigger__Type::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void DCA__3GPP__Trigger__Type::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.DCA_3GPP_Trigger_Type"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_Trigger_Type."); } } void DCA__3GPP__Trigger__Type::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Trigger_Type."); text_buf.push_int(enum_value); } void DCA__3GPP__Trigger__Type::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.DCA_3GPP_Trigger_Type.", enum_value); } void DCA__3GPP__Trigger__Type::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void DCA__3GPP__Trigger__Type::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int DCA__3GPP__Trigger__Type::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 7, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int DCA__3GPP__Trigger__Type::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 7); } void DCA__3GPP__Trigger__Type_template::copy_template(const DCA__3GPP__Trigger__Type_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new DCA__3GPP__Trigger__Type_template[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 DCA__3GPP__Trigger__Type_template(*other_value.implication_.precondition); implication_.implied_template = new DCA__3GPP__Trigger__Type_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Trigger_Type."); } } DCA__3GPP__Trigger__Type_template::DCA__3GPP__Trigger__Type_template() { } DCA__3GPP__Trigger__Type_template::DCA__3GPP__Trigger__Type_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } DCA__3GPP__Trigger__Type_template::DCA__3GPP__Trigger__Type_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!DCA__3GPP__Trigger__Type::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.DCA_3GPP_Trigger_Type with unknown numeric value %d.", other_value); single_value = (DCA__3GPP__Trigger__Type::enum_type)other_value; } DCA__3GPP__Trigger__Type_template::DCA__3GPP__Trigger__Type_template(DCA__3GPP__Trigger__Type::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } DCA__3GPP__Trigger__Type_template::DCA__3GPP__Trigger__Type_template(const DCA__3GPP__Trigger__Type& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == DCA__3GPP__Trigger__Type::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Trigger_Type."); single_value = other_value.enum_value; } DCA__3GPP__Trigger__Type_template::DCA__3GPP__Trigger__Type_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Trigger__Type::enum_type)(const DCA__3GPP__Trigger__Type&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.DCA_3GPP_Trigger_Type from an unbound optional field."); } } DCA__3GPP__Trigger__Type_template::DCA__3GPP__Trigger__Type_template(DCA__3GPP__Trigger__Type_template* p_precondition, DCA__3GPP__Trigger__Type_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } DCA__3GPP__Trigger__Type_template::DCA__3GPP__Trigger__Type_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; } DCA__3GPP__Trigger__Type_template::DCA__3GPP__Trigger__Type_template(const DCA__3GPP__Trigger__Type_template& other_value) : Base_Template() { copy_template(other_value); } DCA__3GPP__Trigger__Type_template::~DCA__3GPP__Trigger__Type_template() { clean_up(); } boolean DCA__3GPP__Trigger__Type_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean DCA__3GPP__Trigger__Type_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != DCA__3GPP__Trigger__Type::UNBOUND_VALUE; } void DCA__3GPP__Trigger__Type_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } DCA__3GPP__Trigger__Type_template& DCA__3GPP__Trigger__Type_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } DCA__3GPP__Trigger__Type_template& DCA__3GPP__Trigger__Type_template::operator=(int other_value) { if (!DCA__3GPP__Trigger__Type::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.DCA_3GPP_Trigger_Type.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Trigger__Type::enum_type)other_value; return *this; } DCA__3GPP__Trigger__Type_template& DCA__3GPP__Trigger__Type_template::operator=(DCA__3GPP__Trigger__Type::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } DCA__3GPP__Trigger__Type_template& DCA__3GPP__Trigger__Type_template::operator=(const DCA__3GPP__Trigger__Type& other_value) { if (other_value.enum_value == DCA__3GPP__Trigger__Type::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Trigger_Type to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } DCA__3GPP__Trigger__Type_template& DCA__3GPP__Trigger__Type_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Trigger__Type::enum_type)(const DCA__3GPP__Trigger__Type&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.DCA_3GPP_Trigger_Type."); } return *this; } DCA__3GPP__Trigger__Type_template& DCA__3GPP__Trigger__Type_template::operator=(const DCA__3GPP__Trigger__Type_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean DCA__3GPP__Trigger__Type_template::match(DCA__3GPP__Trigger__Type::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Trigger_Type."); } return FALSE; } boolean DCA__3GPP__Trigger__Type_template::match(const DCA__3GPP__Trigger__Type& other_value, boolean) const { if (other_value.enum_value == DCA__3GPP__Trigger__Type::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.DCA_3GPP_Trigger_Type with an unbound value."); return match(other_value.enum_value); } DCA__3GPP__Trigger__Type::enum_type DCA__3GPP__Trigger__Type_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.DCA_3GPP_Trigger_Type."); return single_value; } void DCA__3GPP__Trigger__Type_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Trigger_Type."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new DCA__3GPP__Trigger__Type_template[list_length]; } DCA__3GPP__Trigger__Type_template& DCA__3GPP__Trigger__Type_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.DCA_3GPP_Trigger_Type."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.DCA_3GPP_Trigger_Type."); return value_list.list_value[list_index]; } void DCA__3GPP__Trigger__Type_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(DCA__3GPP__Trigger__Type::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void DCA__3GPP__Trigger__Type_template::log_match(const DCA__3GPP__Trigger__Type& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void DCA__3GPP__Trigger__Type_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Trigger_Type."); } } void DCA__3GPP__Trigger__Type_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (DCA__3GPP__Trigger__Type::enum_type)text_buf.pull_int().get_val(); if (!DCA__3GPP__Trigger__Type::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Trigger_Type.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new DCA__3GPP__Trigger__Type_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Trigger_Type."); } } boolean DCA__3GPP__Trigger__Type_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean DCA__3GPP__Trigger__Type_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { DCA__3GPP__Trigger__Type_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { DCA__3GPP__Trigger__Type::enum_type enum_val = DCA__3GPP__Trigger__Type::str_to_enum(m_p->get_enumerated()); if (!DCA__3GPP__Trigger__Type::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_Trigger_Type."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { DCA__3GPP__Trigger__Type_template* precondition = new DCA__3GPP__Trigger__Type_template; precondition->set_param(*m_p->get_elem(0)); DCA__3GPP__Trigger__Type_template* implied_template = new DCA__3GPP__Trigger__Type_template; implied_template->set_param(*m_p->get_elem(1)); *this = DCA__3GPP__Trigger__Type_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.DCA_3GPP_Trigger_Type"); } is_ifpresent = param.get_ifpresent(); } void DCA__3GPP__Trigger__Type_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.DCA_3GPP_Trigger_Type"); } DCA__3GPP__Role__Of__ProSe__Function::DCA__3GPP__Role__Of__ProSe__Function() { enum_value = UNBOUND_VALUE; } DCA__3GPP__Role__Of__ProSe__Function::DCA__3GPP__Role__Of__ProSe__Function(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Role_Of_ProSe_Function with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } DCA__3GPP__Role__Of__ProSe__Function::DCA__3GPP__Role__Of__ProSe__Function(enum_type other_value) { enum_value = other_value; } DCA__3GPP__Role__Of__ProSe__Function::DCA__3GPP__Role__Of__ProSe__Function(const DCA__3GPP__Role__Of__ProSe__Function& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Role_Of_ProSe_Function."); enum_value = other_value.enum_value; } DCA__3GPP__Role__Of__ProSe__Function& DCA__3GPP__Role__Of__ProSe__Function::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Role_Of_ProSe_Function.", other_value); enum_value = (enum_type)other_value; return *this; } DCA__3GPP__Role__Of__ProSe__Function& DCA__3GPP__Role__Of__ProSe__Function::operator=(enum_type other_value) { enum_value = other_value; return *this; } DCA__3GPP__Role__Of__ProSe__Function& DCA__3GPP__Role__Of__ProSe__Function::operator=(const DCA__3GPP__Role__Of__ProSe__Function& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Role_Of_ProSe_Function."); enum_value = other_value.enum_value; return *this; } boolean DCA__3GPP__Role__Of__ProSe__Function::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Role_Of_ProSe_Function."); return enum_value == other_value; } boolean DCA__3GPP__Role__Of__ProSe__Function::operator==(const DCA__3GPP__Role__Of__ProSe__Function& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Role_Of_ProSe_Function."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Role_Of_ProSe_Function."); return enum_value == other_value.enum_value; } boolean DCA__3GPP__Role__Of__ProSe__Function::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Role_Of_ProSe_Function."); return enum_value < other_value; } boolean DCA__3GPP__Role__Of__ProSe__Function::operator<(const DCA__3GPP__Role__Of__ProSe__Function& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Role_Of_ProSe_Function."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Role_Of_ProSe_Function."); return enum_value < other_value.enum_value; } boolean DCA__3GPP__Role__Of__ProSe__Function::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Role_Of_ProSe_Function."); return enum_value > other_value; } boolean DCA__3GPP__Role__Of__ProSe__Function::operator>(const DCA__3GPP__Role__Of__ProSe__Function& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Role_Of_ProSe_Function."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Role_Of_ProSe_Function."); return enum_value > other_value.enum_value; } const char *DCA__3GPP__Role__Of__ProSe__Function::enum_to_str(enum_type enum_par) { switch (enum_par) { case HPLMN: return "HPLMN"; case VPLMN: return "VPLMN"; case LOCAL__PLMN: return "LOCAL_PLMN"; default: return ""; } } DCA__3GPP__Role__Of__ProSe__Function::enum_type DCA__3GPP__Role__Of__ProSe__Function::str_to_enum(const char *str_par) { if (!strcmp(str_par, "HPLMN")) return HPLMN; else if (!strcmp(str_par, "VPLMN")) return VPLMN; else if (!strcmp(str_par, "LOCAL_PLMN")) return LOCAL__PLMN; else return UNKNOWN_VALUE; } boolean DCA__3GPP__Role__Of__ProSe__Function::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: case 2: return TRUE; default: return FALSE; } } int DCA__3GPP__Role__Of__ProSe__Function::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_Role_Of_ProSe_Function.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int DCA__3GPP__Role__Of__ProSe__Function::enum2int(const DCA__3GPP__Role__Of__ProSe__Function& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_Role_Of_ProSe_Function.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void DCA__3GPP__Role__Of__ProSe__Function::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Role_Of_ProSe_Function.", int_val); enum_value = (enum_type)int_val; } DCA__3GPP__Role__Of__ProSe__Function::operator DCA__3GPP__Role__Of__ProSe__Function::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.DCA_3GPP_Role_Of_ProSe_Function."); return enum_value; } void DCA__3GPP__Role__Of__ProSe__Function::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void DCA__3GPP__Role__Of__ProSe__Function::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.DCA_3GPP_Role_Of_ProSe_Function"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_Role_Of_ProSe_Function."); } } void DCA__3GPP__Role__Of__ProSe__Function::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Role_Of_ProSe_Function."); text_buf.push_int(enum_value); } void DCA__3GPP__Role__Of__ProSe__Function::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.DCA_3GPP_Role_Of_ProSe_Function.", enum_value); } void DCA__3GPP__Role__Of__ProSe__Function::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void DCA__3GPP__Role__Of__ProSe__Function::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int DCA__3GPP__Role__Of__ProSe__Function::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int DCA__3GPP__Role__Of__ProSe__Function::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void DCA__3GPP__Role__Of__ProSe__Function_template::copy_template(const DCA__3GPP__Role__Of__ProSe__Function_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new DCA__3GPP__Role__Of__ProSe__Function_template[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 DCA__3GPP__Role__Of__ProSe__Function_template(*other_value.implication_.precondition); implication_.implied_template = new DCA__3GPP__Role__Of__ProSe__Function_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Role_Of_ProSe_Function."); } } DCA__3GPP__Role__Of__ProSe__Function_template::DCA__3GPP__Role__Of__ProSe__Function_template() { } DCA__3GPP__Role__Of__ProSe__Function_template::DCA__3GPP__Role__Of__ProSe__Function_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } DCA__3GPP__Role__Of__ProSe__Function_template::DCA__3GPP__Role__Of__ProSe__Function_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!DCA__3GPP__Role__Of__ProSe__Function::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.DCA_3GPP_Role_Of_ProSe_Function with unknown numeric value %d.", other_value); single_value = (DCA__3GPP__Role__Of__ProSe__Function::enum_type)other_value; } DCA__3GPP__Role__Of__ProSe__Function_template::DCA__3GPP__Role__Of__ProSe__Function_template(DCA__3GPP__Role__Of__ProSe__Function::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } DCA__3GPP__Role__Of__ProSe__Function_template::DCA__3GPP__Role__Of__ProSe__Function_template(const DCA__3GPP__Role__Of__ProSe__Function& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == DCA__3GPP__Role__Of__ProSe__Function::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Role_Of_ProSe_Function."); single_value = other_value.enum_value; } DCA__3GPP__Role__Of__ProSe__Function_template::DCA__3GPP__Role__Of__ProSe__Function_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Role__Of__ProSe__Function::enum_type)(const DCA__3GPP__Role__Of__ProSe__Function&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.DCA_3GPP_Role_Of_ProSe_Function from an unbound optional field."); } } DCA__3GPP__Role__Of__ProSe__Function_template::DCA__3GPP__Role__Of__ProSe__Function_template(DCA__3GPP__Role__Of__ProSe__Function_template* p_precondition, DCA__3GPP__Role__Of__ProSe__Function_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } DCA__3GPP__Role__Of__ProSe__Function_template::DCA__3GPP__Role__Of__ProSe__Function_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; } DCA__3GPP__Role__Of__ProSe__Function_template::DCA__3GPP__Role__Of__ProSe__Function_template(const DCA__3GPP__Role__Of__ProSe__Function_template& other_value) : Base_Template() { copy_template(other_value); } DCA__3GPP__Role__Of__ProSe__Function_template::~DCA__3GPP__Role__Of__ProSe__Function_template() { clean_up(); } boolean DCA__3GPP__Role__Of__ProSe__Function_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean DCA__3GPP__Role__Of__ProSe__Function_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != DCA__3GPP__Role__Of__ProSe__Function::UNBOUND_VALUE; } void DCA__3GPP__Role__Of__ProSe__Function_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } DCA__3GPP__Role__Of__ProSe__Function_template& DCA__3GPP__Role__Of__ProSe__Function_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } DCA__3GPP__Role__Of__ProSe__Function_template& DCA__3GPP__Role__Of__ProSe__Function_template::operator=(int other_value) { if (!DCA__3GPP__Role__Of__ProSe__Function::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.DCA_3GPP_Role_Of_ProSe_Function.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Role__Of__ProSe__Function::enum_type)other_value; return *this; } DCA__3GPP__Role__Of__ProSe__Function_template& DCA__3GPP__Role__Of__ProSe__Function_template::operator=(DCA__3GPP__Role__Of__ProSe__Function::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } DCA__3GPP__Role__Of__ProSe__Function_template& DCA__3GPP__Role__Of__ProSe__Function_template::operator=(const DCA__3GPP__Role__Of__ProSe__Function& other_value) { if (other_value.enum_value == DCA__3GPP__Role__Of__ProSe__Function::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Role_Of_ProSe_Function to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } DCA__3GPP__Role__Of__ProSe__Function_template& DCA__3GPP__Role__Of__ProSe__Function_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Role__Of__ProSe__Function::enum_type)(const DCA__3GPP__Role__Of__ProSe__Function&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.DCA_3GPP_Role_Of_ProSe_Function."); } return *this; } DCA__3GPP__Role__Of__ProSe__Function_template& DCA__3GPP__Role__Of__ProSe__Function_template::operator=(const DCA__3GPP__Role__Of__ProSe__Function_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean DCA__3GPP__Role__Of__ProSe__Function_template::match(DCA__3GPP__Role__Of__ProSe__Function::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Role_Of_ProSe_Function."); } return FALSE; } boolean DCA__3GPP__Role__Of__ProSe__Function_template::match(const DCA__3GPP__Role__Of__ProSe__Function& other_value, boolean) const { if (other_value.enum_value == DCA__3GPP__Role__Of__ProSe__Function::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.DCA_3GPP_Role_Of_ProSe_Function with an unbound value."); return match(other_value.enum_value); } DCA__3GPP__Role__Of__ProSe__Function::enum_type DCA__3GPP__Role__Of__ProSe__Function_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.DCA_3GPP_Role_Of_ProSe_Function."); return single_value; } void DCA__3GPP__Role__Of__ProSe__Function_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Role_Of_ProSe_Function."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new DCA__3GPP__Role__Of__ProSe__Function_template[list_length]; } DCA__3GPP__Role__Of__ProSe__Function_template& DCA__3GPP__Role__Of__ProSe__Function_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.DCA_3GPP_Role_Of_ProSe_Function."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.DCA_3GPP_Role_Of_ProSe_Function."); return value_list.list_value[list_index]; } void DCA__3GPP__Role__Of__ProSe__Function_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(DCA__3GPP__Role__Of__ProSe__Function::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void DCA__3GPP__Role__Of__ProSe__Function_template::log_match(const DCA__3GPP__Role__Of__ProSe__Function& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void DCA__3GPP__Role__Of__ProSe__Function_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Role_Of_ProSe_Function."); } } void DCA__3GPP__Role__Of__ProSe__Function_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (DCA__3GPP__Role__Of__ProSe__Function::enum_type)text_buf.pull_int().get_val(); if (!DCA__3GPP__Role__Of__ProSe__Function::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Role_Of_ProSe_Function.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new DCA__3GPP__Role__Of__ProSe__Function_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Role_Of_ProSe_Function."); } } boolean DCA__3GPP__Role__Of__ProSe__Function_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean DCA__3GPP__Role__Of__ProSe__Function_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { DCA__3GPP__Role__Of__ProSe__Function_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { DCA__3GPP__Role__Of__ProSe__Function::enum_type enum_val = DCA__3GPP__Role__Of__ProSe__Function::str_to_enum(m_p->get_enumerated()); if (!DCA__3GPP__Role__Of__ProSe__Function::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_Role_Of_ProSe_Function."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { DCA__3GPP__Role__Of__ProSe__Function_template* precondition = new DCA__3GPP__Role__Of__ProSe__Function_template; precondition->set_param(*m_p->get_elem(0)); DCA__3GPP__Role__Of__ProSe__Function_template* implied_template = new DCA__3GPP__Role__Of__ProSe__Function_template; implied_template->set_param(*m_p->get_elem(1)); *this = DCA__3GPP__Role__Of__ProSe__Function_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.DCA_3GPP_Role_Of_ProSe_Function"); } is_ifpresent = param.get_ifpresent(); } void DCA__3GPP__Role__Of__ProSe__Function_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.DCA_3GPP_Role_Of_ProSe_Function"); } PCC__3GPP__PCC__Rule__Status::PCC__3GPP__PCC__Rule__Status() { enum_value = UNBOUND_VALUE; } PCC__3GPP__PCC__Rule__Status::PCC__3GPP__PCC__Rule__Status(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.PCC_3GPP_PCC_Rule_Status with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } PCC__3GPP__PCC__Rule__Status::PCC__3GPP__PCC__Rule__Status(enum_type other_value) { enum_value = other_value; } PCC__3GPP__PCC__Rule__Status::PCC__3GPP__PCC__Rule__Status(const PCC__3GPP__PCC__Rule__Status& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_PCC_Rule_Status."); enum_value = other_value.enum_value; } PCC__3GPP__PCC__Rule__Status& PCC__3GPP__PCC__Rule__Status::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.PCC_3GPP_PCC_Rule_Status.", other_value); enum_value = (enum_type)other_value; return *this; } PCC__3GPP__PCC__Rule__Status& PCC__3GPP__PCC__Rule__Status::operator=(enum_type other_value) { enum_value = other_value; return *this; } PCC__3GPP__PCC__Rule__Status& PCC__3GPP__PCC__Rule__Status::operator=(const PCC__3GPP__PCC__Rule__Status& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_PCC_Rule_Status."); enum_value = other_value.enum_value; return *this; } boolean PCC__3GPP__PCC__Rule__Status::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_PCC_Rule_Status."); return enum_value == other_value; } boolean PCC__3GPP__PCC__Rule__Status::operator==(const PCC__3GPP__PCC__Rule__Status& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_PCC_Rule_Status."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_PCC_Rule_Status."); return enum_value == other_value.enum_value; } boolean PCC__3GPP__PCC__Rule__Status::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_PCC_Rule_Status."); return enum_value < other_value; } boolean PCC__3GPP__PCC__Rule__Status::operator<(const PCC__3GPP__PCC__Rule__Status& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_PCC_Rule_Status."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_PCC_Rule_Status."); return enum_value < other_value.enum_value; } boolean PCC__3GPP__PCC__Rule__Status::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_PCC_Rule_Status."); return enum_value > other_value; } boolean PCC__3GPP__PCC__Rule__Status::operator>(const PCC__3GPP__PCC__Rule__Status& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_PCC_Rule_Status."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_PCC_Rule_Status."); return enum_value > other_value.enum_value; } const char *PCC__3GPP__PCC__Rule__Status::enum_to_str(enum_type enum_par) { switch (enum_par) { case ACTIVE: return "ACTIVE"; case INACTIVE: return "INACTIVE"; case TEMPORARILY__INACTIVE: return "TEMPORARILY_INACTIVE"; default: return ""; } } PCC__3GPP__PCC__Rule__Status::enum_type PCC__3GPP__PCC__Rule__Status::str_to_enum(const char *str_par) { if (!strcmp(str_par, "ACTIVE")) return ACTIVE; else if (!strcmp(str_par, "INACTIVE")) return INACTIVE; else if (!strcmp(str_par, "TEMPORARILY_INACTIVE")) return TEMPORARILY__INACTIVE; else return UNKNOWN_VALUE; } boolean PCC__3GPP__PCC__Rule__Status::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: case 2: return TRUE; default: return FALSE; } } int PCC__3GPP__PCC__Rule__Status::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.PCC_3GPP_PCC_Rule_Status.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int PCC__3GPP__PCC__Rule__Status::enum2int(const PCC__3GPP__PCC__Rule__Status& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.PCC_3GPP_PCC_Rule_Status.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void PCC__3GPP__PCC__Rule__Status::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.PCC_3GPP_PCC_Rule_Status.", int_val); enum_value = (enum_type)int_val; } PCC__3GPP__PCC__Rule__Status::operator PCC__3GPP__PCC__Rule__Status::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.PCC_3GPP_PCC_Rule_Status."); return enum_value; } void PCC__3GPP__PCC__Rule__Status::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void PCC__3GPP__PCC__Rule__Status::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.PCC_3GPP_PCC_Rule_Status"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.PCC_3GPP_PCC_Rule_Status."); } } void PCC__3GPP__PCC__Rule__Status::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_PCC_Rule_Status."); text_buf.push_int(enum_value); } void PCC__3GPP__PCC__Rule__Status::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.PCC_3GPP_PCC_Rule_Status.", enum_value); } void PCC__3GPP__PCC__Rule__Status::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void PCC__3GPP__PCC__Rule__Status::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int PCC__3GPP__PCC__Rule__Status::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int PCC__3GPP__PCC__Rule__Status::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void PCC__3GPP__PCC__Rule__Status_template::copy_template(const PCC__3GPP__PCC__Rule__Status_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new PCC__3GPP__PCC__Rule__Status_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].copy_template(other_value.value_list.list_value[list_count]); break; case IMPLICATION_MATCH: implication_.precondition = new PCC__3GPP__PCC__Rule__Status_template(*other_value.implication_.precondition); implication_.implied_template = new PCC__3GPP__PCC__Rule__Status_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.PCC_3GPP_PCC_Rule_Status."); } } PCC__3GPP__PCC__Rule__Status_template::PCC__3GPP__PCC__Rule__Status_template() { } PCC__3GPP__PCC__Rule__Status_template::PCC__3GPP__PCC__Rule__Status_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } PCC__3GPP__PCC__Rule__Status_template::PCC__3GPP__PCC__Rule__Status_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!PCC__3GPP__PCC__Rule__Status::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.PCC_3GPP_PCC_Rule_Status with unknown numeric value %d.", other_value); single_value = (PCC__3GPP__PCC__Rule__Status::enum_type)other_value; } PCC__3GPP__PCC__Rule__Status_template::PCC__3GPP__PCC__Rule__Status_template(PCC__3GPP__PCC__Rule__Status::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } PCC__3GPP__PCC__Rule__Status_template::PCC__3GPP__PCC__Rule__Status_template(const PCC__3GPP__PCC__Rule__Status& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == PCC__3GPP__PCC__Rule__Status::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_PCC_Rule_Status."); single_value = other_value.enum_value; } PCC__3GPP__PCC__Rule__Status_template::PCC__3GPP__PCC__Rule__Status_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (PCC__3GPP__PCC__Rule__Status::enum_type)(const PCC__3GPP__PCC__Rule__Status&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.PCC_3GPP_PCC_Rule_Status from an unbound optional field."); } } PCC__3GPP__PCC__Rule__Status_template::PCC__3GPP__PCC__Rule__Status_template(PCC__3GPP__PCC__Rule__Status_template* p_precondition, PCC__3GPP__PCC__Rule__Status_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } PCC__3GPP__PCC__Rule__Status_template::PCC__3GPP__PCC__Rule__Status_template(Dynamic_Match_Interface* p_dyn_match) : Base_Template(DYNAMIC_MATCH) { dyn_match = new dynmatch_struct; dyn_match->ptr = p_dyn_match; dyn_match->ref_count = 1; } PCC__3GPP__PCC__Rule__Status_template::PCC__3GPP__PCC__Rule__Status_template(const PCC__3GPP__PCC__Rule__Status_template& other_value) : Base_Template() { copy_template(other_value); } PCC__3GPP__PCC__Rule__Status_template::~PCC__3GPP__PCC__Rule__Status_template() { clean_up(); } boolean PCC__3GPP__PCC__Rule__Status_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean PCC__3GPP__PCC__Rule__Status_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != PCC__3GPP__PCC__Rule__Status::UNBOUND_VALUE; } void PCC__3GPP__PCC__Rule__Status_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } PCC__3GPP__PCC__Rule__Status_template& PCC__3GPP__PCC__Rule__Status_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } PCC__3GPP__PCC__Rule__Status_template& PCC__3GPP__PCC__Rule__Status_template::operator=(int other_value) { if (!PCC__3GPP__PCC__Rule__Status::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.PCC_3GPP_PCC_Rule_Status.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (PCC__3GPP__PCC__Rule__Status::enum_type)other_value; return *this; } PCC__3GPP__PCC__Rule__Status_template& PCC__3GPP__PCC__Rule__Status_template::operator=(PCC__3GPP__PCC__Rule__Status::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } PCC__3GPP__PCC__Rule__Status_template& PCC__3GPP__PCC__Rule__Status_template::operator=(const PCC__3GPP__PCC__Rule__Status& other_value) { if (other_value.enum_value == PCC__3GPP__PCC__Rule__Status::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_PCC_Rule_Status to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } PCC__3GPP__PCC__Rule__Status_template& PCC__3GPP__PCC__Rule__Status_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (PCC__3GPP__PCC__Rule__Status::enum_type)(const PCC__3GPP__PCC__Rule__Status&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.PCC_3GPP_PCC_Rule_Status."); } return *this; } PCC__3GPP__PCC__Rule__Status_template& PCC__3GPP__PCC__Rule__Status_template::operator=(const PCC__3GPP__PCC__Rule__Status_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean PCC__3GPP__PCC__Rule__Status_template::match(PCC__3GPP__PCC__Rule__Status::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.PCC_3GPP_PCC_Rule_Status."); } return FALSE; } boolean PCC__3GPP__PCC__Rule__Status_template::match(const PCC__3GPP__PCC__Rule__Status& other_value, boolean) const { if (other_value.enum_value == PCC__3GPP__PCC__Rule__Status::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.PCC_3GPP_PCC_Rule_Status with an unbound value."); return match(other_value.enum_value); } PCC__3GPP__PCC__Rule__Status::enum_type PCC__3GPP__PCC__Rule__Status_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.PCC_3GPP_PCC_Rule_Status."); return single_value; } void PCC__3GPP__PCC__Rule__Status_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.PCC_3GPP_PCC_Rule_Status."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new PCC__3GPP__PCC__Rule__Status_template[list_length]; } PCC__3GPP__PCC__Rule__Status_template& PCC__3GPP__PCC__Rule__Status_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.PCC_3GPP_PCC_Rule_Status."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.PCC_3GPP_PCC_Rule_Status."); return value_list.list_value[list_index]; } void PCC__3GPP__PCC__Rule__Status_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(PCC__3GPP__PCC__Rule__Status::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void PCC__3GPP__PCC__Rule__Status_template::log_match(const PCC__3GPP__PCC__Rule__Status& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void PCC__3GPP__PCC__Rule__Status_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.PCC_3GPP_PCC_Rule_Status."); } } void PCC__3GPP__PCC__Rule__Status_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (PCC__3GPP__PCC__Rule__Status::enum_type)text_buf.pull_int().get_val(); if (!PCC__3GPP__PCC__Rule__Status::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.PCC_3GPP_PCC_Rule_Status.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new PCC__3GPP__PCC__Rule__Status_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.PCC_3GPP_PCC_Rule_Status."); } } boolean PCC__3GPP__PCC__Rule__Status_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean PCC__3GPP__PCC__Rule__Status_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { PCC__3GPP__PCC__Rule__Status_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { PCC__3GPP__PCC__Rule__Status::enum_type enum_val = PCC__3GPP__PCC__Rule__Status::str_to_enum(m_p->get_enumerated()); if (!PCC__3GPP__PCC__Rule__Status::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.PCC_3GPP_PCC_Rule_Status."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { PCC__3GPP__PCC__Rule__Status_template* precondition = new PCC__3GPP__PCC__Rule__Status_template; precondition->set_param(*m_p->get_elem(0)); PCC__3GPP__PCC__Rule__Status_template* implied_template = new PCC__3GPP__PCC__Rule__Status_template; implied_template->set_param(*m_p->get_elem(1)); *this = PCC__3GPP__PCC__Rule__Status_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.PCC_3GPP_PCC_Rule_Status"); } is_ifpresent = param.get_ifpresent(); } void PCC__3GPP__PCC__Rule__Status_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.PCC_3GPP_PCC_Rule_Status"); } DCC__NONE__Check__Balance__Result::DCC__NONE__Check__Balance__Result() { enum_value = UNBOUND_VALUE; } DCC__NONE__Check__Balance__Result::DCC__NONE__Check__Balance__Result(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.DCC_NONE_Check_Balance_Result with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } DCC__NONE__Check__Balance__Result::DCC__NONE__Check__Balance__Result(enum_type other_value) { enum_value = other_value; } DCC__NONE__Check__Balance__Result::DCC__NONE__Check__Balance__Result(const DCC__NONE__Check__Balance__Result& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_Check_Balance_Result."); enum_value = other_value.enum_value; } DCC__NONE__Check__Balance__Result& DCC__NONE__Check__Balance__Result::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.DCC_NONE_Check_Balance_Result.", other_value); enum_value = (enum_type)other_value; return *this; } DCC__NONE__Check__Balance__Result& DCC__NONE__Check__Balance__Result::operator=(enum_type other_value) { enum_value = other_value; return *this; } DCC__NONE__Check__Balance__Result& DCC__NONE__Check__Balance__Result::operator=(const DCC__NONE__Check__Balance__Result& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_Check_Balance_Result."); enum_value = other_value.enum_value; return *this; } boolean DCC__NONE__Check__Balance__Result::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_Check_Balance_Result."); return enum_value == other_value; } boolean DCC__NONE__Check__Balance__Result::operator==(const DCC__NONE__Check__Balance__Result& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_Check_Balance_Result."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_Check_Balance_Result."); return enum_value == other_value.enum_value; } boolean DCC__NONE__Check__Balance__Result::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_Check_Balance_Result."); return enum_value < other_value; } boolean DCC__NONE__Check__Balance__Result::operator<(const DCC__NONE__Check__Balance__Result& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_Check_Balance_Result."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_Check_Balance_Result."); return enum_value < other_value.enum_value; } boolean DCC__NONE__Check__Balance__Result::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_Check_Balance_Result."); return enum_value > other_value; } boolean DCC__NONE__Check__Balance__Result::operator>(const DCC__NONE__Check__Balance__Result& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_Check_Balance_Result."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_Check_Balance_Result."); return enum_value > other_value.enum_value; } const char *DCC__NONE__Check__Balance__Result::enum_to_str(enum_type enum_par) { switch (enum_par) { case ENOUGH__CREDIT: return "ENOUGH_CREDIT"; case NO__CREDIT: return "NO_CREDIT"; default: return ""; } } DCC__NONE__Check__Balance__Result::enum_type DCC__NONE__Check__Balance__Result::str_to_enum(const char *str_par) { if (!strcmp(str_par, "ENOUGH_CREDIT")) return ENOUGH__CREDIT; else if (!strcmp(str_par, "NO_CREDIT")) return NO__CREDIT; else return UNKNOWN_VALUE; } boolean DCC__NONE__Check__Balance__Result::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: return TRUE; default: return FALSE; } } int DCC__NONE__Check__Balance__Result::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCC_NONE_Check_Balance_Result.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int DCC__NONE__Check__Balance__Result::enum2int(const DCC__NONE__Check__Balance__Result& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCC_NONE_Check_Balance_Result.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void DCC__NONE__Check__Balance__Result::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.DCC_NONE_Check_Balance_Result.", int_val); enum_value = (enum_type)int_val; } DCC__NONE__Check__Balance__Result::operator DCC__NONE__Check__Balance__Result::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.DCC_NONE_Check_Balance_Result."); return enum_value; } void DCC__NONE__Check__Balance__Result::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void DCC__NONE__Check__Balance__Result::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.DCC_NONE_Check_Balance_Result"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCC_NONE_Check_Balance_Result."); } } void DCC__NONE__Check__Balance__Result::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_Check_Balance_Result."); text_buf.push_int(enum_value); } void DCC__NONE__Check__Balance__Result::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.DCC_NONE_Check_Balance_Result.", enum_value); } void DCC__NONE__Check__Balance__Result::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void DCC__NONE__Check__Balance__Result::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int DCC__NONE__Check__Balance__Result::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int DCC__NONE__Check__Balance__Result::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void DCC__NONE__Check__Balance__Result_template::copy_template(const DCC__NONE__Check__Balance__Result_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new DCC__NONE__Check__Balance__Result_template[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 DCC__NONE__Check__Balance__Result_template(*other_value.implication_.precondition); implication_.implied_template = new DCC__NONE__Check__Balance__Result_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCC_NONE_Check_Balance_Result."); } } DCC__NONE__Check__Balance__Result_template::DCC__NONE__Check__Balance__Result_template() { } DCC__NONE__Check__Balance__Result_template::DCC__NONE__Check__Balance__Result_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } DCC__NONE__Check__Balance__Result_template::DCC__NONE__Check__Balance__Result_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!DCC__NONE__Check__Balance__Result::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.DCC_NONE_Check_Balance_Result with unknown numeric value %d.", other_value); single_value = (DCC__NONE__Check__Balance__Result::enum_type)other_value; } DCC__NONE__Check__Balance__Result_template::DCC__NONE__Check__Balance__Result_template(DCC__NONE__Check__Balance__Result::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } DCC__NONE__Check__Balance__Result_template::DCC__NONE__Check__Balance__Result_template(const DCC__NONE__Check__Balance__Result& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == DCC__NONE__Check__Balance__Result::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_Check_Balance_Result."); single_value = other_value.enum_value; } DCC__NONE__Check__Balance__Result_template::DCC__NONE__Check__Balance__Result_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCC__NONE__Check__Balance__Result::enum_type)(const DCC__NONE__Check__Balance__Result&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.DCC_NONE_Check_Balance_Result from an unbound optional field."); } } DCC__NONE__Check__Balance__Result_template::DCC__NONE__Check__Balance__Result_template(DCC__NONE__Check__Balance__Result_template* p_precondition, DCC__NONE__Check__Balance__Result_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } DCC__NONE__Check__Balance__Result_template::DCC__NONE__Check__Balance__Result_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; } DCC__NONE__Check__Balance__Result_template::DCC__NONE__Check__Balance__Result_template(const DCC__NONE__Check__Balance__Result_template& other_value) : Base_Template() { copy_template(other_value); } DCC__NONE__Check__Balance__Result_template::~DCC__NONE__Check__Balance__Result_template() { clean_up(); } boolean DCC__NONE__Check__Balance__Result_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean DCC__NONE__Check__Balance__Result_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != DCC__NONE__Check__Balance__Result::UNBOUND_VALUE; } void DCC__NONE__Check__Balance__Result_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } DCC__NONE__Check__Balance__Result_template& DCC__NONE__Check__Balance__Result_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } DCC__NONE__Check__Balance__Result_template& DCC__NONE__Check__Balance__Result_template::operator=(int other_value) { if (!DCC__NONE__Check__Balance__Result::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.DCC_NONE_Check_Balance_Result.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (DCC__NONE__Check__Balance__Result::enum_type)other_value; return *this; } DCC__NONE__Check__Balance__Result_template& DCC__NONE__Check__Balance__Result_template::operator=(DCC__NONE__Check__Balance__Result::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } DCC__NONE__Check__Balance__Result_template& DCC__NONE__Check__Balance__Result_template::operator=(const DCC__NONE__Check__Balance__Result& other_value) { if (other_value.enum_value == DCC__NONE__Check__Balance__Result::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_Check_Balance_Result to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } DCC__NONE__Check__Balance__Result_template& DCC__NONE__Check__Balance__Result_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCC__NONE__Check__Balance__Result::enum_type)(const DCC__NONE__Check__Balance__Result&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.DCC_NONE_Check_Balance_Result."); } return *this; } DCC__NONE__Check__Balance__Result_template& DCC__NONE__Check__Balance__Result_template::operator=(const DCC__NONE__Check__Balance__Result_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean DCC__NONE__Check__Balance__Result_template::match(DCC__NONE__Check__Balance__Result::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCC_NONE_Check_Balance_Result."); } return FALSE; } boolean DCC__NONE__Check__Balance__Result_template::match(const DCC__NONE__Check__Balance__Result& other_value, boolean) const { if (other_value.enum_value == DCC__NONE__Check__Balance__Result::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.DCC_NONE_Check_Balance_Result with an unbound value."); return match(other_value.enum_value); } DCC__NONE__Check__Balance__Result::enum_type DCC__NONE__Check__Balance__Result_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.DCC_NONE_Check_Balance_Result."); return single_value; } void DCC__NONE__Check__Balance__Result_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.DCC_NONE_Check_Balance_Result."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new DCC__NONE__Check__Balance__Result_template[list_length]; } DCC__NONE__Check__Balance__Result_template& DCC__NONE__Check__Balance__Result_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.DCC_NONE_Check_Balance_Result."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.DCC_NONE_Check_Balance_Result."); return value_list.list_value[list_index]; } void DCC__NONE__Check__Balance__Result_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(DCC__NONE__Check__Balance__Result::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void DCC__NONE__Check__Balance__Result_template::log_match(const DCC__NONE__Check__Balance__Result& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void DCC__NONE__Check__Balance__Result_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCC_NONE_Check_Balance_Result."); } } void DCC__NONE__Check__Balance__Result_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (DCC__NONE__Check__Balance__Result::enum_type)text_buf.pull_int().get_val(); if (!DCC__NONE__Check__Balance__Result::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.DCC_NONE_Check_Balance_Result.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new DCC__NONE__Check__Balance__Result_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.DCC_NONE_Check_Balance_Result."); } } boolean DCC__NONE__Check__Balance__Result_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean DCC__NONE__Check__Balance__Result_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { DCC__NONE__Check__Balance__Result_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { DCC__NONE__Check__Balance__Result::enum_type enum_val = DCC__NONE__Check__Balance__Result::str_to_enum(m_p->get_enumerated()); if (!DCC__NONE__Check__Balance__Result::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCC_NONE_Check_Balance_Result."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { DCC__NONE__Check__Balance__Result_template* precondition = new DCC__NONE__Check__Balance__Result_template; precondition->set_param(*m_p->get_elem(0)); DCC__NONE__Check__Balance__Result_template* implied_template = new DCC__NONE__Check__Balance__Result_template; implied_template->set_param(*m_p->get_elem(1)); *this = DCC__NONE__Check__Balance__Result_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.DCC_NONE_Check_Balance_Result"); } is_ifpresent = param.get_ifpresent(); } void DCC__NONE__Check__Balance__Result_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.DCC_NONE_Check_Balance_Result"); } AAA__3GPP__Job__Type::AAA__3GPP__Job__Type() { enum_value = UNBOUND_VALUE; } AAA__3GPP__Job__Type::AAA__3GPP__Job__Type(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.AAA_3GPP_Job_Type with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } AAA__3GPP__Job__Type::AAA__3GPP__Job__Type(enum_type other_value) { enum_value = other_value; } AAA__3GPP__Job__Type::AAA__3GPP__Job__Type(const AAA__3GPP__Job__Type& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Job_Type."); enum_value = other_value.enum_value; } AAA__3GPP__Job__Type& AAA__3GPP__Job__Type::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.AAA_3GPP_Job_Type.", other_value); enum_value = (enum_type)other_value; return *this; } AAA__3GPP__Job__Type& AAA__3GPP__Job__Type::operator=(enum_type other_value) { enum_value = other_value; return *this; } AAA__3GPP__Job__Type& AAA__3GPP__Job__Type::operator=(const AAA__3GPP__Job__Type& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Job_Type."); enum_value = other_value.enum_value; return *this; } boolean AAA__3GPP__Job__Type::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Job_Type."); return enum_value == other_value; } boolean AAA__3GPP__Job__Type::operator==(const AAA__3GPP__Job__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Job_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Job_Type."); return enum_value == other_value.enum_value; } boolean AAA__3GPP__Job__Type::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Job_Type."); return enum_value < other_value; } boolean AAA__3GPP__Job__Type::operator<(const AAA__3GPP__Job__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Job_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Job_Type."); return enum_value < other_value.enum_value; } boolean AAA__3GPP__Job__Type::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Job_Type."); return enum_value > other_value; } boolean AAA__3GPP__Job__Type::operator>(const AAA__3GPP__Job__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Job_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Job_Type."); return enum_value > other_value.enum_value; } const char *AAA__3GPP__Job__Type::enum_to_str(enum_type enum_par) { switch (enum_par) { case IMMEDIATE__MDT__ONLY: return "IMMEDIATE_MDT_ONLY"; case LOGGED__MDT__ONLY: return "LOGGED_MDT_ONLY"; case TRACE__ONLY: return "TRACE_ONLY"; case IMMEDIATE__MDT__AND__TRACE: return "IMMEDIATE_MDT_AND_TRACE"; case RLF__REPORTS__ONLY: return "RLF_REPORTS_ONLY"; case RCEF__REPORTS__ONLY: return "RCEF_REPORTS_ONLY"; case LOGGED__MBSFN__MDT: return "LOGGED_MBSFN_MDT"; default: return ""; } } AAA__3GPP__Job__Type::enum_type AAA__3GPP__Job__Type::str_to_enum(const char *str_par) { if (!strcmp(str_par, "IMMEDIATE_MDT_ONLY")) return IMMEDIATE__MDT__ONLY; else if (!strcmp(str_par, "LOGGED_MDT_ONLY")) return LOGGED__MDT__ONLY; else if (!strcmp(str_par, "TRACE_ONLY")) return TRACE__ONLY; else if (!strcmp(str_par, "IMMEDIATE_MDT_AND_TRACE")) return IMMEDIATE__MDT__AND__TRACE; else if (!strcmp(str_par, "RLF_REPORTS_ONLY")) return RLF__REPORTS__ONLY; else if (!strcmp(str_par, "RCEF_REPORTS_ONLY")) return RCEF__REPORTS__ONLY; else if (!strcmp(str_par, "LOGGED_MBSFN_MDT")) return LOGGED__MBSFN__MDT; else return UNKNOWN_VALUE; } boolean AAA__3GPP__Job__Type::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: return TRUE; default: return FALSE; } } int AAA__3GPP__Job__Type::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.AAA_3GPP_Job_Type.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int AAA__3GPP__Job__Type::enum2int(const AAA__3GPP__Job__Type& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.AAA_3GPP_Job_Type.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void AAA__3GPP__Job__Type::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.AAA_3GPP_Job_Type.", int_val); enum_value = (enum_type)int_val; } AAA__3GPP__Job__Type::operator AAA__3GPP__Job__Type::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.AAA_3GPP_Job_Type."); return enum_value; } void AAA__3GPP__Job__Type::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void AAA__3GPP__Job__Type::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.AAA_3GPP_Job_Type"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.AAA_3GPP_Job_Type."); } } void AAA__3GPP__Job__Type::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Job_Type."); text_buf.push_int(enum_value); } void AAA__3GPP__Job__Type::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.AAA_3GPP_Job_Type.", enum_value); } void AAA__3GPP__Job__Type::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void AAA__3GPP__Job__Type::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int AAA__3GPP__Job__Type::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 3, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int AAA__3GPP__Job__Type::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 3); } void AAA__3GPP__Job__Type_template::copy_template(const AAA__3GPP__Job__Type_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new AAA__3GPP__Job__Type_template[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 AAA__3GPP__Job__Type_template(*other_value.implication_.precondition); implication_.implied_template = new AAA__3GPP__Job__Type_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_Job_Type."); } } AAA__3GPP__Job__Type_template::AAA__3GPP__Job__Type_template() { } AAA__3GPP__Job__Type_template::AAA__3GPP__Job__Type_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } AAA__3GPP__Job__Type_template::AAA__3GPP__Job__Type_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!AAA__3GPP__Job__Type::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.AAA_3GPP_Job_Type with unknown numeric value %d.", other_value); single_value = (AAA__3GPP__Job__Type::enum_type)other_value; } AAA__3GPP__Job__Type_template::AAA__3GPP__Job__Type_template(AAA__3GPP__Job__Type::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } AAA__3GPP__Job__Type_template::AAA__3GPP__Job__Type_template(const AAA__3GPP__Job__Type& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == AAA__3GPP__Job__Type::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Job_Type."); single_value = other_value.enum_value; } AAA__3GPP__Job__Type_template::AAA__3GPP__Job__Type_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__Job__Type::enum_type)(const AAA__3GPP__Job__Type&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.AAA_3GPP_Job_Type from an unbound optional field."); } } AAA__3GPP__Job__Type_template::AAA__3GPP__Job__Type_template(AAA__3GPP__Job__Type_template* p_precondition, AAA__3GPP__Job__Type_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } AAA__3GPP__Job__Type_template::AAA__3GPP__Job__Type_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; } AAA__3GPP__Job__Type_template::AAA__3GPP__Job__Type_template(const AAA__3GPP__Job__Type_template& other_value) : Base_Template() { copy_template(other_value); } AAA__3GPP__Job__Type_template::~AAA__3GPP__Job__Type_template() { clean_up(); } boolean AAA__3GPP__Job__Type_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean AAA__3GPP__Job__Type_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != AAA__3GPP__Job__Type::UNBOUND_VALUE; } void AAA__3GPP__Job__Type_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } AAA__3GPP__Job__Type_template& AAA__3GPP__Job__Type_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } AAA__3GPP__Job__Type_template& AAA__3GPP__Job__Type_template::operator=(int other_value) { if (!AAA__3GPP__Job__Type::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.AAA_3GPP_Job_Type.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__Job__Type::enum_type)other_value; return *this; } AAA__3GPP__Job__Type_template& AAA__3GPP__Job__Type_template::operator=(AAA__3GPP__Job__Type::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } AAA__3GPP__Job__Type_template& AAA__3GPP__Job__Type_template::operator=(const AAA__3GPP__Job__Type& other_value) { if (other_value.enum_value == AAA__3GPP__Job__Type::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Job_Type to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } AAA__3GPP__Job__Type_template& AAA__3GPP__Job__Type_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__Job__Type::enum_type)(const AAA__3GPP__Job__Type&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.AAA_3GPP_Job_Type."); } return *this; } AAA__3GPP__Job__Type_template& AAA__3GPP__Job__Type_template::operator=(const AAA__3GPP__Job__Type_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean AAA__3GPP__Job__Type_template::match(AAA__3GPP__Job__Type::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_Job_Type."); } return FALSE; } boolean AAA__3GPP__Job__Type_template::match(const AAA__3GPP__Job__Type& other_value, boolean) const { if (other_value.enum_value == AAA__3GPP__Job__Type::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.AAA_3GPP_Job_Type with an unbound value."); return match(other_value.enum_value); } AAA__3GPP__Job__Type::enum_type AAA__3GPP__Job__Type_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.AAA_3GPP_Job_Type."); return single_value; } void AAA__3GPP__Job__Type_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.AAA_3GPP_Job_Type."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new AAA__3GPP__Job__Type_template[list_length]; } AAA__3GPP__Job__Type_template& AAA__3GPP__Job__Type_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.AAA_3GPP_Job_Type."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.AAA_3GPP_Job_Type."); return value_list.list_value[list_index]; } void AAA__3GPP__Job__Type_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(AAA__3GPP__Job__Type::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void AAA__3GPP__Job__Type_template::log_match(const AAA__3GPP__Job__Type& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void AAA__3GPP__Job__Type_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_Job_Type."); } } void AAA__3GPP__Job__Type_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (AAA__3GPP__Job__Type::enum_type)text_buf.pull_int().get_val(); if (!AAA__3GPP__Job__Type::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.AAA_3GPP_Job_Type.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new AAA__3GPP__Job__Type_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.AAA_3GPP_Job_Type."); } } boolean AAA__3GPP__Job__Type_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean AAA__3GPP__Job__Type_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { AAA__3GPP__Job__Type_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { AAA__3GPP__Job__Type::enum_type enum_val = AAA__3GPP__Job__Type::str_to_enum(m_p->get_enumerated()); if (!AAA__3GPP__Job__Type::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.AAA_3GPP_Job_Type."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { AAA__3GPP__Job__Type_template* precondition = new AAA__3GPP__Job__Type_template; precondition->set_param(*m_p->get_elem(0)); AAA__3GPP__Job__Type_template* implied_template = new AAA__3GPP__Job__Type_template; implied_template->set_param(*m_p->get_elem(1)); *this = AAA__3GPP__Job__Type_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.AAA_3GPP_Job_Type"); } is_ifpresent = param.get_ifpresent(); } void AAA__3GPP__Job__Type_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.AAA_3GPP_Job_Type"); } DCA__3GPP__AoC__Service__Type::DCA__3GPP__AoC__Service__Type() { enum_value = UNBOUND_VALUE; } DCA__3GPP__AoC__Service__Type::DCA__3GPP__AoC__Service__Type(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Type with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } DCA__3GPP__AoC__Service__Type::DCA__3GPP__AoC__Service__Type(enum_type other_value) { enum_value = other_value; } DCA__3GPP__AoC__Service__Type::DCA__3GPP__AoC__Service__Type(const DCA__3GPP__AoC__Service__Type& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Type."); enum_value = other_value.enum_value; } DCA__3GPP__AoC__Service__Type& DCA__3GPP__AoC__Service__Type::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Type.", other_value); enum_value = (enum_type)other_value; return *this; } DCA__3GPP__AoC__Service__Type& DCA__3GPP__AoC__Service__Type::operator=(enum_type other_value) { enum_value = other_value; return *this; } DCA__3GPP__AoC__Service__Type& DCA__3GPP__AoC__Service__Type::operator=(const DCA__3GPP__AoC__Service__Type& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Type."); enum_value = other_value.enum_value; return *this; } boolean DCA__3GPP__AoC__Service__Type::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Type."); return enum_value == other_value; } boolean DCA__3GPP__AoC__Service__Type::operator==(const DCA__3GPP__AoC__Service__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Type."); return enum_value == other_value.enum_value; } boolean DCA__3GPP__AoC__Service__Type::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Type."); return enum_value < other_value; } boolean DCA__3GPP__AoC__Service__Type::operator<(const DCA__3GPP__AoC__Service__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Type."); return enum_value < other_value.enum_value; } boolean DCA__3GPP__AoC__Service__Type::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Type."); return enum_value > other_value; } boolean DCA__3GPP__AoC__Service__Type::operator>(const DCA__3GPP__AoC__Service__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Type."); return enum_value > other_value.enum_value; } const char *DCA__3GPP__AoC__Service__Type::enum_to_str(enum_type enum_par) { switch (enum_par) { case NONE_: return "NONE"; case AOC__S: return "AOC_S"; case AOC__D: return "AOC_D"; case AOC__E: return "AOC_E"; default: return ""; } } DCA__3GPP__AoC__Service__Type::enum_type DCA__3GPP__AoC__Service__Type::str_to_enum(const char *str_par) { if (!strcmp(str_par, "NONE")) return NONE_; else if (!strcmp(str_par, "AOC_S")) return AOC__S; else if (!strcmp(str_par, "AOC_D")) return AOC__D; else if (!strcmp(str_par, "AOC_E")) return AOC__E; else return UNKNOWN_VALUE; } boolean DCA__3GPP__AoC__Service__Type::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: case 2: case 3: return TRUE; default: return FALSE; } } int DCA__3GPP__AoC__Service__Type::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Type.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int DCA__3GPP__AoC__Service__Type::enum2int(const DCA__3GPP__AoC__Service__Type& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Type.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void DCA__3GPP__AoC__Service__Type::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Type.", int_val); enum_value = (enum_type)int_val; } DCA__3GPP__AoC__Service__Type::operator DCA__3GPP__AoC__Service__Type::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Type."); return enum_value; } void DCA__3GPP__AoC__Service__Type::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void DCA__3GPP__AoC__Service__Type::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.DCA_3GPP_AoC_Service_Type"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_AoC_Service_Type."); } } void DCA__3GPP__AoC__Service__Type::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Type."); text_buf.push_int(enum_value); } void DCA__3GPP__AoC__Service__Type::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Type.", enum_value); } void DCA__3GPP__AoC__Service__Type::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void DCA__3GPP__AoC__Service__Type::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int DCA__3GPP__AoC__Service__Type::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 3, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int DCA__3GPP__AoC__Service__Type::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 3); } void DCA__3GPP__AoC__Service__Type_template::copy_template(const DCA__3GPP__AoC__Service__Type_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new DCA__3GPP__AoC__Service__Type_template[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 DCA__3GPP__AoC__Service__Type_template(*other_value.implication_.precondition); implication_.implied_template = new DCA__3GPP__AoC__Service__Type_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Type."); } } DCA__3GPP__AoC__Service__Type_template::DCA__3GPP__AoC__Service__Type_template() { } DCA__3GPP__AoC__Service__Type_template::DCA__3GPP__AoC__Service__Type_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } DCA__3GPP__AoC__Service__Type_template::DCA__3GPP__AoC__Service__Type_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!DCA__3GPP__AoC__Service__Type::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Type with unknown numeric value %d.", other_value); single_value = (DCA__3GPP__AoC__Service__Type::enum_type)other_value; } DCA__3GPP__AoC__Service__Type_template::DCA__3GPP__AoC__Service__Type_template(DCA__3GPP__AoC__Service__Type::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } DCA__3GPP__AoC__Service__Type_template::DCA__3GPP__AoC__Service__Type_template(const DCA__3GPP__AoC__Service__Type& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == DCA__3GPP__AoC__Service__Type::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Type."); single_value = other_value.enum_value; } DCA__3GPP__AoC__Service__Type_template::DCA__3GPP__AoC__Service__Type_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__AoC__Service__Type::enum_type)(const DCA__3GPP__AoC__Service__Type&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Type from an unbound optional field."); } } DCA__3GPP__AoC__Service__Type_template::DCA__3GPP__AoC__Service__Type_template(DCA__3GPP__AoC__Service__Type_template* p_precondition, DCA__3GPP__AoC__Service__Type_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } DCA__3GPP__AoC__Service__Type_template::DCA__3GPP__AoC__Service__Type_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; } DCA__3GPP__AoC__Service__Type_template::DCA__3GPP__AoC__Service__Type_template(const DCA__3GPP__AoC__Service__Type_template& other_value) : Base_Template() { copy_template(other_value); } DCA__3GPP__AoC__Service__Type_template::~DCA__3GPP__AoC__Service__Type_template() { clean_up(); } boolean DCA__3GPP__AoC__Service__Type_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean DCA__3GPP__AoC__Service__Type_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != DCA__3GPP__AoC__Service__Type::UNBOUND_VALUE; } void DCA__3GPP__AoC__Service__Type_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } DCA__3GPP__AoC__Service__Type_template& DCA__3GPP__AoC__Service__Type_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } DCA__3GPP__AoC__Service__Type_template& DCA__3GPP__AoC__Service__Type_template::operator=(int other_value) { if (!DCA__3GPP__AoC__Service__Type::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Type.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__AoC__Service__Type::enum_type)other_value; return *this; } DCA__3GPP__AoC__Service__Type_template& DCA__3GPP__AoC__Service__Type_template::operator=(DCA__3GPP__AoC__Service__Type::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } DCA__3GPP__AoC__Service__Type_template& DCA__3GPP__AoC__Service__Type_template::operator=(const DCA__3GPP__AoC__Service__Type& other_value) { if (other_value.enum_value == DCA__3GPP__AoC__Service__Type::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Type to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } DCA__3GPP__AoC__Service__Type_template& DCA__3GPP__AoC__Service__Type_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__AoC__Service__Type::enum_type)(const DCA__3GPP__AoC__Service__Type&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Type."); } return *this; } DCA__3GPP__AoC__Service__Type_template& DCA__3GPP__AoC__Service__Type_template::operator=(const DCA__3GPP__AoC__Service__Type_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean DCA__3GPP__AoC__Service__Type_template::match(DCA__3GPP__AoC__Service__Type::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Type."); } return FALSE; } boolean DCA__3GPP__AoC__Service__Type_template::match(const DCA__3GPP__AoC__Service__Type& other_value, boolean) const { if (other_value.enum_value == DCA__3GPP__AoC__Service__Type::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Type with an unbound value."); return match(other_value.enum_value); } DCA__3GPP__AoC__Service__Type::enum_type DCA__3GPP__AoC__Service__Type_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Type."); return single_value; } void DCA__3GPP__AoC__Service__Type_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Type."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new DCA__3GPP__AoC__Service__Type_template[list_length]; } DCA__3GPP__AoC__Service__Type_template& DCA__3GPP__AoC__Service__Type_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Type."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Type."); return value_list.list_value[list_index]; } void DCA__3GPP__AoC__Service__Type_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(DCA__3GPP__AoC__Service__Type::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void DCA__3GPP__AoC__Service__Type_template::log_match(const DCA__3GPP__AoC__Service__Type& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void DCA__3GPP__AoC__Service__Type_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Type."); } } void DCA__3GPP__AoC__Service__Type_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (DCA__3GPP__AoC__Service__Type::enum_type)text_buf.pull_int().get_val(); if (!DCA__3GPP__AoC__Service__Type::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Type.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new DCA__3GPP__AoC__Service__Type_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Type."); } } boolean DCA__3GPP__AoC__Service__Type_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean DCA__3GPP__AoC__Service__Type_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { DCA__3GPP__AoC__Service__Type_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { DCA__3GPP__AoC__Service__Type::enum_type enum_val = DCA__3GPP__AoC__Service__Type::str_to_enum(m_p->get_enumerated()); if (!DCA__3GPP__AoC__Service__Type::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_AoC_Service_Type."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { DCA__3GPP__AoC__Service__Type_template* precondition = new DCA__3GPP__AoC__Service__Type_template; precondition->set_param(*m_p->get_elem(0)); DCA__3GPP__AoC__Service__Type_template* implied_template = new DCA__3GPP__AoC__Service__Type_template; implied_template->set_param(*m_p->get_elem(1)); *this = DCA__3GPP__AoC__Service__Type_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.DCA_3GPP_AoC_Service_Type"); } is_ifpresent = param.get_ifpresent(); } void DCA__3GPP__AoC__Service__Type_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.DCA_3GPP_AoC_Service_Type"); } DNAS__NONE__Origin__AAA__Protocol::DNAS__NONE__Origin__AAA__Protocol() { enum_value = UNBOUND_VALUE; } DNAS__NONE__Origin__AAA__Protocol::DNAS__NONE__Origin__AAA__Protocol(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.DNAS_NONE_Origin_AAA_Protocol with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } DNAS__NONE__Origin__AAA__Protocol::DNAS__NONE__Origin__AAA__Protocol(enum_type other_value) { enum_value = other_value; } DNAS__NONE__Origin__AAA__Protocol::DNAS__NONE__Origin__AAA__Protocol(const DNAS__NONE__Origin__AAA__Protocol& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Origin_AAA_Protocol."); enum_value = other_value.enum_value; } DNAS__NONE__Origin__AAA__Protocol& DNAS__NONE__Origin__AAA__Protocol::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.DNAS_NONE_Origin_AAA_Protocol.", other_value); enum_value = (enum_type)other_value; return *this; } DNAS__NONE__Origin__AAA__Protocol& DNAS__NONE__Origin__AAA__Protocol::operator=(enum_type other_value) { enum_value = other_value; return *this; } DNAS__NONE__Origin__AAA__Protocol& DNAS__NONE__Origin__AAA__Protocol::operator=(const DNAS__NONE__Origin__AAA__Protocol& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Origin_AAA_Protocol."); enum_value = other_value.enum_value; return *this; } boolean DNAS__NONE__Origin__AAA__Protocol::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Origin_AAA_Protocol."); return enum_value == other_value; } boolean DNAS__NONE__Origin__AAA__Protocol::operator==(const DNAS__NONE__Origin__AAA__Protocol& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Origin_AAA_Protocol."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Origin_AAA_Protocol."); return enum_value == other_value.enum_value; } boolean DNAS__NONE__Origin__AAA__Protocol::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Origin_AAA_Protocol."); return enum_value < other_value; } boolean DNAS__NONE__Origin__AAA__Protocol::operator<(const DNAS__NONE__Origin__AAA__Protocol& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Origin_AAA_Protocol."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Origin_AAA_Protocol."); return enum_value < other_value.enum_value; } boolean DNAS__NONE__Origin__AAA__Protocol::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Origin_AAA_Protocol."); return enum_value > other_value; } boolean DNAS__NONE__Origin__AAA__Protocol::operator>(const DNAS__NONE__Origin__AAA__Protocol& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Origin_AAA_Protocol."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Origin_AAA_Protocol."); return enum_value > other_value.enum_value; } const char *DNAS__NONE__Origin__AAA__Protocol::enum_to_str(enum_type enum_par) { switch (enum_par) { case RADIUS: return "RADIUS"; default: return ""; } } DNAS__NONE__Origin__AAA__Protocol::enum_type DNAS__NONE__Origin__AAA__Protocol::str_to_enum(const char *str_par) { if (!strcmp(str_par, "RADIUS")) return RADIUS; else return UNKNOWN_VALUE; } boolean DNAS__NONE__Origin__AAA__Protocol::is_valid_enum(int int_par) { switch (int_par) { case 1: return TRUE; default: return FALSE; } } int DNAS__NONE__Origin__AAA__Protocol::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DNAS_NONE_Origin_AAA_Protocol.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int DNAS__NONE__Origin__AAA__Protocol::enum2int(const DNAS__NONE__Origin__AAA__Protocol& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DNAS_NONE_Origin_AAA_Protocol.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void DNAS__NONE__Origin__AAA__Protocol::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.DNAS_NONE_Origin_AAA_Protocol.", int_val); enum_value = (enum_type)int_val; } DNAS__NONE__Origin__AAA__Protocol::operator DNAS__NONE__Origin__AAA__Protocol::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.DNAS_NONE_Origin_AAA_Protocol."); return enum_value; } void DNAS__NONE__Origin__AAA__Protocol::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void DNAS__NONE__Origin__AAA__Protocol::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.DNAS_NONE_Origin_AAA_Protocol"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DNAS_NONE_Origin_AAA_Protocol."); } } void DNAS__NONE__Origin__AAA__Protocol::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Origin_AAA_Protocol."); text_buf.push_int(enum_value); } void DNAS__NONE__Origin__AAA__Protocol::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.DNAS_NONE_Origin_AAA_Protocol.", enum_value); } void DNAS__NONE__Origin__AAA__Protocol::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void DNAS__NONE__Origin__AAA__Protocol::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int DNAS__NONE__Origin__AAA__Protocol::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 1, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int DNAS__NONE__Origin__AAA__Protocol::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 1); } void DNAS__NONE__Origin__AAA__Protocol_template::copy_template(const DNAS__NONE__Origin__AAA__Protocol_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new DNAS__NONE__Origin__AAA__Protocol_template[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 DNAS__NONE__Origin__AAA__Protocol_template(*other_value.implication_.precondition); implication_.implied_template = new DNAS__NONE__Origin__AAA__Protocol_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DNAS_NONE_Origin_AAA_Protocol."); } } DNAS__NONE__Origin__AAA__Protocol_template::DNAS__NONE__Origin__AAA__Protocol_template() { } DNAS__NONE__Origin__AAA__Protocol_template::DNAS__NONE__Origin__AAA__Protocol_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } DNAS__NONE__Origin__AAA__Protocol_template::DNAS__NONE__Origin__AAA__Protocol_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!DNAS__NONE__Origin__AAA__Protocol::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.DNAS_NONE_Origin_AAA_Protocol with unknown numeric value %d.", other_value); single_value = (DNAS__NONE__Origin__AAA__Protocol::enum_type)other_value; } DNAS__NONE__Origin__AAA__Protocol_template::DNAS__NONE__Origin__AAA__Protocol_template(DNAS__NONE__Origin__AAA__Protocol::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } DNAS__NONE__Origin__AAA__Protocol_template::DNAS__NONE__Origin__AAA__Protocol_template(const DNAS__NONE__Origin__AAA__Protocol& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == DNAS__NONE__Origin__AAA__Protocol::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Origin_AAA_Protocol."); single_value = other_value.enum_value; } DNAS__NONE__Origin__AAA__Protocol_template::DNAS__NONE__Origin__AAA__Protocol_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DNAS__NONE__Origin__AAA__Protocol::enum_type)(const DNAS__NONE__Origin__AAA__Protocol&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.DNAS_NONE_Origin_AAA_Protocol from an unbound optional field."); } } DNAS__NONE__Origin__AAA__Protocol_template::DNAS__NONE__Origin__AAA__Protocol_template(DNAS__NONE__Origin__AAA__Protocol_template* p_precondition, DNAS__NONE__Origin__AAA__Protocol_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } DNAS__NONE__Origin__AAA__Protocol_template::DNAS__NONE__Origin__AAA__Protocol_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; } DNAS__NONE__Origin__AAA__Protocol_template::DNAS__NONE__Origin__AAA__Protocol_template(const DNAS__NONE__Origin__AAA__Protocol_template& other_value) : Base_Template() { copy_template(other_value); } DNAS__NONE__Origin__AAA__Protocol_template::~DNAS__NONE__Origin__AAA__Protocol_template() { clean_up(); } boolean DNAS__NONE__Origin__AAA__Protocol_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean DNAS__NONE__Origin__AAA__Protocol_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != DNAS__NONE__Origin__AAA__Protocol::UNBOUND_VALUE; } void DNAS__NONE__Origin__AAA__Protocol_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } DNAS__NONE__Origin__AAA__Protocol_template& DNAS__NONE__Origin__AAA__Protocol_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } DNAS__NONE__Origin__AAA__Protocol_template& DNAS__NONE__Origin__AAA__Protocol_template::operator=(int other_value) { if (!DNAS__NONE__Origin__AAA__Protocol::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.DNAS_NONE_Origin_AAA_Protocol.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (DNAS__NONE__Origin__AAA__Protocol::enum_type)other_value; return *this; } DNAS__NONE__Origin__AAA__Protocol_template& DNAS__NONE__Origin__AAA__Protocol_template::operator=(DNAS__NONE__Origin__AAA__Protocol::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } DNAS__NONE__Origin__AAA__Protocol_template& DNAS__NONE__Origin__AAA__Protocol_template::operator=(const DNAS__NONE__Origin__AAA__Protocol& other_value) { if (other_value.enum_value == DNAS__NONE__Origin__AAA__Protocol::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Origin_AAA_Protocol to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } DNAS__NONE__Origin__AAA__Protocol_template& DNAS__NONE__Origin__AAA__Protocol_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DNAS__NONE__Origin__AAA__Protocol::enum_type)(const DNAS__NONE__Origin__AAA__Protocol&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.DNAS_NONE_Origin_AAA_Protocol."); } return *this; } DNAS__NONE__Origin__AAA__Protocol_template& DNAS__NONE__Origin__AAA__Protocol_template::operator=(const DNAS__NONE__Origin__AAA__Protocol_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean DNAS__NONE__Origin__AAA__Protocol_template::match(DNAS__NONE__Origin__AAA__Protocol::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DNAS_NONE_Origin_AAA_Protocol."); } return FALSE; } boolean DNAS__NONE__Origin__AAA__Protocol_template::match(const DNAS__NONE__Origin__AAA__Protocol& other_value, boolean) const { if (other_value.enum_value == DNAS__NONE__Origin__AAA__Protocol::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.DNAS_NONE_Origin_AAA_Protocol with an unbound value."); return match(other_value.enum_value); } DNAS__NONE__Origin__AAA__Protocol::enum_type DNAS__NONE__Origin__AAA__Protocol_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.DNAS_NONE_Origin_AAA_Protocol."); return single_value; } void DNAS__NONE__Origin__AAA__Protocol_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.DNAS_NONE_Origin_AAA_Protocol."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new DNAS__NONE__Origin__AAA__Protocol_template[list_length]; } DNAS__NONE__Origin__AAA__Protocol_template& DNAS__NONE__Origin__AAA__Protocol_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.DNAS_NONE_Origin_AAA_Protocol."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.DNAS_NONE_Origin_AAA_Protocol."); return value_list.list_value[list_index]; } void DNAS__NONE__Origin__AAA__Protocol_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(DNAS__NONE__Origin__AAA__Protocol::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void DNAS__NONE__Origin__AAA__Protocol_template::log_match(const DNAS__NONE__Origin__AAA__Protocol& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void DNAS__NONE__Origin__AAA__Protocol_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DNAS_NONE_Origin_AAA_Protocol."); } } void DNAS__NONE__Origin__AAA__Protocol_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (DNAS__NONE__Origin__AAA__Protocol::enum_type)text_buf.pull_int().get_val(); if (!DNAS__NONE__Origin__AAA__Protocol::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.DNAS_NONE_Origin_AAA_Protocol.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new DNAS__NONE__Origin__AAA__Protocol_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.DNAS_NONE_Origin_AAA_Protocol."); } } boolean DNAS__NONE__Origin__AAA__Protocol_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean DNAS__NONE__Origin__AAA__Protocol_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { DNAS__NONE__Origin__AAA__Protocol_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { DNAS__NONE__Origin__AAA__Protocol::enum_type enum_val = DNAS__NONE__Origin__AAA__Protocol::str_to_enum(m_p->get_enumerated()); if (!DNAS__NONE__Origin__AAA__Protocol::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DNAS_NONE_Origin_AAA_Protocol."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { DNAS__NONE__Origin__AAA__Protocol_template* precondition = new DNAS__NONE__Origin__AAA__Protocol_template; precondition->set_param(*m_p->get_elem(0)); DNAS__NONE__Origin__AAA__Protocol_template* implied_template = new DNAS__NONE__Origin__AAA__Protocol_template; implied_template->set_param(*m_p->get_elem(1)); *this = DNAS__NONE__Origin__AAA__Protocol_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.DNAS_NONE_Origin_AAA_Protocol"); } is_ifpresent = param.get_ifpresent(); } void DNAS__NONE__Origin__AAA__Protocol_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.DNAS_NONE_Origin_AAA_Protocol"); } AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported() { enum_value = UNBOUND_VALUE; } AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.AAA_3GPP_IMS_Voice_Over_PS_Sessions_Supported with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported(enum_type other_value) { enum_value = other_value; } AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported(const AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_IMS_Voice_Over_PS_Sessions_Supported."); enum_value = other_value.enum_value; } AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported& AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.AAA_3GPP_IMS_Voice_Over_PS_Sessions_Supported.", other_value); enum_value = (enum_type)other_value; return *this; } AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported& AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::operator=(enum_type other_value) { enum_value = other_value; return *this; } AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported& AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::operator=(const AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_IMS_Voice_Over_PS_Sessions_Supported."); enum_value = other_value.enum_value; return *this; } boolean AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_IMS_Voice_Over_PS_Sessions_Supported."); return enum_value == other_value; } boolean AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::operator==(const AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_IMS_Voice_Over_PS_Sessions_Supported."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_IMS_Voice_Over_PS_Sessions_Supported."); return enum_value == other_value.enum_value; } boolean AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_IMS_Voice_Over_PS_Sessions_Supported."); return enum_value < other_value; } boolean AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::operator<(const AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_IMS_Voice_Over_PS_Sessions_Supported."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_IMS_Voice_Over_PS_Sessions_Supported."); return enum_value < other_value.enum_value; } boolean AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_IMS_Voice_Over_PS_Sessions_Supported."); return enum_value > other_value; } boolean AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::operator>(const AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_IMS_Voice_Over_PS_Sessions_Supported."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_IMS_Voice_Over_PS_Sessions_Supported."); return enum_value > other_value.enum_value; } const char *AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::enum_to_str(enum_type enum_par) { switch (enum_par) { case NOT__SUPPORTED: return "NOT_SUPPORTED"; case SUPPORTED: return "SUPPORTED"; default: return ""; } } AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::enum_type AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::str_to_enum(const char *str_par) { if (!strcmp(str_par, "NOT_SUPPORTED")) return NOT__SUPPORTED; else if (!strcmp(str_par, "SUPPORTED")) return SUPPORTED; else return UNKNOWN_VALUE; } boolean AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: return TRUE; default: return FALSE; } } int AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.AAA_3GPP_IMS_Voice_Over_PS_Sessions_Supported.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::enum2int(const AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.AAA_3GPP_IMS_Voice_Over_PS_Sessions_Supported.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.AAA_3GPP_IMS_Voice_Over_PS_Sessions_Supported.", int_val); enum_value = (enum_type)int_val; } AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::operator AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.AAA_3GPP_IMS_Voice_Over_PS_Sessions_Supported."); return enum_value; } void AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.AAA_3GPP_IMS_Voice_Over_PS_Sessions_Supported"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.AAA_3GPP_IMS_Voice_Over_PS_Sessions_Supported."); } } void AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_IMS_Voice_Over_PS_Sessions_Supported."); text_buf.push_int(enum_value); } void AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.AAA_3GPP_IMS_Voice_Over_PS_Sessions_Supported.", enum_value); } void AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template::copy_template(const AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template[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 AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template(*other_value.implication_.precondition); implication_.implied_template = new AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_IMS_Voice_Over_PS_Sessions_Supported."); } } AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template::AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template() { } AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template::AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template::AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.AAA_3GPP_IMS_Voice_Over_PS_Sessions_Supported with unknown numeric value %d.", other_value); single_value = (AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::enum_type)other_value; } AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template::AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template(AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template::AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template(const AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_IMS_Voice_Over_PS_Sessions_Supported."); single_value = other_value.enum_value; } AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template::AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::enum_type)(const AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.AAA_3GPP_IMS_Voice_Over_PS_Sessions_Supported from an unbound optional field."); } } AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template::AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template(AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template* p_precondition, AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template::AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_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; } AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template::AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template(const AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template& other_value) : Base_Template() { copy_template(other_value); } AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template::~AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template() { clean_up(); } boolean AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::UNBOUND_VALUE; } void AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template& AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template& AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template::operator=(int other_value) { if (!AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.AAA_3GPP_IMS_Voice_Over_PS_Sessions_Supported.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::enum_type)other_value; return *this; } AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template& AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template::operator=(AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template& AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template::operator=(const AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported& other_value) { if (other_value.enum_value == AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_IMS_Voice_Over_PS_Sessions_Supported to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template& AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::enum_type)(const AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.AAA_3GPP_IMS_Voice_Over_PS_Sessions_Supported."); } return *this; } AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template& AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template::operator=(const AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template::match(AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_IMS_Voice_Over_PS_Sessions_Supported."); } return FALSE; } boolean AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template::match(const AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported& other_value, boolean) const { if (other_value.enum_value == AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.AAA_3GPP_IMS_Voice_Over_PS_Sessions_Supported with an unbound value."); return match(other_value.enum_value); } AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::enum_type AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.AAA_3GPP_IMS_Voice_Over_PS_Sessions_Supported."); return single_value; } void AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.AAA_3GPP_IMS_Voice_Over_PS_Sessions_Supported."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template[list_length]; } AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template& AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.AAA_3GPP_IMS_Voice_Over_PS_Sessions_Supported."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.AAA_3GPP_IMS_Voice_Over_PS_Sessions_Supported."); return value_list.list_value[list_index]; } void AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template::log_match(const AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_IMS_Voice_Over_PS_Sessions_Supported."); } } void AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::enum_type)text_buf.pull_int().get_val(); if (!AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.AAA_3GPP_IMS_Voice_Over_PS_Sessions_Supported.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.AAA_3GPP_IMS_Voice_Over_PS_Sessions_Supported."); } } boolean AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::enum_type enum_val = AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::str_to_enum(m_p->get_enumerated()); if (!AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.AAA_3GPP_IMS_Voice_Over_PS_Sessions_Supported."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template* precondition = new AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template; precondition->set_param(*m_p->get_elem(0)); AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template* implied_template = new AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template; implied_template->set_param(*m_p->get_elem(1)); *this = AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.AAA_3GPP_IMS_Voice_Over_PS_Sessions_Supported"); } is_ifpresent = param.get_ifpresent(); } void AAA__3GPP__IMS__Voice__Over__PS__Sessions__Supported_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.AAA_3GPP_IMS_Voice_Over_PS_Sessions_Supported"); } AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature() { enum_value = UNBOUND_VALUE; } AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.AAA_3GPP_Roaming_Restricted_Due_To_Unsupported_Feature with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature(enum_type other_value) { enum_value = other_value; } AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature(const AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Roaming_Restricted_Due_To_Unsupported_Feature."); enum_value = other_value.enum_value; } AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature& AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.AAA_3GPP_Roaming_Restricted_Due_To_Unsupported_Feature.", other_value); enum_value = (enum_type)other_value; return *this; } AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature& AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::operator=(enum_type other_value) { enum_value = other_value; return *this; } AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature& AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::operator=(const AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Roaming_Restricted_Due_To_Unsupported_Feature."); enum_value = other_value.enum_value; return *this; } boolean AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Roaming_Restricted_Due_To_Unsupported_Feature."); return enum_value == other_value; } boolean AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::operator==(const AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Roaming_Restricted_Due_To_Unsupported_Feature."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Roaming_Restricted_Due_To_Unsupported_Feature."); return enum_value == other_value.enum_value; } boolean AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Roaming_Restricted_Due_To_Unsupported_Feature."); return enum_value < other_value; } boolean AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::operator<(const AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Roaming_Restricted_Due_To_Unsupported_Feature."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Roaming_Restricted_Due_To_Unsupported_Feature."); return enum_value < other_value.enum_value; } boolean AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Roaming_Restricted_Due_To_Unsupported_Feature."); return enum_value > other_value; } boolean AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::operator>(const AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Roaming_Restricted_Due_To_Unsupported_Feature."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Roaming_Restricted_Due_To_Unsupported_Feature."); return enum_value > other_value.enum_value; } const char *AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::enum_to_str(enum_type enum_par) { switch (enum_par) { case Roaming__Restricted__Due__To__Unsupported__Feature: return "Roaming_Restricted_Due_To_Unsupported_Feature"; default: return ""; } } AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::enum_type AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::str_to_enum(const char *str_par) { if (!strcmp(str_par, "Roaming_Restricted_Due_To_Unsupported_Feature")) return Roaming__Restricted__Due__To__Unsupported__Feature; else return UNKNOWN_VALUE; } boolean AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::is_valid_enum(int int_par) { switch (int_par) { case 0: return TRUE; default: return FALSE; } } int AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.AAA_3GPP_Roaming_Restricted_Due_To_Unsupported_Feature.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::enum2int(const AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.AAA_3GPP_Roaming_Restricted_Due_To_Unsupported_Feature.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.AAA_3GPP_Roaming_Restricted_Due_To_Unsupported_Feature.", int_val); enum_value = (enum_type)int_val; } AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::operator AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.AAA_3GPP_Roaming_Restricted_Due_To_Unsupported_Feature."); return enum_value; } void AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.AAA_3GPP_Roaming_Restricted_Due_To_Unsupported_Feature"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.AAA_3GPP_Roaming_Restricted_Due_To_Unsupported_Feature."); } } void AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Roaming_Restricted_Due_To_Unsupported_Feature."); text_buf.push_int(enum_value); } void AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.AAA_3GPP_Roaming_Restricted_Due_To_Unsupported_Feature.", enum_value); } void AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 1, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 1); } void AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template::copy_template(const AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template[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 AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template(*other_value.implication_.precondition); implication_.implied_template = new AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_Roaming_Restricted_Due_To_Unsupported_Feature."); } } AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template::AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template() { } AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template::AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template::AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.AAA_3GPP_Roaming_Restricted_Due_To_Unsupported_Feature with unknown numeric value %d.", other_value); single_value = (AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::enum_type)other_value; } AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template::AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template(AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template::AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template(const AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Roaming_Restricted_Due_To_Unsupported_Feature."); single_value = other_value.enum_value; } AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template::AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::enum_type)(const AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.AAA_3GPP_Roaming_Restricted_Due_To_Unsupported_Feature from an unbound optional field."); } } AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template::AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template(AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template* p_precondition, AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template::AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_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; } AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template::AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template(const AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template& other_value) : Base_Template() { copy_template(other_value); } AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template::~AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template() { clean_up(); } boolean AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::UNBOUND_VALUE; } void AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template& AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template& AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template::operator=(int other_value) { if (!AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.AAA_3GPP_Roaming_Restricted_Due_To_Unsupported_Feature.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::enum_type)other_value; return *this; } AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template& AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template::operator=(AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template& AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template::operator=(const AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature& other_value) { if (other_value.enum_value == AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Roaming_Restricted_Due_To_Unsupported_Feature to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template& AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::enum_type)(const AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.AAA_3GPP_Roaming_Restricted_Due_To_Unsupported_Feature."); } return *this; } AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template& AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template::operator=(const AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template::match(AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_Roaming_Restricted_Due_To_Unsupported_Feature."); } return FALSE; } boolean AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template::match(const AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature& other_value, boolean) const { if (other_value.enum_value == AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.AAA_3GPP_Roaming_Restricted_Due_To_Unsupported_Feature with an unbound value."); return match(other_value.enum_value); } AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::enum_type AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.AAA_3GPP_Roaming_Restricted_Due_To_Unsupported_Feature."); return single_value; } void AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.AAA_3GPP_Roaming_Restricted_Due_To_Unsupported_Feature."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template[list_length]; } AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template& AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.AAA_3GPP_Roaming_Restricted_Due_To_Unsupported_Feature."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.AAA_3GPP_Roaming_Restricted_Due_To_Unsupported_Feature."); return value_list.list_value[list_index]; } void AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template::log_match(const AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_Roaming_Restricted_Due_To_Unsupported_Feature."); } } void AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::enum_type)text_buf.pull_int().get_val(); if (!AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.AAA_3GPP_Roaming_Restricted_Due_To_Unsupported_Feature.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.AAA_3GPP_Roaming_Restricted_Due_To_Unsupported_Feature."); } } boolean AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::enum_type enum_val = AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::str_to_enum(m_p->get_enumerated()); if (!AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.AAA_3GPP_Roaming_Restricted_Due_To_Unsupported_Feature."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template* precondition = new AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template; precondition->set_param(*m_p->get_elem(0)); AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template* implied_template = new AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template; implied_template->set_param(*m_p->get_elem(1)); *this = AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.AAA_3GPP_Roaming_Restricted_Due_To_Unsupported_Feature"); } is_ifpresent = param.get_ifpresent(); } void AAA__3GPP__Roaming__Restricted__Due__To__Unsupported__Feature_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.AAA_3GPP_Roaming_Restricted_Due_To_Unsupported_Feature"); } DCA__3GPP__File__Repair__Supported::DCA__3GPP__File__Repair__Supported() { enum_value = UNBOUND_VALUE; } DCA__3GPP__File__Repair__Supported::DCA__3GPP__File__Repair__Supported(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.DCA_3GPP_File_Repair_Supported with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } DCA__3GPP__File__Repair__Supported::DCA__3GPP__File__Repair__Supported(enum_type other_value) { enum_value = other_value; } DCA__3GPP__File__Repair__Supported::DCA__3GPP__File__Repair__Supported(const DCA__3GPP__File__Repair__Supported& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_File_Repair_Supported."); enum_value = other_value.enum_value; } DCA__3GPP__File__Repair__Supported& DCA__3GPP__File__Repair__Supported::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_File_Repair_Supported.", other_value); enum_value = (enum_type)other_value; return *this; } DCA__3GPP__File__Repair__Supported& DCA__3GPP__File__Repair__Supported::operator=(enum_type other_value) { enum_value = other_value; return *this; } DCA__3GPP__File__Repair__Supported& DCA__3GPP__File__Repair__Supported::operator=(const DCA__3GPP__File__Repair__Supported& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_File_Repair_Supported."); enum_value = other_value.enum_value; return *this; } boolean DCA__3GPP__File__Repair__Supported::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_File_Repair_Supported."); return enum_value == other_value; } boolean DCA__3GPP__File__Repair__Supported::operator==(const DCA__3GPP__File__Repair__Supported& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_File_Repair_Supported."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_File_Repair_Supported."); return enum_value == other_value.enum_value; } boolean DCA__3GPP__File__Repair__Supported::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_File_Repair_Supported."); return enum_value < other_value; } boolean DCA__3GPP__File__Repair__Supported::operator<(const DCA__3GPP__File__Repair__Supported& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_File_Repair_Supported."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_File_Repair_Supported."); return enum_value < other_value.enum_value; } boolean DCA__3GPP__File__Repair__Supported::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_File_Repair_Supported."); return enum_value > other_value; } boolean DCA__3GPP__File__Repair__Supported::operator>(const DCA__3GPP__File__Repair__Supported& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_File_Repair_Supported."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_File_Repair_Supported."); return enum_value > other_value.enum_value; } const char *DCA__3GPP__File__Repair__Supported::enum_to_str(enum_type enum_par) { switch (enum_par) { case SUPPORTED: return "SUPPORTED"; case NOT__SUPPORTED: return "NOT_SUPPORTED"; default: return ""; } } DCA__3GPP__File__Repair__Supported::enum_type DCA__3GPP__File__Repair__Supported::str_to_enum(const char *str_par) { if (!strcmp(str_par, "SUPPORTED")) return SUPPORTED; else if (!strcmp(str_par, "NOT_SUPPORTED")) return NOT__SUPPORTED; else return UNKNOWN_VALUE; } boolean DCA__3GPP__File__Repair__Supported::is_valid_enum(int int_par) { switch (int_par) { case 1: case 2: return TRUE; default: return FALSE; } } int DCA__3GPP__File__Repair__Supported::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_File_Repair_Supported.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int DCA__3GPP__File__Repair__Supported::enum2int(const DCA__3GPP__File__Repair__Supported& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_File_Repair_Supported.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void DCA__3GPP__File__Repair__Supported::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_File_Repair_Supported.", int_val); enum_value = (enum_type)int_val; } DCA__3GPP__File__Repair__Supported::operator DCA__3GPP__File__Repair__Supported::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.DCA_3GPP_File_Repair_Supported."); return enum_value; } void DCA__3GPP__File__Repair__Supported::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void DCA__3GPP__File__Repair__Supported::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.DCA_3GPP_File_Repair_Supported"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_File_Repair_Supported."); } } void DCA__3GPP__File__Repair__Supported::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_File_Repair_Supported."); text_buf.push_int(enum_value); } void DCA__3GPP__File__Repair__Supported::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.DCA_3GPP_File_Repair_Supported.", enum_value); } void DCA__3GPP__File__Repair__Supported::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void DCA__3GPP__File__Repair__Supported::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int DCA__3GPP__File__Repair__Supported::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int DCA__3GPP__File__Repair__Supported::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void DCA__3GPP__File__Repair__Supported_template::copy_template(const DCA__3GPP__File__Repair__Supported_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new DCA__3GPP__File__Repair__Supported_template[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 DCA__3GPP__File__Repair__Supported_template(*other_value.implication_.precondition); implication_.implied_template = new DCA__3GPP__File__Repair__Supported_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_File_Repair_Supported."); } } DCA__3GPP__File__Repair__Supported_template::DCA__3GPP__File__Repair__Supported_template() { } DCA__3GPP__File__Repair__Supported_template::DCA__3GPP__File__Repair__Supported_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } DCA__3GPP__File__Repair__Supported_template::DCA__3GPP__File__Repair__Supported_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!DCA__3GPP__File__Repair__Supported::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.DCA_3GPP_File_Repair_Supported with unknown numeric value %d.", other_value); single_value = (DCA__3GPP__File__Repair__Supported::enum_type)other_value; } DCA__3GPP__File__Repair__Supported_template::DCA__3GPP__File__Repair__Supported_template(DCA__3GPP__File__Repair__Supported::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } DCA__3GPP__File__Repair__Supported_template::DCA__3GPP__File__Repair__Supported_template(const DCA__3GPP__File__Repair__Supported& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == DCA__3GPP__File__Repair__Supported::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_File_Repair_Supported."); single_value = other_value.enum_value; } DCA__3GPP__File__Repair__Supported_template::DCA__3GPP__File__Repair__Supported_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__File__Repair__Supported::enum_type)(const DCA__3GPP__File__Repair__Supported&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.DCA_3GPP_File_Repair_Supported from an unbound optional field."); } } DCA__3GPP__File__Repair__Supported_template::DCA__3GPP__File__Repair__Supported_template(DCA__3GPP__File__Repair__Supported_template* p_precondition, DCA__3GPP__File__Repair__Supported_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } DCA__3GPP__File__Repair__Supported_template::DCA__3GPP__File__Repair__Supported_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; } DCA__3GPP__File__Repair__Supported_template::DCA__3GPP__File__Repair__Supported_template(const DCA__3GPP__File__Repair__Supported_template& other_value) : Base_Template() { copy_template(other_value); } DCA__3GPP__File__Repair__Supported_template::~DCA__3GPP__File__Repair__Supported_template() { clean_up(); } boolean DCA__3GPP__File__Repair__Supported_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean DCA__3GPP__File__Repair__Supported_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != DCA__3GPP__File__Repair__Supported::UNBOUND_VALUE; } void DCA__3GPP__File__Repair__Supported_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } DCA__3GPP__File__Repair__Supported_template& DCA__3GPP__File__Repair__Supported_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } DCA__3GPP__File__Repair__Supported_template& DCA__3GPP__File__Repair__Supported_template::operator=(int other_value) { if (!DCA__3GPP__File__Repair__Supported::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.DCA_3GPP_File_Repair_Supported.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__File__Repair__Supported::enum_type)other_value; return *this; } DCA__3GPP__File__Repair__Supported_template& DCA__3GPP__File__Repair__Supported_template::operator=(DCA__3GPP__File__Repair__Supported::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } DCA__3GPP__File__Repair__Supported_template& DCA__3GPP__File__Repair__Supported_template::operator=(const DCA__3GPP__File__Repair__Supported& other_value) { if (other_value.enum_value == DCA__3GPP__File__Repair__Supported::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_File_Repair_Supported to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } DCA__3GPP__File__Repair__Supported_template& DCA__3GPP__File__Repair__Supported_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__File__Repair__Supported::enum_type)(const DCA__3GPP__File__Repair__Supported&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.DCA_3GPP_File_Repair_Supported."); } return *this; } DCA__3GPP__File__Repair__Supported_template& DCA__3GPP__File__Repair__Supported_template::operator=(const DCA__3GPP__File__Repair__Supported_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean DCA__3GPP__File__Repair__Supported_template::match(DCA__3GPP__File__Repair__Supported::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_File_Repair_Supported."); } return FALSE; } boolean DCA__3GPP__File__Repair__Supported_template::match(const DCA__3GPP__File__Repair__Supported& other_value, boolean) const { if (other_value.enum_value == DCA__3GPP__File__Repair__Supported::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.DCA_3GPP_File_Repair_Supported with an unbound value."); return match(other_value.enum_value); } DCA__3GPP__File__Repair__Supported::enum_type DCA__3GPP__File__Repair__Supported_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.DCA_3GPP_File_Repair_Supported."); return single_value; } void DCA__3GPP__File__Repair__Supported_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.DCA_3GPP_File_Repair_Supported."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new DCA__3GPP__File__Repair__Supported_template[list_length]; } DCA__3GPP__File__Repair__Supported_template& DCA__3GPP__File__Repair__Supported_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.DCA_3GPP_File_Repair_Supported."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.DCA_3GPP_File_Repair_Supported."); return value_list.list_value[list_index]; } void DCA__3GPP__File__Repair__Supported_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(DCA__3GPP__File__Repair__Supported::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void DCA__3GPP__File__Repair__Supported_template::log_match(const DCA__3GPP__File__Repair__Supported& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void DCA__3GPP__File__Repair__Supported_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_File_Repair_Supported."); } } void DCA__3GPP__File__Repair__Supported_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (DCA__3GPP__File__Repair__Supported::enum_type)text_buf.pull_int().get_val(); if (!DCA__3GPP__File__Repair__Supported::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_File_Repair_Supported.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new DCA__3GPP__File__Repair__Supported_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_File_Repair_Supported."); } } boolean DCA__3GPP__File__Repair__Supported_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean DCA__3GPP__File__Repair__Supported_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { DCA__3GPP__File__Repair__Supported_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { DCA__3GPP__File__Repair__Supported::enum_type enum_val = DCA__3GPP__File__Repair__Supported::str_to_enum(m_p->get_enumerated()); if (!DCA__3GPP__File__Repair__Supported::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_File_Repair_Supported."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { DCA__3GPP__File__Repair__Supported_template* precondition = new DCA__3GPP__File__Repair__Supported_template; precondition->set_param(*m_p->get_elem(0)); DCA__3GPP__File__Repair__Supported_template* implied_template = new DCA__3GPP__File__Repair__Supported_template; implied_template->set_param(*m_p->get_elem(1)); *this = DCA__3GPP__File__Repair__Supported_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.DCA_3GPP_File_Repair_Supported"); } is_ifpresent = param.get_ifpresent(); } void DCA__3GPP__File__Repair__Supported_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.DCA_3GPP_File_Repair_Supported"); } PCC__3GPP__Charging__Correlation__Indicator::PCC__3GPP__Charging__Correlation__Indicator() { enum_value = UNBOUND_VALUE; } PCC__3GPP__Charging__Correlation__Indicator::PCC__3GPP__Charging__Correlation__Indicator(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.PCC_3GPP_Charging_Correlation_Indicator with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } PCC__3GPP__Charging__Correlation__Indicator::PCC__3GPP__Charging__Correlation__Indicator(enum_type other_value) { enum_value = other_value; } PCC__3GPP__Charging__Correlation__Indicator::PCC__3GPP__Charging__Correlation__Indicator(const PCC__3GPP__Charging__Correlation__Indicator& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Charging_Correlation_Indicator."); enum_value = other_value.enum_value; } PCC__3GPP__Charging__Correlation__Indicator& PCC__3GPP__Charging__Correlation__Indicator::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.PCC_3GPP_Charging_Correlation_Indicator.", other_value); enum_value = (enum_type)other_value; return *this; } PCC__3GPP__Charging__Correlation__Indicator& PCC__3GPP__Charging__Correlation__Indicator::operator=(enum_type other_value) { enum_value = other_value; return *this; } PCC__3GPP__Charging__Correlation__Indicator& PCC__3GPP__Charging__Correlation__Indicator::operator=(const PCC__3GPP__Charging__Correlation__Indicator& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Charging_Correlation_Indicator."); enum_value = other_value.enum_value; return *this; } boolean PCC__3GPP__Charging__Correlation__Indicator::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Charging_Correlation_Indicator."); return enum_value == other_value; } boolean PCC__3GPP__Charging__Correlation__Indicator::operator==(const PCC__3GPP__Charging__Correlation__Indicator& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Charging_Correlation_Indicator."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Charging_Correlation_Indicator."); return enum_value == other_value.enum_value; } boolean PCC__3GPP__Charging__Correlation__Indicator::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Charging_Correlation_Indicator."); return enum_value < other_value; } boolean PCC__3GPP__Charging__Correlation__Indicator::operator<(const PCC__3GPP__Charging__Correlation__Indicator& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Charging_Correlation_Indicator."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Charging_Correlation_Indicator."); return enum_value < other_value.enum_value; } boolean PCC__3GPP__Charging__Correlation__Indicator::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Charging_Correlation_Indicator."); return enum_value > other_value; } boolean PCC__3GPP__Charging__Correlation__Indicator::operator>(const PCC__3GPP__Charging__Correlation__Indicator& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Charging_Correlation_Indicator."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Charging_Correlation_Indicator."); return enum_value > other_value.enum_value; } const char *PCC__3GPP__Charging__Correlation__Indicator::enum_to_str(enum_type enum_par) { switch (enum_par) { case CHARGING__IDENTIFIER__REQUIRED: return "CHARGING_IDENTIFIER_REQUIRED"; default: return ""; } } PCC__3GPP__Charging__Correlation__Indicator::enum_type PCC__3GPP__Charging__Correlation__Indicator::str_to_enum(const char *str_par) { if (!strcmp(str_par, "CHARGING_IDENTIFIER_REQUIRED")) return CHARGING__IDENTIFIER__REQUIRED; else return UNKNOWN_VALUE; } boolean PCC__3GPP__Charging__Correlation__Indicator::is_valid_enum(int int_par) { switch (int_par) { case 0: return TRUE; default: return FALSE; } } int PCC__3GPP__Charging__Correlation__Indicator::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.PCC_3GPP_Charging_Correlation_Indicator.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int PCC__3GPP__Charging__Correlation__Indicator::enum2int(const PCC__3GPP__Charging__Correlation__Indicator& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.PCC_3GPP_Charging_Correlation_Indicator.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void PCC__3GPP__Charging__Correlation__Indicator::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.PCC_3GPP_Charging_Correlation_Indicator.", int_val); enum_value = (enum_type)int_val; } PCC__3GPP__Charging__Correlation__Indicator::operator PCC__3GPP__Charging__Correlation__Indicator::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.PCC_3GPP_Charging_Correlation_Indicator."); return enum_value; } void PCC__3GPP__Charging__Correlation__Indicator::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void PCC__3GPP__Charging__Correlation__Indicator::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.PCC_3GPP_Charging_Correlation_Indicator"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.PCC_3GPP_Charging_Correlation_Indicator."); } } void PCC__3GPP__Charging__Correlation__Indicator::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Charging_Correlation_Indicator."); text_buf.push_int(enum_value); } void PCC__3GPP__Charging__Correlation__Indicator::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.PCC_3GPP_Charging_Correlation_Indicator.", enum_value); } void PCC__3GPP__Charging__Correlation__Indicator::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void PCC__3GPP__Charging__Correlation__Indicator::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int PCC__3GPP__Charging__Correlation__Indicator::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 1, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int PCC__3GPP__Charging__Correlation__Indicator::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 1); } void PCC__3GPP__Charging__Correlation__Indicator_template::copy_template(const PCC__3GPP__Charging__Correlation__Indicator_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new PCC__3GPP__Charging__Correlation__Indicator_template[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 PCC__3GPP__Charging__Correlation__Indicator_template(*other_value.implication_.precondition); implication_.implied_template = new PCC__3GPP__Charging__Correlation__Indicator_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.PCC_3GPP_Charging_Correlation_Indicator."); } } PCC__3GPP__Charging__Correlation__Indicator_template::PCC__3GPP__Charging__Correlation__Indicator_template() { } PCC__3GPP__Charging__Correlation__Indicator_template::PCC__3GPP__Charging__Correlation__Indicator_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } PCC__3GPP__Charging__Correlation__Indicator_template::PCC__3GPP__Charging__Correlation__Indicator_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!PCC__3GPP__Charging__Correlation__Indicator::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.PCC_3GPP_Charging_Correlation_Indicator with unknown numeric value %d.", other_value); single_value = (PCC__3GPP__Charging__Correlation__Indicator::enum_type)other_value; } PCC__3GPP__Charging__Correlation__Indicator_template::PCC__3GPP__Charging__Correlation__Indicator_template(PCC__3GPP__Charging__Correlation__Indicator::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } PCC__3GPP__Charging__Correlation__Indicator_template::PCC__3GPP__Charging__Correlation__Indicator_template(const PCC__3GPP__Charging__Correlation__Indicator& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == PCC__3GPP__Charging__Correlation__Indicator::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Charging_Correlation_Indicator."); single_value = other_value.enum_value; } PCC__3GPP__Charging__Correlation__Indicator_template::PCC__3GPP__Charging__Correlation__Indicator_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (PCC__3GPP__Charging__Correlation__Indicator::enum_type)(const PCC__3GPP__Charging__Correlation__Indicator&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.PCC_3GPP_Charging_Correlation_Indicator from an unbound optional field."); } } PCC__3GPP__Charging__Correlation__Indicator_template::PCC__3GPP__Charging__Correlation__Indicator_template(PCC__3GPP__Charging__Correlation__Indicator_template* p_precondition, PCC__3GPP__Charging__Correlation__Indicator_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } PCC__3GPP__Charging__Correlation__Indicator_template::PCC__3GPP__Charging__Correlation__Indicator_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; } PCC__3GPP__Charging__Correlation__Indicator_template::PCC__3GPP__Charging__Correlation__Indicator_template(const PCC__3GPP__Charging__Correlation__Indicator_template& other_value) : Base_Template() { copy_template(other_value); } PCC__3GPP__Charging__Correlation__Indicator_template::~PCC__3GPP__Charging__Correlation__Indicator_template() { clean_up(); } boolean PCC__3GPP__Charging__Correlation__Indicator_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean PCC__3GPP__Charging__Correlation__Indicator_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != PCC__3GPP__Charging__Correlation__Indicator::UNBOUND_VALUE; } void PCC__3GPP__Charging__Correlation__Indicator_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } PCC__3GPP__Charging__Correlation__Indicator_template& PCC__3GPP__Charging__Correlation__Indicator_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } PCC__3GPP__Charging__Correlation__Indicator_template& PCC__3GPP__Charging__Correlation__Indicator_template::operator=(int other_value) { if (!PCC__3GPP__Charging__Correlation__Indicator::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.PCC_3GPP_Charging_Correlation_Indicator.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (PCC__3GPP__Charging__Correlation__Indicator::enum_type)other_value; return *this; } PCC__3GPP__Charging__Correlation__Indicator_template& PCC__3GPP__Charging__Correlation__Indicator_template::operator=(PCC__3GPP__Charging__Correlation__Indicator::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } PCC__3GPP__Charging__Correlation__Indicator_template& PCC__3GPP__Charging__Correlation__Indicator_template::operator=(const PCC__3GPP__Charging__Correlation__Indicator& other_value) { if (other_value.enum_value == PCC__3GPP__Charging__Correlation__Indicator::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Charging_Correlation_Indicator to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } PCC__3GPP__Charging__Correlation__Indicator_template& PCC__3GPP__Charging__Correlation__Indicator_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (PCC__3GPP__Charging__Correlation__Indicator::enum_type)(const PCC__3GPP__Charging__Correlation__Indicator&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.PCC_3GPP_Charging_Correlation_Indicator."); } return *this; } PCC__3GPP__Charging__Correlation__Indicator_template& PCC__3GPP__Charging__Correlation__Indicator_template::operator=(const PCC__3GPP__Charging__Correlation__Indicator_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean PCC__3GPP__Charging__Correlation__Indicator_template::match(PCC__3GPP__Charging__Correlation__Indicator::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.PCC_3GPP_Charging_Correlation_Indicator."); } return FALSE; } boolean PCC__3GPP__Charging__Correlation__Indicator_template::match(const PCC__3GPP__Charging__Correlation__Indicator& other_value, boolean) const { if (other_value.enum_value == PCC__3GPP__Charging__Correlation__Indicator::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.PCC_3GPP_Charging_Correlation_Indicator with an unbound value."); return match(other_value.enum_value); } PCC__3GPP__Charging__Correlation__Indicator::enum_type PCC__3GPP__Charging__Correlation__Indicator_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.PCC_3GPP_Charging_Correlation_Indicator."); return single_value; } void PCC__3GPP__Charging__Correlation__Indicator_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.PCC_3GPP_Charging_Correlation_Indicator."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new PCC__3GPP__Charging__Correlation__Indicator_template[list_length]; } PCC__3GPP__Charging__Correlation__Indicator_template& PCC__3GPP__Charging__Correlation__Indicator_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.PCC_3GPP_Charging_Correlation_Indicator."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.PCC_3GPP_Charging_Correlation_Indicator."); return value_list.list_value[list_index]; } void PCC__3GPP__Charging__Correlation__Indicator_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(PCC__3GPP__Charging__Correlation__Indicator::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void PCC__3GPP__Charging__Correlation__Indicator_template::log_match(const PCC__3GPP__Charging__Correlation__Indicator& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void PCC__3GPP__Charging__Correlation__Indicator_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.PCC_3GPP_Charging_Correlation_Indicator."); } } void PCC__3GPP__Charging__Correlation__Indicator_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (PCC__3GPP__Charging__Correlation__Indicator::enum_type)text_buf.pull_int().get_val(); if (!PCC__3GPP__Charging__Correlation__Indicator::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.PCC_3GPP_Charging_Correlation_Indicator.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new PCC__3GPP__Charging__Correlation__Indicator_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.PCC_3GPP_Charging_Correlation_Indicator."); } } boolean PCC__3GPP__Charging__Correlation__Indicator_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean PCC__3GPP__Charging__Correlation__Indicator_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { PCC__3GPP__Charging__Correlation__Indicator_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { PCC__3GPP__Charging__Correlation__Indicator::enum_type enum_val = PCC__3GPP__Charging__Correlation__Indicator::str_to_enum(m_p->get_enumerated()); if (!PCC__3GPP__Charging__Correlation__Indicator::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.PCC_3GPP_Charging_Correlation_Indicator."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { PCC__3GPP__Charging__Correlation__Indicator_template* precondition = new PCC__3GPP__Charging__Correlation__Indicator_template; precondition->set_param(*m_p->get_elem(0)); PCC__3GPP__Charging__Correlation__Indicator_template* implied_template = new PCC__3GPP__Charging__Correlation__Indicator_template; implied_template->set_param(*m_p->get_elem(1)); *this = PCC__3GPP__Charging__Correlation__Indicator_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.PCC_3GPP_Charging_Correlation_Indicator"); } is_ifpresent = param.get_ifpresent(); } void PCC__3GPP__Charging__Correlation__Indicator_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.PCC_3GPP_Charging_Correlation_Indicator"); } DCC__NONE__Credit__Control::DCC__NONE__Credit__Control() { enum_value = UNBOUND_VALUE; } DCC__NONE__Credit__Control::DCC__NONE__Credit__Control(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.DCC_NONE_Credit_Control with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } DCC__NONE__Credit__Control::DCC__NONE__Credit__Control(enum_type other_value) { enum_value = other_value; } DCC__NONE__Credit__Control::DCC__NONE__Credit__Control(const DCC__NONE__Credit__Control& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_Credit_Control."); enum_value = other_value.enum_value; } DCC__NONE__Credit__Control& DCC__NONE__Credit__Control::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.DCC_NONE_Credit_Control.", other_value); enum_value = (enum_type)other_value; return *this; } DCC__NONE__Credit__Control& DCC__NONE__Credit__Control::operator=(enum_type other_value) { enum_value = other_value; return *this; } DCC__NONE__Credit__Control& DCC__NONE__Credit__Control::operator=(const DCC__NONE__Credit__Control& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_Credit_Control."); enum_value = other_value.enum_value; return *this; } boolean DCC__NONE__Credit__Control::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_Credit_Control."); return enum_value == other_value; } boolean DCC__NONE__Credit__Control::operator==(const DCC__NONE__Credit__Control& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_Credit_Control."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_Credit_Control."); return enum_value == other_value.enum_value; } boolean DCC__NONE__Credit__Control::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_Credit_Control."); return enum_value < other_value; } boolean DCC__NONE__Credit__Control::operator<(const DCC__NONE__Credit__Control& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_Credit_Control."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_Credit_Control."); return enum_value < other_value.enum_value; } boolean DCC__NONE__Credit__Control::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_Credit_Control."); return enum_value > other_value; } boolean DCC__NONE__Credit__Control::operator>(const DCC__NONE__Credit__Control& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_Credit_Control."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_Credit_Control."); return enum_value > other_value.enum_value; } const char *DCC__NONE__Credit__Control::enum_to_str(enum_type enum_par) { switch (enum_par) { case CREDIT__AUTHORIZATION: return "CREDIT_AUTHORIZATION"; case RE__AUTHORIZATION: return "RE_AUTHORIZATION"; default: return ""; } } DCC__NONE__Credit__Control::enum_type DCC__NONE__Credit__Control::str_to_enum(const char *str_par) { if (!strcmp(str_par, "CREDIT_AUTHORIZATION")) return CREDIT__AUTHORIZATION; else if (!strcmp(str_par, "RE_AUTHORIZATION")) return RE__AUTHORIZATION; else return UNKNOWN_VALUE; } boolean DCC__NONE__Credit__Control::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: return TRUE; default: return FALSE; } } int DCC__NONE__Credit__Control::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCC_NONE_Credit_Control.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int DCC__NONE__Credit__Control::enum2int(const DCC__NONE__Credit__Control& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCC_NONE_Credit_Control.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void DCC__NONE__Credit__Control::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.DCC_NONE_Credit_Control.", int_val); enum_value = (enum_type)int_val; } DCC__NONE__Credit__Control::operator DCC__NONE__Credit__Control::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.DCC_NONE_Credit_Control."); return enum_value; } void DCC__NONE__Credit__Control::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void DCC__NONE__Credit__Control::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.DCC_NONE_Credit_Control"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCC_NONE_Credit_Control."); } } void DCC__NONE__Credit__Control::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_Credit_Control."); text_buf.push_int(enum_value); } void DCC__NONE__Credit__Control::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.DCC_NONE_Credit_Control.", enum_value); } void DCC__NONE__Credit__Control::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void DCC__NONE__Credit__Control::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int DCC__NONE__Credit__Control::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int DCC__NONE__Credit__Control::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void DCC__NONE__Credit__Control_template::copy_template(const DCC__NONE__Credit__Control_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new DCC__NONE__Credit__Control_template[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 DCC__NONE__Credit__Control_template(*other_value.implication_.precondition); implication_.implied_template = new DCC__NONE__Credit__Control_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCC_NONE_Credit_Control."); } } DCC__NONE__Credit__Control_template::DCC__NONE__Credit__Control_template() { } DCC__NONE__Credit__Control_template::DCC__NONE__Credit__Control_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } DCC__NONE__Credit__Control_template::DCC__NONE__Credit__Control_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!DCC__NONE__Credit__Control::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.DCC_NONE_Credit_Control with unknown numeric value %d.", other_value); single_value = (DCC__NONE__Credit__Control::enum_type)other_value; } DCC__NONE__Credit__Control_template::DCC__NONE__Credit__Control_template(DCC__NONE__Credit__Control::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } DCC__NONE__Credit__Control_template::DCC__NONE__Credit__Control_template(const DCC__NONE__Credit__Control& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == DCC__NONE__Credit__Control::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_Credit_Control."); single_value = other_value.enum_value; } DCC__NONE__Credit__Control_template::DCC__NONE__Credit__Control_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCC__NONE__Credit__Control::enum_type)(const DCC__NONE__Credit__Control&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.DCC_NONE_Credit_Control from an unbound optional field."); } } DCC__NONE__Credit__Control_template::DCC__NONE__Credit__Control_template(DCC__NONE__Credit__Control_template* p_precondition, DCC__NONE__Credit__Control_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } DCC__NONE__Credit__Control_template::DCC__NONE__Credit__Control_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; } DCC__NONE__Credit__Control_template::DCC__NONE__Credit__Control_template(const DCC__NONE__Credit__Control_template& other_value) : Base_Template() { copy_template(other_value); } DCC__NONE__Credit__Control_template::~DCC__NONE__Credit__Control_template() { clean_up(); } boolean DCC__NONE__Credit__Control_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean DCC__NONE__Credit__Control_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != DCC__NONE__Credit__Control::UNBOUND_VALUE; } void DCC__NONE__Credit__Control_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } DCC__NONE__Credit__Control_template& DCC__NONE__Credit__Control_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } DCC__NONE__Credit__Control_template& DCC__NONE__Credit__Control_template::operator=(int other_value) { if (!DCC__NONE__Credit__Control::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.DCC_NONE_Credit_Control.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (DCC__NONE__Credit__Control::enum_type)other_value; return *this; } DCC__NONE__Credit__Control_template& DCC__NONE__Credit__Control_template::operator=(DCC__NONE__Credit__Control::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } DCC__NONE__Credit__Control_template& DCC__NONE__Credit__Control_template::operator=(const DCC__NONE__Credit__Control& other_value) { if (other_value.enum_value == DCC__NONE__Credit__Control::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_Credit_Control to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } DCC__NONE__Credit__Control_template& DCC__NONE__Credit__Control_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCC__NONE__Credit__Control::enum_type)(const DCC__NONE__Credit__Control&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.DCC_NONE_Credit_Control."); } return *this; } DCC__NONE__Credit__Control_template& DCC__NONE__Credit__Control_template::operator=(const DCC__NONE__Credit__Control_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean DCC__NONE__Credit__Control_template::match(DCC__NONE__Credit__Control::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCC_NONE_Credit_Control."); } return FALSE; } boolean DCC__NONE__Credit__Control_template::match(const DCC__NONE__Credit__Control& other_value, boolean) const { if (other_value.enum_value == DCC__NONE__Credit__Control::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.DCC_NONE_Credit_Control with an unbound value."); return match(other_value.enum_value); } DCC__NONE__Credit__Control::enum_type DCC__NONE__Credit__Control_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.DCC_NONE_Credit_Control."); return single_value; } void DCC__NONE__Credit__Control_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.DCC_NONE_Credit_Control."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new DCC__NONE__Credit__Control_template[list_length]; } DCC__NONE__Credit__Control_template& DCC__NONE__Credit__Control_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.DCC_NONE_Credit_Control."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.DCC_NONE_Credit_Control."); return value_list.list_value[list_index]; } void DCC__NONE__Credit__Control_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(DCC__NONE__Credit__Control::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void DCC__NONE__Credit__Control_template::log_match(const DCC__NONE__Credit__Control& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void DCC__NONE__Credit__Control_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCC_NONE_Credit_Control."); } } void DCC__NONE__Credit__Control_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (DCC__NONE__Credit__Control::enum_type)text_buf.pull_int().get_val(); if (!DCC__NONE__Credit__Control::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.DCC_NONE_Credit_Control.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new DCC__NONE__Credit__Control_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.DCC_NONE_Credit_Control."); } } boolean DCC__NONE__Credit__Control_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean DCC__NONE__Credit__Control_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { DCC__NONE__Credit__Control_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { DCC__NONE__Credit__Control::enum_type enum_val = DCC__NONE__Credit__Control::str_to_enum(m_p->get_enumerated()); if (!DCC__NONE__Credit__Control::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCC_NONE_Credit_Control."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { DCC__NONE__Credit__Control_template* precondition = new DCC__NONE__Credit__Control_template; precondition->set_param(*m_p->get_elem(0)); DCC__NONE__Credit__Control_template* implied_template = new DCC__NONE__Credit__Control_template; implied_template->set_param(*m_p->get_elem(1)); *this = DCC__NONE__Credit__Control_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.DCC_NONE_Credit_Control"); } is_ifpresent = param.get_ifpresent(); } void DCC__NONE__Credit__Control_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.DCC_NONE_Credit_Control"); } AAA__3GPP__Report__Interval::AAA__3GPP__Report__Interval() { enum_value = UNBOUND_VALUE; } AAA__3GPP__Report__Interval::AAA__3GPP__Report__Interval(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.AAA_3GPP_Report_Interval with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } AAA__3GPP__Report__Interval::AAA__3GPP__Report__Interval(enum_type other_value) { enum_value = other_value; } AAA__3GPP__Report__Interval::AAA__3GPP__Report__Interval(const AAA__3GPP__Report__Interval& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Report_Interval."); enum_value = other_value.enum_value; } AAA__3GPP__Report__Interval& AAA__3GPP__Report__Interval::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.AAA_3GPP_Report_Interval.", other_value); enum_value = (enum_type)other_value; return *this; } AAA__3GPP__Report__Interval& AAA__3GPP__Report__Interval::operator=(enum_type other_value) { enum_value = other_value; return *this; } AAA__3GPP__Report__Interval& AAA__3GPP__Report__Interval::operator=(const AAA__3GPP__Report__Interval& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Report_Interval."); enum_value = other_value.enum_value; return *this; } boolean AAA__3GPP__Report__Interval::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Report_Interval."); return enum_value == other_value; } boolean AAA__3GPP__Report__Interval::operator==(const AAA__3GPP__Report__Interval& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Report_Interval."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Report_Interval."); return enum_value == other_value.enum_value; } boolean AAA__3GPP__Report__Interval::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Report_Interval."); return enum_value < other_value; } boolean AAA__3GPP__Report__Interval::operator<(const AAA__3GPP__Report__Interval& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Report_Interval."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Report_Interval."); return enum_value < other_value.enum_value; } boolean AAA__3GPP__Report__Interval::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Report_Interval."); return enum_value > other_value; } boolean AAA__3GPP__Report__Interval::operator>(const AAA__3GPP__Report__Interval& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Report_Interval."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Report_Interval."); return enum_value > other_value.enum_value; } const char *AAA__3GPP__Report__Interval::enum_to_str(enum_type enum_par) { switch (enum_par) { case RI__UMTS__250ms: return "RI_UMTS_250ms"; case RI__UMTS__500ms: return "RI_UMTS_500ms"; case RI__UMTS__1000ms: return "RI_UMTS_1000ms"; case RI__UMTS__2000ms: return "RI_UMTS_2000ms"; case RI__UMTS__3000ms: return "RI_UMTS_3000ms"; case RI__UMTS__4000ms: return "RI_UMTS_4000ms"; case RI__UMTS__6000ms: return "RI_UMTS_6000ms"; case RI__UMTS__8000ms: return "RI_UMTS_8000ms"; case RI__UMTS__12000ms: return "RI_UMTS_12000ms"; case RI__UMTS__16000ms: return "RI_UMTS_16000ms"; case RI__UMTS__20000ms: return "RI_UMTS_20000ms"; case RI__UMTS__24000ms: return "RI_UMTS_24000ms"; case RI__UMTS__28000ms: return "RI_UMTS_28000ms"; case RI__UMTS__32000ms: return "RI_UMTS_32000ms"; case RI__UMTS__64000ms: return "RI_UMTS_64000ms"; case RI__LTE__120ms: return "RI_LTE_120ms"; case RI__LTE__240ms: return "RI_LTE_240ms"; case RI__LTE__480ms: return "RI_LTE_480ms"; case RI__LTE__640ms: return "RI_LTE_640ms"; case RI__LTE__1024ms: return "RI_LTE_1024ms"; case RI__LTE__2048ms: return "RI_LTE_2048ms"; case RI__LTE__5120ms: return "RI_LTE_5120ms"; case RI__LTE__10240ms: return "RI_LTE_10240ms"; case RI__LTE__1min: return "RI_LTE_1min"; case RI__LTE__6min: return "RI_LTE_6min"; case RI__LTE__12min: return "RI_LTE_12min"; case RI__LTE__30min: return "RI_LTE_30min"; case RI__LTE__60min: return "RI_LTE_60min"; default: return ""; } } AAA__3GPP__Report__Interval::enum_type AAA__3GPP__Report__Interval::str_to_enum(const char *str_par) { if (!strcmp(str_par, "RI_UMTS_250ms")) return RI__UMTS__250ms; else if (!strcmp(str_par, "RI_UMTS_500ms")) return RI__UMTS__500ms; else if (!strcmp(str_par, "RI_UMTS_1000ms")) return RI__UMTS__1000ms; else if (!strcmp(str_par, "RI_UMTS_2000ms")) return RI__UMTS__2000ms; else if (!strcmp(str_par, "RI_UMTS_3000ms")) return RI__UMTS__3000ms; else if (!strcmp(str_par, "RI_UMTS_4000ms")) return RI__UMTS__4000ms; else if (!strcmp(str_par, "RI_UMTS_6000ms")) return RI__UMTS__6000ms; else if (!strcmp(str_par, "RI_UMTS_8000ms")) return RI__UMTS__8000ms; else if (!strcmp(str_par, "RI_UMTS_12000ms")) return RI__UMTS__12000ms; else if (!strcmp(str_par, "RI_UMTS_16000ms")) return RI__UMTS__16000ms; else if (!strcmp(str_par, "RI_UMTS_20000ms")) return RI__UMTS__20000ms; else if (!strcmp(str_par, "RI_UMTS_24000ms")) return RI__UMTS__24000ms; else if (!strcmp(str_par, "RI_UMTS_28000ms")) return RI__UMTS__28000ms; else if (!strcmp(str_par, "RI_UMTS_32000ms")) return RI__UMTS__32000ms; else if (!strcmp(str_par, "RI_UMTS_64000ms")) return RI__UMTS__64000ms; else if (!strcmp(str_par, "RI_LTE_120ms")) return RI__LTE__120ms; else if (!strcmp(str_par, "RI_LTE_240ms")) return RI__LTE__240ms; else if (!strcmp(str_par, "RI_LTE_480ms")) return RI__LTE__480ms; else if (!strcmp(str_par, "RI_LTE_640ms")) return RI__LTE__640ms; else if (!strcmp(str_par, "RI_LTE_1024ms")) return RI__LTE__1024ms; else if (!strcmp(str_par, "RI_LTE_2048ms")) return RI__LTE__2048ms; else if (!strcmp(str_par, "RI_LTE_5120ms")) return RI__LTE__5120ms; else if (!strcmp(str_par, "RI_LTE_10240ms")) return RI__LTE__10240ms; else if (!strcmp(str_par, "RI_LTE_1min")) return RI__LTE__1min; else if (!strcmp(str_par, "RI_LTE_6min")) return RI__LTE__6min; else if (!strcmp(str_par, "RI_LTE_12min")) return RI__LTE__12min; else if (!strcmp(str_par, "RI_LTE_30min")) return RI__LTE__30min; else if (!strcmp(str_par, "RI_LTE_60min")) return RI__LTE__60min; else return UNKNOWN_VALUE; } boolean AAA__3GPP__Report__Interval::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23: case 24: case 25: case 26: case 27: return TRUE; default: return FALSE; } } int AAA__3GPP__Report__Interval::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.AAA_3GPP_Report_Interval.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int AAA__3GPP__Report__Interval::enum2int(const AAA__3GPP__Report__Interval& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.AAA_3GPP_Report_Interval.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void AAA__3GPP__Report__Interval::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.AAA_3GPP_Report_Interval.", int_val); enum_value = (enum_type)int_val; } AAA__3GPP__Report__Interval::operator AAA__3GPP__Report__Interval::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.AAA_3GPP_Report_Interval."); return enum_value; } void AAA__3GPP__Report__Interval::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void AAA__3GPP__Report__Interval::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.AAA_3GPP_Report_Interval"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.AAA_3GPP_Report_Interval."); } } void AAA__3GPP__Report__Interval::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Report_Interval."); text_buf.push_int(enum_value); } void AAA__3GPP__Report__Interval::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.AAA_3GPP_Report_Interval.", enum_value); } void AAA__3GPP__Report__Interval::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void AAA__3GPP__Report__Interval::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int AAA__3GPP__Report__Interval::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 5, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int AAA__3GPP__Report__Interval::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 5); } void AAA__3GPP__Report__Interval_template::copy_template(const AAA__3GPP__Report__Interval_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new AAA__3GPP__Report__Interval_template[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 AAA__3GPP__Report__Interval_template(*other_value.implication_.precondition); implication_.implied_template = new AAA__3GPP__Report__Interval_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_Report_Interval."); } } AAA__3GPP__Report__Interval_template::AAA__3GPP__Report__Interval_template() { } AAA__3GPP__Report__Interval_template::AAA__3GPP__Report__Interval_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } AAA__3GPP__Report__Interval_template::AAA__3GPP__Report__Interval_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!AAA__3GPP__Report__Interval::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.AAA_3GPP_Report_Interval with unknown numeric value %d.", other_value); single_value = (AAA__3GPP__Report__Interval::enum_type)other_value; } AAA__3GPP__Report__Interval_template::AAA__3GPP__Report__Interval_template(AAA__3GPP__Report__Interval::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } AAA__3GPP__Report__Interval_template::AAA__3GPP__Report__Interval_template(const AAA__3GPP__Report__Interval& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == AAA__3GPP__Report__Interval::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Report_Interval."); single_value = other_value.enum_value; } AAA__3GPP__Report__Interval_template::AAA__3GPP__Report__Interval_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__Report__Interval::enum_type)(const AAA__3GPP__Report__Interval&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.AAA_3GPP_Report_Interval from an unbound optional field."); } } AAA__3GPP__Report__Interval_template::AAA__3GPP__Report__Interval_template(AAA__3GPP__Report__Interval_template* p_precondition, AAA__3GPP__Report__Interval_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } AAA__3GPP__Report__Interval_template::AAA__3GPP__Report__Interval_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; } AAA__3GPP__Report__Interval_template::AAA__3GPP__Report__Interval_template(const AAA__3GPP__Report__Interval_template& other_value) : Base_Template() { copy_template(other_value); } AAA__3GPP__Report__Interval_template::~AAA__3GPP__Report__Interval_template() { clean_up(); } boolean AAA__3GPP__Report__Interval_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean AAA__3GPP__Report__Interval_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != AAA__3GPP__Report__Interval::UNBOUND_VALUE; } void AAA__3GPP__Report__Interval_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } AAA__3GPP__Report__Interval_template& AAA__3GPP__Report__Interval_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } AAA__3GPP__Report__Interval_template& AAA__3GPP__Report__Interval_template::operator=(int other_value) { if (!AAA__3GPP__Report__Interval::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.AAA_3GPP_Report_Interval.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__Report__Interval::enum_type)other_value; return *this; } AAA__3GPP__Report__Interval_template& AAA__3GPP__Report__Interval_template::operator=(AAA__3GPP__Report__Interval::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } AAA__3GPP__Report__Interval_template& AAA__3GPP__Report__Interval_template::operator=(const AAA__3GPP__Report__Interval& other_value) { if (other_value.enum_value == AAA__3GPP__Report__Interval::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Report_Interval to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } AAA__3GPP__Report__Interval_template& AAA__3GPP__Report__Interval_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__Report__Interval::enum_type)(const AAA__3GPP__Report__Interval&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.AAA_3GPP_Report_Interval."); } return *this; } AAA__3GPP__Report__Interval_template& AAA__3GPP__Report__Interval_template::operator=(const AAA__3GPP__Report__Interval_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean AAA__3GPP__Report__Interval_template::match(AAA__3GPP__Report__Interval::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_Report_Interval."); } return FALSE; } boolean AAA__3GPP__Report__Interval_template::match(const AAA__3GPP__Report__Interval& other_value, boolean) const { if (other_value.enum_value == AAA__3GPP__Report__Interval::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.AAA_3GPP_Report_Interval with an unbound value."); return match(other_value.enum_value); } AAA__3GPP__Report__Interval::enum_type AAA__3GPP__Report__Interval_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.AAA_3GPP_Report_Interval."); return single_value; } void AAA__3GPP__Report__Interval_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.AAA_3GPP_Report_Interval."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new AAA__3GPP__Report__Interval_template[list_length]; } AAA__3GPP__Report__Interval_template& AAA__3GPP__Report__Interval_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.AAA_3GPP_Report_Interval."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.AAA_3GPP_Report_Interval."); return value_list.list_value[list_index]; } void AAA__3GPP__Report__Interval_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(AAA__3GPP__Report__Interval::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void AAA__3GPP__Report__Interval_template::log_match(const AAA__3GPP__Report__Interval& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void AAA__3GPP__Report__Interval_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_Report_Interval."); } } void AAA__3GPP__Report__Interval_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (AAA__3GPP__Report__Interval::enum_type)text_buf.pull_int().get_val(); if (!AAA__3GPP__Report__Interval::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.AAA_3GPP_Report_Interval.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new AAA__3GPP__Report__Interval_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.AAA_3GPP_Report_Interval."); } } boolean AAA__3GPP__Report__Interval_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean AAA__3GPP__Report__Interval_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { AAA__3GPP__Report__Interval_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { AAA__3GPP__Report__Interval::enum_type enum_val = AAA__3GPP__Report__Interval::str_to_enum(m_p->get_enumerated()); if (!AAA__3GPP__Report__Interval::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.AAA_3GPP_Report_Interval."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { AAA__3GPP__Report__Interval_template* precondition = new AAA__3GPP__Report__Interval_template; precondition->set_param(*m_p->get_elem(0)); AAA__3GPP__Report__Interval_template* implied_template = new AAA__3GPP__Report__Interval_template; implied_template->set_param(*m_p->get_elem(1)); *this = AAA__3GPP__Report__Interval_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.AAA_3GPP_Report_Interval"); } is_ifpresent = param.get_ifpresent(); } void AAA__3GPP__Report__Interval_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.AAA_3GPP_Report_Interval"); } DCA__3GPP__Dynamic__Address__Flag__Extension::DCA__3GPP__Dynamic__Address__Flag__Extension() { enum_value = UNBOUND_VALUE; } DCA__3GPP__Dynamic__Address__Flag__Extension::DCA__3GPP__Dynamic__Address__Flag__Extension(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag_Extension with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } DCA__3GPP__Dynamic__Address__Flag__Extension::DCA__3GPP__Dynamic__Address__Flag__Extension(enum_type other_value) { enum_value = other_value; } DCA__3GPP__Dynamic__Address__Flag__Extension::DCA__3GPP__Dynamic__Address__Flag__Extension(const DCA__3GPP__Dynamic__Address__Flag__Extension& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag_Extension."); enum_value = other_value.enum_value; } DCA__3GPP__Dynamic__Address__Flag__Extension& DCA__3GPP__Dynamic__Address__Flag__Extension::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag_Extension.", other_value); enum_value = (enum_type)other_value; return *this; } DCA__3GPP__Dynamic__Address__Flag__Extension& DCA__3GPP__Dynamic__Address__Flag__Extension::operator=(enum_type other_value) { enum_value = other_value; return *this; } DCA__3GPP__Dynamic__Address__Flag__Extension& DCA__3GPP__Dynamic__Address__Flag__Extension::operator=(const DCA__3GPP__Dynamic__Address__Flag__Extension& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag_Extension."); enum_value = other_value.enum_value; return *this; } boolean DCA__3GPP__Dynamic__Address__Flag__Extension::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag_Extension."); return enum_value == other_value; } boolean DCA__3GPP__Dynamic__Address__Flag__Extension::operator==(const DCA__3GPP__Dynamic__Address__Flag__Extension& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag_Extension."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag_Extension."); return enum_value == other_value.enum_value; } boolean DCA__3GPP__Dynamic__Address__Flag__Extension::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag_Extension."); return enum_value < other_value; } boolean DCA__3GPP__Dynamic__Address__Flag__Extension::operator<(const DCA__3GPP__Dynamic__Address__Flag__Extension& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag_Extension."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag_Extension."); return enum_value < other_value.enum_value; } boolean DCA__3GPP__Dynamic__Address__Flag__Extension::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag_Extension."); return enum_value > other_value; } boolean DCA__3GPP__Dynamic__Address__Flag__Extension::operator>(const DCA__3GPP__Dynamic__Address__Flag__Extension& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag_Extension."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag_Extension."); return enum_value > other_value.enum_value; } const char *DCA__3GPP__Dynamic__Address__Flag__Extension::enum_to_str(enum_type enum_par) { switch (enum_par) { case STATIC: return "STATIC"; case DYNAMIC: return "DYNAMIC"; default: return ""; } } DCA__3GPP__Dynamic__Address__Flag__Extension::enum_type DCA__3GPP__Dynamic__Address__Flag__Extension::str_to_enum(const char *str_par) { if (!strcmp(str_par, "STATIC")) return STATIC; else if (!strcmp(str_par, "DYNAMIC")) return DYNAMIC; else return UNKNOWN_VALUE; } boolean DCA__3GPP__Dynamic__Address__Flag__Extension::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: return TRUE; default: return FALSE; } } int DCA__3GPP__Dynamic__Address__Flag__Extension::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag_Extension.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int DCA__3GPP__Dynamic__Address__Flag__Extension::enum2int(const DCA__3GPP__Dynamic__Address__Flag__Extension& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag_Extension.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void DCA__3GPP__Dynamic__Address__Flag__Extension::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag_Extension.", int_val); enum_value = (enum_type)int_val; } DCA__3GPP__Dynamic__Address__Flag__Extension::operator DCA__3GPP__Dynamic__Address__Flag__Extension::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag_Extension."); return enum_value; } void DCA__3GPP__Dynamic__Address__Flag__Extension::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void DCA__3GPP__Dynamic__Address__Flag__Extension::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag_Extension"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag_Extension."); } } void DCA__3GPP__Dynamic__Address__Flag__Extension::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag_Extension."); text_buf.push_int(enum_value); } void DCA__3GPP__Dynamic__Address__Flag__Extension::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag_Extension.", enum_value); } void DCA__3GPP__Dynamic__Address__Flag__Extension::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void DCA__3GPP__Dynamic__Address__Flag__Extension::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int DCA__3GPP__Dynamic__Address__Flag__Extension::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int DCA__3GPP__Dynamic__Address__Flag__Extension::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void DCA__3GPP__Dynamic__Address__Flag__Extension_template::copy_template(const DCA__3GPP__Dynamic__Address__Flag__Extension_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new DCA__3GPP__Dynamic__Address__Flag__Extension_template[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 DCA__3GPP__Dynamic__Address__Flag__Extension_template(*other_value.implication_.precondition); implication_.implied_template = new DCA__3GPP__Dynamic__Address__Flag__Extension_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag_Extension."); } } DCA__3GPP__Dynamic__Address__Flag__Extension_template::DCA__3GPP__Dynamic__Address__Flag__Extension_template() { } DCA__3GPP__Dynamic__Address__Flag__Extension_template::DCA__3GPP__Dynamic__Address__Flag__Extension_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } DCA__3GPP__Dynamic__Address__Flag__Extension_template::DCA__3GPP__Dynamic__Address__Flag__Extension_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!DCA__3GPP__Dynamic__Address__Flag__Extension::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag_Extension with unknown numeric value %d.", other_value); single_value = (DCA__3GPP__Dynamic__Address__Flag__Extension::enum_type)other_value; } DCA__3GPP__Dynamic__Address__Flag__Extension_template::DCA__3GPP__Dynamic__Address__Flag__Extension_template(DCA__3GPP__Dynamic__Address__Flag__Extension::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } DCA__3GPP__Dynamic__Address__Flag__Extension_template::DCA__3GPP__Dynamic__Address__Flag__Extension_template(const DCA__3GPP__Dynamic__Address__Flag__Extension& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == DCA__3GPP__Dynamic__Address__Flag__Extension::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag_Extension."); single_value = other_value.enum_value; } DCA__3GPP__Dynamic__Address__Flag__Extension_template::DCA__3GPP__Dynamic__Address__Flag__Extension_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Dynamic__Address__Flag__Extension::enum_type)(const DCA__3GPP__Dynamic__Address__Flag__Extension&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag_Extension from an unbound optional field."); } } DCA__3GPP__Dynamic__Address__Flag__Extension_template::DCA__3GPP__Dynamic__Address__Flag__Extension_template(DCA__3GPP__Dynamic__Address__Flag__Extension_template* p_precondition, DCA__3GPP__Dynamic__Address__Flag__Extension_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } DCA__3GPP__Dynamic__Address__Flag__Extension_template::DCA__3GPP__Dynamic__Address__Flag__Extension_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; } DCA__3GPP__Dynamic__Address__Flag__Extension_template::DCA__3GPP__Dynamic__Address__Flag__Extension_template(const DCA__3GPP__Dynamic__Address__Flag__Extension_template& other_value) : Base_Template() { copy_template(other_value); } DCA__3GPP__Dynamic__Address__Flag__Extension_template::~DCA__3GPP__Dynamic__Address__Flag__Extension_template() { clean_up(); } boolean DCA__3GPP__Dynamic__Address__Flag__Extension_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean DCA__3GPP__Dynamic__Address__Flag__Extension_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != DCA__3GPP__Dynamic__Address__Flag__Extension::UNBOUND_VALUE; } void DCA__3GPP__Dynamic__Address__Flag__Extension_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } DCA__3GPP__Dynamic__Address__Flag__Extension_template& DCA__3GPP__Dynamic__Address__Flag__Extension_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } DCA__3GPP__Dynamic__Address__Flag__Extension_template& DCA__3GPP__Dynamic__Address__Flag__Extension_template::operator=(int other_value) { if (!DCA__3GPP__Dynamic__Address__Flag__Extension::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag_Extension.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Dynamic__Address__Flag__Extension::enum_type)other_value; return *this; } DCA__3GPP__Dynamic__Address__Flag__Extension_template& DCA__3GPP__Dynamic__Address__Flag__Extension_template::operator=(DCA__3GPP__Dynamic__Address__Flag__Extension::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } DCA__3GPP__Dynamic__Address__Flag__Extension_template& DCA__3GPP__Dynamic__Address__Flag__Extension_template::operator=(const DCA__3GPP__Dynamic__Address__Flag__Extension& other_value) { if (other_value.enum_value == DCA__3GPP__Dynamic__Address__Flag__Extension::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag_Extension to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } DCA__3GPP__Dynamic__Address__Flag__Extension_template& DCA__3GPP__Dynamic__Address__Flag__Extension_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Dynamic__Address__Flag__Extension::enum_type)(const DCA__3GPP__Dynamic__Address__Flag__Extension&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag_Extension."); } return *this; } DCA__3GPP__Dynamic__Address__Flag__Extension_template& DCA__3GPP__Dynamic__Address__Flag__Extension_template::operator=(const DCA__3GPP__Dynamic__Address__Flag__Extension_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean DCA__3GPP__Dynamic__Address__Flag__Extension_template::match(DCA__3GPP__Dynamic__Address__Flag__Extension::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag_Extension."); } return FALSE; } boolean DCA__3GPP__Dynamic__Address__Flag__Extension_template::match(const DCA__3GPP__Dynamic__Address__Flag__Extension& other_value, boolean) const { if (other_value.enum_value == DCA__3GPP__Dynamic__Address__Flag__Extension::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag_Extension with an unbound value."); return match(other_value.enum_value); } DCA__3GPP__Dynamic__Address__Flag__Extension::enum_type DCA__3GPP__Dynamic__Address__Flag__Extension_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag_Extension."); return single_value; } void DCA__3GPP__Dynamic__Address__Flag__Extension_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag_Extension."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new DCA__3GPP__Dynamic__Address__Flag__Extension_template[list_length]; } DCA__3GPP__Dynamic__Address__Flag__Extension_template& DCA__3GPP__Dynamic__Address__Flag__Extension_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag_Extension."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag_Extension."); return value_list.list_value[list_index]; } void DCA__3GPP__Dynamic__Address__Flag__Extension_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(DCA__3GPP__Dynamic__Address__Flag__Extension::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void DCA__3GPP__Dynamic__Address__Flag__Extension_template::log_match(const DCA__3GPP__Dynamic__Address__Flag__Extension& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void DCA__3GPP__Dynamic__Address__Flag__Extension_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag_Extension."); } } void DCA__3GPP__Dynamic__Address__Flag__Extension_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (DCA__3GPP__Dynamic__Address__Flag__Extension::enum_type)text_buf.pull_int().get_val(); if (!DCA__3GPP__Dynamic__Address__Flag__Extension::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag_Extension.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new DCA__3GPP__Dynamic__Address__Flag__Extension_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag_Extension."); } } boolean DCA__3GPP__Dynamic__Address__Flag__Extension_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean DCA__3GPP__Dynamic__Address__Flag__Extension_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { DCA__3GPP__Dynamic__Address__Flag__Extension_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { DCA__3GPP__Dynamic__Address__Flag__Extension::enum_type enum_val = DCA__3GPP__Dynamic__Address__Flag__Extension::str_to_enum(m_p->get_enumerated()); if (!DCA__3GPP__Dynamic__Address__Flag__Extension::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag_Extension."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { DCA__3GPP__Dynamic__Address__Flag__Extension_template* precondition = new DCA__3GPP__Dynamic__Address__Flag__Extension_template; precondition->set_param(*m_p->get_elem(0)); DCA__3GPP__Dynamic__Address__Flag__Extension_template* implied_template = new DCA__3GPP__Dynamic__Address__Flag__Extension_template; implied_template->set_param(*m_p->get_elem(1)); *this = DCA__3GPP__Dynamic__Address__Flag__Extension_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag_Extension"); } is_ifpresent = param.get_ifpresent(); } void DCA__3GPP__Dynamic__Address__Flag__Extension_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag_Extension"); } BASE__NONE__Redirect__Host__Usage::BASE__NONE__Redirect__Host__Usage() { enum_value = UNBOUND_VALUE; } BASE__NONE__Redirect__Host__Usage::BASE__NONE__Redirect__Host__Usage(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.BASE_NONE_Redirect_Host_Usage with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } BASE__NONE__Redirect__Host__Usage::BASE__NONE__Redirect__Host__Usage(enum_type other_value) { enum_value = other_value; } BASE__NONE__Redirect__Host__Usage::BASE__NONE__Redirect__Host__Usage(const BASE__NONE__Redirect__Host__Usage& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.BASE_NONE_Redirect_Host_Usage."); enum_value = other_value.enum_value; } BASE__NONE__Redirect__Host__Usage& BASE__NONE__Redirect__Host__Usage::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.BASE_NONE_Redirect_Host_Usage.", other_value); enum_value = (enum_type)other_value; return *this; } BASE__NONE__Redirect__Host__Usage& BASE__NONE__Redirect__Host__Usage::operator=(enum_type other_value) { enum_value = other_value; return *this; } BASE__NONE__Redirect__Host__Usage& BASE__NONE__Redirect__Host__Usage::operator=(const BASE__NONE__Redirect__Host__Usage& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.BASE_NONE_Redirect_Host_Usage."); enum_value = other_value.enum_value; return *this; } boolean BASE__NONE__Redirect__Host__Usage::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.BASE_NONE_Redirect_Host_Usage."); return enum_value == other_value; } boolean BASE__NONE__Redirect__Host__Usage::operator==(const BASE__NONE__Redirect__Host__Usage& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.BASE_NONE_Redirect_Host_Usage."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.BASE_NONE_Redirect_Host_Usage."); return enum_value == other_value.enum_value; } boolean BASE__NONE__Redirect__Host__Usage::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.BASE_NONE_Redirect_Host_Usage."); return enum_value < other_value; } boolean BASE__NONE__Redirect__Host__Usage::operator<(const BASE__NONE__Redirect__Host__Usage& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.BASE_NONE_Redirect_Host_Usage."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.BASE_NONE_Redirect_Host_Usage."); return enum_value < other_value.enum_value; } boolean BASE__NONE__Redirect__Host__Usage::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.BASE_NONE_Redirect_Host_Usage."); return enum_value > other_value; } boolean BASE__NONE__Redirect__Host__Usage::operator>(const BASE__NONE__Redirect__Host__Usage& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.BASE_NONE_Redirect_Host_Usage."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.BASE_NONE_Redirect_Host_Usage."); return enum_value > other_value.enum_value; } const char *BASE__NONE__Redirect__Host__Usage::enum_to_str(enum_type enum_par) { switch (enum_par) { case DONT__CACHE: return "DONT_CACHE"; case ALL__SESSION: return "ALL_SESSION"; case ALL__REALM: return "ALL_REALM"; case REALM__AND__APPLICATION: return "REALM_AND_APPLICATION"; case ALL__APPLICATION: return "ALL_APPLICATION"; case ALL__HOST: return "ALL_HOST"; case ALL__USER: return "ALL_USER"; default: return ""; } } BASE__NONE__Redirect__Host__Usage::enum_type BASE__NONE__Redirect__Host__Usage::str_to_enum(const char *str_par) { if (!strcmp(str_par, "DONT_CACHE")) return DONT__CACHE; else if (!strcmp(str_par, "ALL_SESSION")) return ALL__SESSION; else if (!strcmp(str_par, "ALL_REALM")) return ALL__REALM; else if (!strcmp(str_par, "REALM_AND_APPLICATION")) return REALM__AND__APPLICATION; else if (!strcmp(str_par, "ALL_APPLICATION")) return ALL__APPLICATION; else if (!strcmp(str_par, "ALL_HOST")) return ALL__HOST; else if (!strcmp(str_par, "ALL_USER")) return ALL__USER; else return UNKNOWN_VALUE; } boolean BASE__NONE__Redirect__Host__Usage::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: return TRUE; default: return FALSE; } } int BASE__NONE__Redirect__Host__Usage::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.BASE_NONE_Redirect_Host_Usage.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int BASE__NONE__Redirect__Host__Usage::enum2int(const BASE__NONE__Redirect__Host__Usage& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.BASE_NONE_Redirect_Host_Usage.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void BASE__NONE__Redirect__Host__Usage::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.BASE_NONE_Redirect_Host_Usage.", int_val); enum_value = (enum_type)int_val; } BASE__NONE__Redirect__Host__Usage::operator BASE__NONE__Redirect__Host__Usage::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.BASE_NONE_Redirect_Host_Usage."); return enum_value; } void BASE__NONE__Redirect__Host__Usage::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void BASE__NONE__Redirect__Host__Usage::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.BASE_NONE_Redirect_Host_Usage"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.BASE_NONE_Redirect_Host_Usage."); } } void BASE__NONE__Redirect__Host__Usage::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.BASE_NONE_Redirect_Host_Usage."); text_buf.push_int(enum_value); } void BASE__NONE__Redirect__Host__Usage::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.BASE_NONE_Redirect_Host_Usage.", enum_value); } void BASE__NONE__Redirect__Host__Usage::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void BASE__NONE__Redirect__Host__Usage::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int BASE__NONE__Redirect__Host__Usage::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 3, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int BASE__NONE__Redirect__Host__Usage::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 3); } void BASE__NONE__Redirect__Host__Usage_template::copy_template(const BASE__NONE__Redirect__Host__Usage_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new BASE__NONE__Redirect__Host__Usage_template[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 BASE__NONE__Redirect__Host__Usage_template(*other_value.implication_.precondition); implication_.implied_template = new BASE__NONE__Redirect__Host__Usage_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.BASE_NONE_Redirect_Host_Usage."); } } BASE__NONE__Redirect__Host__Usage_template::BASE__NONE__Redirect__Host__Usage_template() { } BASE__NONE__Redirect__Host__Usage_template::BASE__NONE__Redirect__Host__Usage_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } BASE__NONE__Redirect__Host__Usage_template::BASE__NONE__Redirect__Host__Usage_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!BASE__NONE__Redirect__Host__Usage::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.BASE_NONE_Redirect_Host_Usage with unknown numeric value %d.", other_value); single_value = (BASE__NONE__Redirect__Host__Usage::enum_type)other_value; } BASE__NONE__Redirect__Host__Usage_template::BASE__NONE__Redirect__Host__Usage_template(BASE__NONE__Redirect__Host__Usage::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } BASE__NONE__Redirect__Host__Usage_template::BASE__NONE__Redirect__Host__Usage_template(const BASE__NONE__Redirect__Host__Usage& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == BASE__NONE__Redirect__Host__Usage::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.BASE_NONE_Redirect_Host_Usage."); single_value = other_value.enum_value; } BASE__NONE__Redirect__Host__Usage_template::BASE__NONE__Redirect__Host__Usage_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (BASE__NONE__Redirect__Host__Usage::enum_type)(const BASE__NONE__Redirect__Host__Usage&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.BASE_NONE_Redirect_Host_Usage from an unbound optional field."); } } BASE__NONE__Redirect__Host__Usage_template::BASE__NONE__Redirect__Host__Usage_template(BASE__NONE__Redirect__Host__Usage_template* p_precondition, BASE__NONE__Redirect__Host__Usage_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } BASE__NONE__Redirect__Host__Usage_template::BASE__NONE__Redirect__Host__Usage_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; } BASE__NONE__Redirect__Host__Usage_template::BASE__NONE__Redirect__Host__Usage_template(const BASE__NONE__Redirect__Host__Usage_template& other_value) : Base_Template() { copy_template(other_value); } BASE__NONE__Redirect__Host__Usage_template::~BASE__NONE__Redirect__Host__Usage_template() { clean_up(); } boolean BASE__NONE__Redirect__Host__Usage_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean BASE__NONE__Redirect__Host__Usage_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != BASE__NONE__Redirect__Host__Usage::UNBOUND_VALUE; } void BASE__NONE__Redirect__Host__Usage_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } BASE__NONE__Redirect__Host__Usage_template& BASE__NONE__Redirect__Host__Usage_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } BASE__NONE__Redirect__Host__Usage_template& BASE__NONE__Redirect__Host__Usage_template::operator=(int other_value) { if (!BASE__NONE__Redirect__Host__Usage::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.BASE_NONE_Redirect_Host_Usage.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (BASE__NONE__Redirect__Host__Usage::enum_type)other_value; return *this; } BASE__NONE__Redirect__Host__Usage_template& BASE__NONE__Redirect__Host__Usage_template::operator=(BASE__NONE__Redirect__Host__Usage::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } BASE__NONE__Redirect__Host__Usage_template& BASE__NONE__Redirect__Host__Usage_template::operator=(const BASE__NONE__Redirect__Host__Usage& other_value) { if (other_value.enum_value == BASE__NONE__Redirect__Host__Usage::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.BASE_NONE_Redirect_Host_Usage to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } BASE__NONE__Redirect__Host__Usage_template& BASE__NONE__Redirect__Host__Usage_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (BASE__NONE__Redirect__Host__Usage::enum_type)(const BASE__NONE__Redirect__Host__Usage&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.BASE_NONE_Redirect_Host_Usage."); } return *this; } BASE__NONE__Redirect__Host__Usage_template& BASE__NONE__Redirect__Host__Usage_template::operator=(const BASE__NONE__Redirect__Host__Usage_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean BASE__NONE__Redirect__Host__Usage_template::match(BASE__NONE__Redirect__Host__Usage::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.BASE_NONE_Redirect_Host_Usage."); } return FALSE; } boolean BASE__NONE__Redirect__Host__Usage_template::match(const BASE__NONE__Redirect__Host__Usage& other_value, boolean) const { if (other_value.enum_value == BASE__NONE__Redirect__Host__Usage::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.BASE_NONE_Redirect_Host_Usage with an unbound value."); return match(other_value.enum_value); } BASE__NONE__Redirect__Host__Usage::enum_type BASE__NONE__Redirect__Host__Usage_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.BASE_NONE_Redirect_Host_Usage."); return single_value; } void BASE__NONE__Redirect__Host__Usage_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.BASE_NONE_Redirect_Host_Usage."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new BASE__NONE__Redirect__Host__Usage_template[list_length]; } BASE__NONE__Redirect__Host__Usage_template& BASE__NONE__Redirect__Host__Usage_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.BASE_NONE_Redirect_Host_Usage."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.BASE_NONE_Redirect_Host_Usage."); return value_list.list_value[list_index]; } void BASE__NONE__Redirect__Host__Usage_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(BASE__NONE__Redirect__Host__Usage::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void BASE__NONE__Redirect__Host__Usage_template::log_match(const BASE__NONE__Redirect__Host__Usage& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void BASE__NONE__Redirect__Host__Usage_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.BASE_NONE_Redirect_Host_Usage."); } } void BASE__NONE__Redirect__Host__Usage_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (BASE__NONE__Redirect__Host__Usage::enum_type)text_buf.pull_int().get_val(); if (!BASE__NONE__Redirect__Host__Usage::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.BASE_NONE_Redirect_Host_Usage.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new BASE__NONE__Redirect__Host__Usage_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.BASE_NONE_Redirect_Host_Usage."); } } boolean BASE__NONE__Redirect__Host__Usage_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean BASE__NONE__Redirect__Host__Usage_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { BASE__NONE__Redirect__Host__Usage_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { BASE__NONE__Redirect__Host__Usage::enum_type enum_val = BASE__NONE__Redirect__Host__Usage::str_to_enum(m_p->get_enumerated()); if (!BASE__NONE__Redirect__Host__Usage::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.BASE_NONE_Redirect_Host_Usage."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { BASE__NONE__Redirect__Host__Usage_template* precondition = new BASE__NONE__Redirect__Host__Usage_template; precondition->set_param(*m_p->get_elem(0)); BASE__NONE__Redirect__Host__Usage_template* implied_template = new BASE__NONE__Redirect__Host__Usage_template; implied_template->set_param(*m_p->get_elem(1)); *this = BASE__NONE__Redirect__Host__Usage_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.BASE_NONE_Redirect_Host_Usage"); } is_ifpresent = param.get_ifpresent(); } void BASE__NONE__Redirect__Host__Usage_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.BASE_NONE_Redirect_Host_Usage"); } DCA__3GPP__CSG__Access__Mode::DCA__3GPP__CSG__Access__Mode() { enum_value = UNBOUND_VALUE; } DCA__3GPP__CSG__Access__Mode::DCA__3GPP__CSG__Access__Mode(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.DCA_3GPP_CSG_Access_Mode with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } DCA__3GPP__CSG__Access__Mode::DCA__3GPP__CSG__Access__Mode(enum_type other_value) { enum_value = other_value; } DCA__3GPP__CSG__Access__Mode::DCA__3GPP__CSG__Access__Mode(const DCA__3GPP__CSG__Access__Mode& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_CSG_Access_Mode."); enum_value = other_value.enum_value; } DCA__3GPP__CSG__Access__Mode& DCA__3GPP__CSG__Access__Mode::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_CSG_Access_Mode.", other_value); enum_value = (enum_type)other_value; return *this; } DCA__3GPP__CSG__Access__Mode& DCA__3GPP__CSG__Access__Mode::operator=(enum_type other_value) { enum_value = other_value; return *this; } DCA__3GPP__CSG__Access__Mode& DCA__3GPP__CSG__Access__Mode::operator=(const DCA__3GPP__CSG__Access__Mode& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_CSG_Access_Mode."); enum_value = other_value.enum_value; return *this; } boolean DCA__3GPP__CSG__Access__Mode::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_CSG_Access_Mode."); return enum_value == other_value; } boolean DCA__3GPP__CSG__Access__Mode::operator==(const DCA__3GPP__CSG__Access__Mode& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_CSG_Access_Mode."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_CSG_Access_Mode."); return enum_value == other_value.enum_value; } boolean DCA__3GPP__CSG__Access__Mode::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_CSG_Access_Mode."); return enum_value < other_value; } boolean DCA__3GPP__CSG__Access__Mode::operator<(const DCA__3GPP__CSG__Access__Mode& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_CSG_Access_Mode."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_CSG_Access_Mode."); return enum_value < other_value.enum_value; } boolean DCA__3GPP__CSG__Access__Mode::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_CSG_Access_Mode."); return enum_value > other_value; } boolean DCA__3GPP__CSG__Access__Mode::operator>(const DCA__3GPP__CSG__Access__Mode& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_CSG_Access_Mode."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_CSG_Access_Mode."); return enum_value > other_value.enum_value; } const char *DCA__3GPP__CSG__Access__Mode::enum_to_str(enum_type enum_par) { switch (enum_par) { case CLOSED__MODE: return "CLOSED_MODE"; case HYBRID__MODE: return "HYBRID_MODE"; default: return ""; } } DCA__3GPP__CSG__Access__Mode::enum_type DCA__3GPP__CSG__Access__Mode::str_to_enum(const char *str_par) { if (!strcmp(str_par, "CLOSED_MODE")) return CLOSED__MODE; else if (!strcmp(str_par, "HYBRID_MODE")) return HYBRID__MODE; else return UNKNOWN_VALUE; } boolean DCA__3GPP__CSG__Access__Mode::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: return TRUE; default: return FALSE; } } int DCA__3GPP__CSG__Access__Mode::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_CSG_Access_Mode.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int DCA__3GPP__CSG__Access__Mode::enum2int(const DCA__3GPP__CSG__Access__Mode& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_CSG_Access_Mode.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void DCA__3GPP__CSG__Access__Mode::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_CSG_Access_Mode.", int_val); enum_value = (enum_type)int_val; } DCA__3GPP__CSG__Access__Mode::operator DCA__3GPP__CSG__Access__Mode::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.DCA_3GPP_CSG_Access_Mode."); return enum_value; } void DCA__3GPP__CSG__Access__Mode::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void DCA__3GPP__CSG__Access__Mode::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.DCA_3GPP_CSG_Access_Mode"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_CSG_Access_Mode."); } } void DCA__3GPP__CSG__Access__Mode::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_CSG_Access_Mode."); text_buf.push_int(enum_value); } void DCA__3GPP__CSG__Access__Mode::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.DCA_3GPP_CSG_Access_Mode.", enum_value); } void DCA__3GPP__CSG__Access__Mode::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void DCA__3GPP__CSG__Access__Mode::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int DCA__3GPP__CSG__Access__Mode::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int DCA__3GPP__CSG__Access__Mode::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void DCA__3GPP__CSG__Access__Mode_template::copy_template(const DCA__3GPP__CSG__Access__Mode_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new DCA__3GPP__CSG__Access__Mode_template[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 DCA__3GPP__CSG__Access__Mode_template(*other_value.implication_.precondition); implication_.implied_template = new DCA__3GPP__CSG__Access__Mode_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_CSG_Access_Mode."); } } DCA__3GPP__CSG__Access__Mode_template::DCA__3GPP__CSG__Access__Mode_template() { } DCA__3GPP__CSG__Access__Mode_template::DCA__3GPP__CSG__Access__Mode_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } DCA__3GPP__CSG__Access__Mode_template::DCA__3GPP__CSG__Access__Mode_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!DCA__3GPP__CSG__Access__Mode::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.DCA_3GPP_CSG_Access_Mode with unknown numeric value %d.", other_value); single_value = (DCA__3GPP__CSG__Access__Mode::enum_type)other_value; } DCA__3GPP__CSG__Access__Mode_template::DCA__3GPP__CSG__Access__Mode_template(DCA__3GPP__CSG__Access__Mode::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } DCA__3GPP__CSG__Access__Mode_template::DCA__3GPP__CSG__Access__Mode_template(const DCA__3GPP__CSG__Access__Mode& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == DCA__3GPP__CSG__Access__Mode::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_CSG_Access_Mode."); single_value = other_value.enum_value; } DCA__3GPP__CSG__Access__Mode_template::DCA__3GPP__CSG__Access__Mode_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__CSG__Access__Mode::enum_type)(const DCA__3GPP__CSG__Access__Mode&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.DCA_3GPP_CSG_Access_Mode from an unbound optional field."); } } DCA__3GPP__CSG__Access__Mode_template::DCA__3GPP__CSG__Access__Mode_template(DCA__3GPP__CSG__Access__Mode_template* p_precondition, DCA__3GPP__CSG__Access__Mode_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } DCA__3GPP__CSG__Access__Mode_template::DCA__3GPP__CSG__Access__Mode_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; } DCA__3GPP__CSG__Access__Mode_template::DCA__3GPP__CSG__Access__Mode_template(const DCA__3GPP__CSG__Access__Mode_template& other_value) : Base_Template() { copy_template(other_value); } DCA__3GPP__CSG__Access__Mode_template::~DCA__3GPP__CSG__Access__Mode_template() { clean_up(); } boolean DCA__3GPP__CSG__Access__Mode_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean DCA__3GPP__CSG__Access__Mode_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != DCA__3GPP__CSG__Access__Mode::UNBOUND_VALUE; } void DCA__3GPP__CSG__Access__Mode_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } DCA__3GPP__CSG__Access__Mode_template& DCA__3GPP__CSG__Access__Mode_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } DCA__3GPP__CSG__Access__Mode_template& DCA__3GPP__CSG__Access__Mode_template::operator=(int other_value) { if (!DCA__3GPP__CSG__Access__Mode::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.DCA_3GPP_CSG_Access_Mode.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__CSG__Access__Mode::enum_type)other_value; return *this; } DCA__3GPP__CSG__Access__Mode_template& DCA__3GPP__CSG__Access__Mode_template::operator=(DCA__3GPP__CSG__Access__Mode::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } DCA__3GPP__CSG__Access__Mode_template& DCA__3GPP__CSG__Access__Mode_template::operator=(const DCA__3GPP__CSG__Access__Mode& other_value) { if (other_value.enum_value == DCA__3GPP__CSG__Access__Mode::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_CSG_Access_Mode to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } DCA__3GPP__CSG__Access__Mode_template& DCA__3GPP__CSG__Access__Mode_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__CSG__Access__Mode::enum_type)(const DCA__3GPP__CSG__Access__Mode&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.DCA_3GPP_CSG_Access_Mode."); } return *this; } DCA__3GPP__CSG__Access__Mode_template& DCA__3GPP__CSG__Access__Mode_template::operator=(const DCA__3GPP__CSG__Access__Mode_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean DCA__3GPP__CSG__Access__Mode_template::match(DCA__3GPP__CSG__Access__Mode::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_CSG_Access_Mode."); } return FALSE; } boolean DCA__3GPP__CSG__Access__Mode_template::match(const DCA__3GPP__CSG__Access__Mode& other_value, boolean) const { if (other_value.enum_value == DCA__3GPP__CSG__Access__Mode::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.DCA_3GPP_CSG_Access_Mode with an unbound value."); return match(other_value.enum_value); } DCA__3GPP__CSG__Access__Mode::enum_type DCA__3GPP__CSG__Access__Mode_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.DCA_3GPP_CSG_Access_Mode."); return single_value; } void DCA__3GPP__CSG__Access__Mode_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.DCA_3GPP_CSG_Access_Mode."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new DCA__3GPP__CSG__Access__Mode_template[list_length]; } DCA__3GPP__CSG__Access__Mode_template& DCA__3GPP__CSG__Access__Mode_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.DCA_3GPP_CSG_Access_Mode."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.DCA_3GPP_CSG_Access_Mode."); return value_list.list_value[list_index]; } void DCA__3GPP__CSG__Access__Mode_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(DCA__3GPP__CSG__Access__Mode::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void DCA__3GPP__CSG__Access__Mode_template::log_match(const DCA__3GPP__CSG__Access__Mode& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void DCA__3GPP__CSG__Access__Mode_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_CSG_Access_Mode."); } } void DCA__3GPP__CSG__Access__Mode_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (DCA__3GPP__CSG__Access__Mode::enum_type)text_buf.pull_int().get_val(); if (!DCA__3GPP__CSG__Access__Mode::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_CSG_Access_Mode.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new DCA__3GPP__CSG__Access__Mode_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_CSG_Access_Mode."); } } boolean DCA__3GPP__CSG__Access__Mode_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean DCA__3GPP__CSG__Access__Mode_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { DCA__3GPP__CSG__Access__Mode_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { DCA__3GPP__CSG__Access__Mode::enum_type enum_val = DCA__3GPP__CSG__Access__Mode::str_to_enum(m_p->get_enumerated()); if (!DCA__3GPP__CSG__Access__Mode::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_CSG_Access_Mode."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { DCA__3GPP__CSG__Access__Mode_template* precondition = new DCA__3GPP__CSG__Access__Mode_template; precondition->set_param(*m_p->get_elem(0)); DCA__3GPP__CSG__Access__Mode_template* implied_template = new DCA__3GPP__CSG__Access__Mode_template; implied_template->set_param(*m_p->get_elem(1)); *this = DCA__3GPP__CSG__Access__Mode_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.DCA_3GPP_CSG_Access_Mode"); } is_ifpresent = param.get_ifpresent(); } void DCA__3GPP__CSG__Access__Mode_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.DCA_3GPP_CSG_Access_Mode"); } AAA__3GPP__Equipment__Status::AAA__3GPP__Equipment__Status() { enum_value = UNBOUND_VALUE; } AAA__3GPP__Equipment__Status::AAA__3GPP__Equipment__Status(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.AAA_3GPP_Equipment_Status with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } AAA__3GPP__Equipment__Status::AAA__3GPP__Equipment__Status(enum_type other_value) { enum_value = other_value; } AAA__3GPP__Equipment__Status::AAA__3GPP__Equipment__Status(const AAA__3GPP__Equipment__Status& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Equipment_Status."); enum_value = other_value.enum_value; } AAA__3GPP__Equipment__Status& AAA__3GPP__Equipment__Status::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.AAA_3GPP_Equipment_Status.", other_value); enum_value = (enum_type)other_value; return *this; } AAA__3GPP__Equipment__Status& AAA__3GPP__Equipment__Status::operator=(enum_type other_value) { enum_value = other_value; return *this; } AAA__3GPP__Equipment__Status& AAA__3GPP__Equipment__Status::operator=(const AAA__3GPP__Equipment__Status& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Equipment_Status."); enum_value = other_value.enum_value; return *this; } boolean AAA__3GPP__Equipment__Status::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Equipment_Status."); return enum_value == other_value; } boolean AAA__3GPP__Equipment__Status::operator==(const AAA__3GPP__Equipment__Status& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Equipment_Status."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Equipment_Status."); return enum_value == other_value.enum_value; } boolean AAA__3GPP__Equipment__Status::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Equipment_Status."); return enum_value < other_value; } boolean AAA__3GPP__Equipment__Status::operator<(const AAA__3GPP__Equipment__Status& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Equipment_Status."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Equipment_Status."); return enum_value < other_value.enum_value; } boolean AAA__3GPP__Equipment__Status::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Equipment_Status."); return enum_value > other_value; } boolean AAA__3GPP__Equipment__Status::operator>(const AAA__3GPP__Equipment__Status& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Equipment_Status."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Equipment_Status."); return enum_value > other_value.enum_value; } const char *AAA__3GPP__Equipment__Status::enum_to_str(enum_type enum_par) { switch (enum_par) { case WHITELISTED: return "WHITELISTED"; case BLACKLISTED: return "BLACKLISTED"; case GREYLISTED: return "GREYLISTED"; default: return ""; } } AAA__3GPP__Equipment__Status::enum_type AAA__3GPP__Equipment__Status::str_to_enum(const char *str_par) { if (!strcmp(str_par, "WHITELISTED")) return WHITELISTED; else if (!strcmp(str_par, "BLACKLISTED")) return BLACKLISTED; else if (!strcmp(str_par, "GREYLISTED")) return GREYLISTED; else return UNKNOWN_VALUE; } boolean AAA__3GPP__Equipment__Status::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: case 2: return TRUE; default: return FALSE; } } int AAA__3GPP__Equipment__Status::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.AAA_3GPP_Equipment_Status.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int AAA__3GPP__Equipment__Status::enum2int(const AAA__3GPP__Equipment__Status& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.AAA_3GPP_Equipment_Status.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void AAA__3GPP__Equipment__Status::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.AAA_3GPP_Equipment_Status.", int_val); enum_value = (enum_type)int_val; } AAA__3GPP__Equipment__Status::operator AAA__3GPP__Equipment__Status::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.AAA_3GPP_Equipment_Status."); return enum_value; } void AAA__3GPP__Equipment__Status::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void AAA__3GPP__Equipment__Status::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.AAA_3GPP_Equipment_Status"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.AAA_3GPP_Equipment_Status."); } } void AAA__3GPP__Equipment__Status::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Equipment_Status."); text_buf.push_int(enum_value); } void AAA__3GPP__Equipment__Status::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.AAA_3GPP_Equipment_Status.", enum_value); } void AAA__3GPP__Equipment__Status::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void AAA__3GPP__Equipment__Status::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int AAA__3GPP__Equipment__Status::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int AAA__3GPP__Equipment__Status::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void AAA__3GPP__Equipment__Status_template::copy_template(const AAA__3GPP__Equipment__Status_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new AAA__3GPP__Equipment__Status_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].copy_template(other_value.value_list.list_value[list_count]); break; case IMPLICATION_MATCH: implication_.precondition = new AAA__3GPP__Equipment__Status_template(*other_value.implication_.precondition); implication_.implied_template = new AAA__3GPP__Equipment__Status_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_Equipment_Status."); } } AAA__3GPP__Equipment__Status_template::AAA__3GPP__Equipment__Status_template() { } AAA__3GPP__Equipment__Status_template::AAA__3GPP__Equipment__Status_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } AAA__3GPP__Equipment__Status_template::AAA__3GPP__Equipment__Status_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!AAA__3GPP__Equipment__Status::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.AAA_3GPP_Equipment_Status with unknown numeric value %d.", other_value); single_value = (AAA__3GPP__Equipment__Status::enum_type)other_value; } AAA__3GPP__Equipment__Status_template::AAA__3GPP__Equipment__Status_template(AAA__3GPP__Equipment__Status::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } AAA__3GPP__Equipment__Status_template::AAA__3GPP__Equipment__Status_template(const AAA__3GPP__Equipment__Status& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == AAA__3GPP__Equipment__Status::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Equipment_Status."); single_value = other_value.enum_value; } AAA__3GPP__Equipment__Status_template::AAA__3GPP__Equipment__Status_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__Equipment__Status::enum_type)(const AAA__3GPP__Equipment__Status&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.AAA_3GPP_Equipment_Status from an unbound optional field."); } } AAA__3GPP__Equipment__Status_template::AAA__3GPP__Equipment__Status_template(AAA__3GPP__Equipment__Status_template* p_precondition, AAA__3GPP__Equipment__Status_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } AAA__3GPP__Equipment__Status_template::AAA__3GPP__Equipment__Status_template(Dynamic_Match_Interface* p_dyn_match) : Base_Template(DYNAMIC_MATCH) { dyn_match = new dynmatch_struct; dyn_match->ptr = p_dyn_match; dyn_match->ref_count = 1; } AAA__3GPP__Equipment__Status_template::AAA__3GPP__Equipment__Status_template(const AAA__3GPP__Equipment__Status_template& other_value) : Base_Template() { copy_template(other_value); } AAA__3GPP__Equipment__Status_template::~AAA__3GPP__Equipment__Status_template() { clean_up(); } boolean AAA__3GPP__Equipment__Status_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean AAA__3GPP__Equipment__Status_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != AAA__3GPP__Equipment__Status::UNBOUND_VALUE; } void AAA__3GPP__Equipment__Status_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } AAA__3GPP__Equipment__Status_template& AAA__3GPP__Equipment__Status_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } AAA__3GPP__Equipment__Status_template& AAA__3GPP__Equipment__Status_template::operator=(int other_value) { if (!AAA__3GPP__Equipment__Status::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.AAA_3GPP_Equipment_Status.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__Equipment__Status::enum_type)other_value; return *this; } AAA__3GPP__Equipment__Status_template& AAA__3GPP__Equipment__Status_template::operator=(AAA__3GPP__Equipment__Status::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } AAA__3GPP__Equipment__Status_template& AAA__3GPP__Equipment__Status_template::operator=(const AAA__3GPP__Equipment__Status& other_value) { if (other_value.enum_value == AAA__3GPP__Equipment__Status::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Equipment_Status to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } AAA__3GPP__Equipment__Status_template& AAA__3GPP__Equipment__Status_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__Equipment__Status::enum_type)(const AAA__3GPP__Equipment__Status&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.AAA_3GPP_Equipment_Status."); } return *this; } AAA__3GPP__Equipment__Status_template& AAA__3GPP__Equipment__Status_template::operator=(const AAA__3GPP__Equipment__Status_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean AAA__3GPP__Equipment__Status_template::match(AAA__3GPP__Equipment__Status::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_Equipment_Status."); } return FALSE; } boolean AAA__3GPP__Equipment__Status_template::match(const AAA__3GPP__Equipment__Status& other_value, boolean) const { if (other_value.enum_value == AAA__3GPP__Equipment__Status::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.AAA_3GPP_Equipment_Status with an unbound value."); return match(other_value.enum_value); } AAA__3GPP__Equipment__Status::enum_type AAA__3GPP__Equipment__Status_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.AAA_3GPP_Equipment_Status."); return single_value; } void AAA__3GPP__Equipment__Status_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.AAA_3GPP_Equipment_Status."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new AAA__3GPP__Equipment__Status_template[list_length]; } AAA__3GPP__Equipment__Status_template& AAA__3GPP__Equipment__Status_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.AAA_3GPP_Equipment_Status."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.AAA_3GPP_Equipment_Status."); return value_list.list_value[list_index]; } void AAA__3GPP__Equipment__Status_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(AAA__3GPP__Equipment__Status::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void AAA__3GPP__Equipment__Status_template::log_match(const AAA__3GPP__Equipment__Status& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void AAA__3GPP__Equipment__Status_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_Equipment_Status."); } } void AAA__3GPP__Equipment__Status_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (AAA__3GPP__Equipment__Status::enum_type)text_buf.pull_int().get_val(); if (!AAA__3GPP__Equipment__Status::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.AAA_3GPP_Equipment_Status.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new AAA__3GPP__Equipment__Status_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.AAA_3GPP_Equipment_Status."); } } boolean AAA__3GPP__Equipment__Status_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean AAA__3GPP__Equipment__Status_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { AAA__3GPP__Equipment__Status_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { AAA__3GPP__Equipment__Status::enum_type enum_val = AAA__3GPP__Equipment__Status::str_to_enum(m_p->get_enumerated()); if (!AAA__3GPP__Equipment__Status::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.AAA_3GPP_Equipment_Status."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { AAA__3GPP__Equipment__Status_template* precondition = new AAA__3GPP__Equipment__Status_template; precondition->set_param(*m_p->get_elem(0)); AAA__3GPP__Equipment__Status_template* implied_template = new AAA__3GPP__Equipment__Status_template; implied_template->set_param(*m_p->get_elem(1)); *this = AAA__3GPP__Equipment__Status_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.AAA_3GPP_Equipment_Status"); } is_ifpresent = param.get_ifpresent(); } void AAA__3GPP__Equipment__Status_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.AAA_3GPP_Equipment_Status"); } DCA__3GPP__SGi__PtP__Tunnelling__Method::DCA__3GPP__SGi__PtP__Tunnelling__Method() { enum_value = UNBOUND_VALUE; } DCA__3GPP__SGi__PtP__Tunnelling__Method::DCA__3GPP__SGi__PtP__Tunnelling__Method(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.DCA_3GPP_SGi_PtP_Tunnelling_Method with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } DCA__3GPP__SGi__PtP__Tunnelling__Method::DCA__3GPP__SGi__PtP__Tunnelling__Method(enum_type other_value) { enum_value = other_value; } DCA__3GPP__SGi__PtP__Tunnelling__Method::DCA__3GPP__SGi__PtP__Tunnelling__Method(const DCA__3GPP__SGi__PtP__Tunnelling__Method& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_SGi_PtP_Tunnelling_Method."); enum_value = other_value.enum_value; } DCA__3GPP__SGi__PtP__Tunnelling__Method& DCA__3GPP__SGi__PtP__Tunnelling__Method::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_SGi_PtP_Tunnelling_Method.", other_value); enum_value = (enum_type)other_value; return *this; } DCA__3GPP__SGi__PtP__Tunnelling__Method& DCA__3GPP__SGi__PtP__Tunnelling__Method::operator=(enum_type other_value) { enum_value = other_value; return *this; } DCA__3GPP__SGi__PtP__Tunnelling__Method& DCA__3GPP__SGi__PtP__Tunnelling__Method::operator=(const DCA__3GPP__SGi__PtP__Tunnelling__Method& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_SGi_PtP_Tunnelling_Method."); enum_value = other_value.enum_value; return *this; } boolean DCA__3GPP__SGi__PtP__Tunnelling__Method::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_SGi_PtP_Tunnelling_Method."); return enum_value == other_value; } boolean DCA__3GPP__SGi__PtP__Tunnelling__Method::operator==(const DCA__3GPP__SGi__PtP__Tunnelling__Method& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_SGi_PtP_Tunnelling_Method."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_SGi_PtP_Tunnelling_Method."); return enum_value == other_value.enum_value; } boolean DCA__3GPP__SGi__PtP__Tunnelling__Method::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_SGi_PtP_Tunnelling_Method."); return enum_value < other_value; } boolean DCA__3GPP__SGi__PtP__Tunnelling__Method::operator<(const DCA__3GPP__SGi__PtP__Tunnelling__Method& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_SGi_PtP_Tunnelling_Method."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_SGi_PtP_Tunnelling_Method."); return enum_value < other_value.enum_value; } boolean DCA__3GPP__SGi__PtP__Tunnelling__Method::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_SGi_PtP_Tunnelling_Method."); return enum_value > other_value; } boolean DCA__3GPP__SGi__PtP__Tunnelling__Method::operator>(const DCA__3GPP__SGi__PtP__Tunnelling__Method& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_SGi_PtP_Tunnelling_Method."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_SGi_PtP_Tunnelling_Method."); return enum_value > other_value.enum_value; } const char *DCA__3GPP__SGi__PtP__Tunnelling__Method::enum_to_str(enum_type enum_par) { switch (enum_par) { case UDP__IP__BASED: return "UDP_IP_BASED"; case Others: return "Others"; default: return ""; } } DCA__3GPP__SGi__PtP__Tunnelling__Method::enum_type DCA__3GPP__SGi__PtP__Tunnelling__Method::str_to_enum(const char *str_par) { if (!strcmp(str_par, "UDP_IP_BASED")) return UDP__IP__BASED; else if (!strcmp(str_par, "Others")) return Others; else return UNKNOWN_VALUE; } boolean DCA__3GPP__SGi__PtP__Tunnelling__Method::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: return TRUE; default: return FALSE; } } int DCA__3GPP__SGi__PtP__Tunnelling__Method::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_SGi_PtP_Tunnelling_Method.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int DCA__3GPP__SGi__PtP__Tunnelling__Method::enum2int(const DCA__3GPP__SGi__PtP__Tunnelling__Method& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_SGi_PtP_Tunnelling_Method.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void DCA__3GPP__SGi__PtP__Tunnelling__Method::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_SGi_PtP_Tunnelling_Method.", int_val); enum_value = (enum_type)int_val; } DCA__3GPP__SGi__PtP__Tunnelling__Method::operator DCA__3GPP__SGi__PtP__Tunnelling__Method::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.DCA_3GPP_SGi_PtP_Tunnelling_Method."); return enum_value; } void DCA__3GPP__SGi__PtP__Tunnelling__Method::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void DCA__3GPP__SGi__PtP__Tunnelling__Method::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.DCA_3GPP_SGi_PtP_Tunnelling_Method"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_SGi_PtP_Tunnelling_Method."); } } void DCA__3GPP__SGi__PtP__Tunnelling__Method::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_SGi_PtP_Tunnelling_Method."); text_buf.push_int(enum_value); } void DCA__3GPP__SGi__PtP__Tunnelling__Method::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.DCA_3GPP_SGi_PtP_Tunnelling_Method.", enum_value); } void DCA__3GPP__SGi__PtP__Tunnelling__Method::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void DCA__3GPP__SGi__PtP__Tunnelling__Method::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int DCA__3GPP__SGi__PtP__Tunnelling__Method::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int DCA__3GPP__SGi__PtP__Tunnelling__Method::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void DCA__3GPP__SGi__PtP__Tunnelling__Method_template::copy_template(const DCA__3GPP__SGi__PtP__Tunnelling__Method_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new DCA__3GPP__SGi__PtP__Tunnelling__Method_template[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 DCA__3GPP__SGi__PtP__Tunnelling__Method_template(*other_value.implication_.precondition); implication_.implied_template = new DCA__3GPP__SGi__PtP__Tunnelling__Method_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_SGi_PtP_Tunnelling_Method."); } } DCA__3GPP__SGi__PtP__Tunnelling__Method_template::DCA__3GPP__SGi__PtP__Tunnelling__Method_template() { } DCA__3GPP__SGi__PtP__Tunnelling__Method_template::DCA__3GPP__SGi__PtP__Tunnelling__Method_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } DCA__3GPP__SGi__PtP__Tunnelling__Method_template::DCA__3GPP__SGi__PtP__Tunnelling__Method_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!DCA__3GPP__SGi__PtP__Tunnelling__Method::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.DCA_3GPP_SGi_PtP_Tunnelling_Method with unknown numeric value %d.", other_value); single_value = (DCA__3GPP__SGi__PtP__Tunnelling__Method::enum_type)other_value; } DCA__3GPP__SGi__PtP__Tunnelling__Method_template::DCA__3GPP__SGi__PtP__Tunnelling__Method_template(DCA__3GPP__SGi__PtP__Tunnelling__Method::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } DCA__3GPP__SGi__PtP__Tunnelling__Method_template::DCA__3GPP__SGi__PtP__Tunnelling__Method_template(const DCA__3GPP__SGi__PtP__Tunnelling__Method& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == DCA__3GPP__SGi__PtP__Tunnelling__Method::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_SGi_PtP_Tunnelling_Method."); single_value = other_value.enum_value; } DCA__3GPP__SGi__PtP__Tunnelling__Method_template::DCA__3GPP__SGi__PtP__Tunnelling__Method_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__SGi__PtP__Tunnelling__Method::enum_type)(const DCA__3GPP__SGi__PtP__Tunnelling__Method&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.DCA_3GPP_SGi_PtP_Tunnelling_Method from an unbound optional field."); } } DCA__3GPP__SGi__PtP__Tunnelling__Method_template::DCA__3GPP__SGi__PtP__Tunnelling__Method_template(DCA__3GPP__SGi__PtP__Tunnelling__Method_template* p_precondition, DCA__3GPP__SGi__PtP__Tunnelling__Method_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } DCA__3GPP__SGi__PtP__Tunnelling__Method_template::DCA__3GPP__SGi__PtP__Tunnelling__Method_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; } DCA__3GPP__SGi__PtP__Tunnelling__Method_template::DCA__3GPP__SGi__PtP__Tunnelling__Method_template(const DCA__3GPP__SGi__PtP__Tunnelling__Method_template& other_value) : Base_Template() { copy_template(other_value); } DCA__3GPP__SGi__PtP__Tunnelling__Method_template::~DCA__3GPP__SGi__PtP__Tunnelling__Method_template() { clean_up(); } boolean DCA__3GPP__SGi__PtP__Tunnelling__Method_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean DCA__3GPP__SGi__PtP__Tunnelling__Method_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != DCA__3GPP__SGi__PtP__Tunnelling__Method::UNBOUND_VALUE; } void DCA__3GPP__SGi__PtP__Tunnelling__Method_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } DCA__3GPP__SGi__PtP__Tunnelling__Method_template& DCA__3GPP__SGi__PtP__Tunnelling__Method_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } DCA__3GPP__SGi__PtP__Tunnelling__Method_template& DCA__3GPP__SGi__PtP__Tunnelling__Method_template::operator=(int other_value) { if (!DCA__3GPP__SGi__PtP__Tunnelling__Method::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.DCA_3GPP_SGi_PtP_Tunnelling_Method.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__SGi__PtP__Tunnelling__Method::enum_type)other_value; return *this; } DCA__3GPP__SGi__PtP__Tunnelling__Method_template& DCA__3GPP__SGi__PtP__Tunnelling__Method_template::operator=(DCA__3GPP__SGi__PtP__Tunnelling__Method::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } DCA__3GPP__SGi__PtP__Tunnelling__Method_template& DCA__3GPP__SGi__PtP__Tunnelling__Method_template::operator=(const DCA__3GPP__SGi__PtP__Tunnelling__Method& other_value) { if (other_value.enum_value == DCA__3GPP__SGi__PtP__Tunnelling__Method::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_SGi_PtP_Tunnelling_Method to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } DCA__3GPP__SGi__PtP__Tunnelling__Method_template& DCA__3GPP__SGi__PtP__Tunnelling__Method_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__SGi__PtP__Tunnelling__Method::enum_type)(const DCA__3GPP__SGi__PtP__Tunnelling__Method&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.DCA_3GPP_SGi_PtP_Tunnelling_Method."); } return *this; } DCA__3GPP__SGi__PtP__Tunnelling__Method_template& DCA__3GPP__SGi__PtP__Tunnelling__Method_template::operator=(const DCA__3GPP__SGi__PtP__Tunnelling__Method_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean DCA__3GPP__SGi__PtP__Tunnelling__Method_template::match(DCA__3GPP__SGi__PtP__Tunnelling__Method::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_SGi_PtP_Tunnelling_Method."); } return FALSE; } boolean DCA__3GPP__SGi__PtP__Tunnelling__Method_template::match(const DCA__3GPP__SGi__PtP__Tunnelling__Method& other_value, boolean) const { if (other_value.enum_value == DCA__3GPP__SGi__PtP__Tunnelling__Method::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.DCA_3GPP_SGi_PtP_Tunnelling_Method with an unbound value."); return match(other_value.enum_value); } DCA__3GPP__SGi__PtP__Tunnelling__Method::enum_type DCA__3GPP__SGi__PtP__Tunnelling__Method_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.DCA_3GPP_SGi_PtP_Tunnelling_Method."); return single_value; } void DCA__3GPP__SGi__PtP__Tunnelling__Method_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.DCA_3GPP_SGi_PtP_Tunnelling_Method."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new DCA__3GPP__SGi__PtP__Tunnelling__Method_template[list_length]; } DCA__3GPP__SGi__PtP__Tunnelling__Method_template& DCA__3GPP__SGi__PtP__Tunnelling__Method_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.DCA_3GPP_SGi_PtP_Tunnelling_Method."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.DCA_3GPP_SGi_PtP_Tunnelling_Method."); return value_list.list_value[list_index]; } void DCA__3GPP__SGi__PtP__Tunnelling__Method_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(DCA__3GPP__SGi__PtP__Tunnelling__Method::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void DCA__3GPP__SGi__PtP__Tunnelling__Method_template::log_match(const DCA__3GPP__SGi__PtP__Tunnelling__Method& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void DCA__3GPP__SGi__PtP__Tunnelling__Method_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_SGi_PtP_Tunnelling_Method."); } } void DCA__3GPP__SGi__PtP__Tunnelling__Method_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (DCA__3GPP__SGi__PtP__Tunnelling__Method::enum_type)text_buf.pull_int().get_val(); if (!DCA__3GPP__SGi__PtP__Tunnelling__Method::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_SGi_PtP_Tunnelling_Method.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new DCA__3GPP__SGi__PtP__Tunnelling__Method_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_SGi_PtP_Tunnelling_Method."); } } boolean DCA__3GPP__SGi__PtP__Tunnelling__Method_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean DCA__3GPP__SGi__PtP__Tunnelling__Method_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { DCA__3GPP__SGi__PtP__Tunnelling__Method_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { DCA__3GPP__SGi__PtP__Tunnelling__Method::enum_type enum_val = DCA__3GPP__SGi__PtP__Tunnelling__Method::str_to_enum(m_p->get_enumerated()); if (!DCA__3GPP__SGi__PtP__Tunnelling__Method::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_SGi_PtP_Tunnelling_Method."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { DCA__3GPP__SGi__PtP__Tunnelling__Method_template* precondition = new DCA__3GPP__SGi__PtP__Tunnelling__Method_template; precondition->set_param(*m_p->get_elem(0)); DCA__3GPP__SGi__PtP__Tunnelling__Method_template* implied_template = new DCA__3GPP__SGi__PtP__Tunnelling__Method_template; implied_template->set_param(*m_p->get_elem(1)); *this = DCA__3GPP__SGi__PtP__Tunnelling__Method_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.DCA_3GPP_SGi_PtP_Tunnelling_Method"); } is_ifpresent = param.get_ifpresent(); } void DCA__3GPP__SGi__PtP__Tunnelling__Method_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.DCA_3GPP_SGi_PtP_Tunnelling_Method"); } DCA__3GPP__NNI__Type::DCA__3GPP__NNI__Type() { enum_value = UNBOUND_VALUE; } DCA__3GPP__NNI__Type::DCA__3GPP__NNI__Type(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.DCA_3GPP_NNI_Type with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } DCA__3GPP__NNI__Type::DCA__3GPP__NNI__Type(enum_type other_value) { enum_value = other_value; } DCA__3GPP__NNI__Type::DCA__3GPP__NNI__Type(const DCA__3GPP__NNI__Type& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_NNI_Type."); enum_value = other_value.enum_value; } DCA__3GPP__NNI__Type& DCA__3GPP__NNI__Type::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_NNI_Type.", other_value); enum_value = (enum_type)other_value; return *this; } DCA__3GPP__NNI__Type& DCA__3GPP__NNI__Type::operator=(enum_type other_value) { enum_value = other_value; return *this; } DCA__3GPP__NNI__Type& DCA__3GPP__NNI__Type::operator=(const DCA__3GPP__NNI__Type& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_NNI_Type."); enum_value = other_value.enum_value; return *this; } boolean DCA__3GPP__NNI__Type::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_NNI_Type."); return enum_value == other_value; } boolean DCA__3GPP__NNI__Type::operator==(const DCA__3GPP__NNI__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_NNI_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_NNI_Type."); return enum_value == other_value.enum_value; } boolean DCA__3GPP__NNI__Type::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_NNI_Type."); return enum_value < other_value; } boolean DCA__3GPP__NNI__Type::operator<(const DCA__3GPP__NNI__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_NNI_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_NNI_Type."); return enum_value < other_value.enum_value; } boolean DCA__3GPP__NNI__Type::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_NNI_Type."); return enum_value > other_value; } boolean DCA__3GPP__NNI__Type::operator>(const DCA__3GPP__NNI__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_NNI_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_NNI_Type."); return enum_value > other_value.enum_value; } const char *DCA__3GPP__NNI__Type::enum_to_str(enum_type enum_par) { switch (enum_par) { case Non__Roaming: return "Non_Roaming"; case Roaming__Without__Loopback: return "Roaming_Without_Loopback"; case Roaming__With__Loopback: return "Roaming_With_Loopback"; default: return ""; } } DCA__3GPP__NNI__Type::enum_type DCA__3GPP__NNI__Type::str_to_enum(const char *str_par) { if (!strcmp(str_par, "Non_Roaming")) return Non__Roaming; else if (!strcmp(str_par, "Roaming_Without_Loopback")) return Roaming__Without__Loopback; else if (!strcmp(str_par, "Roaming_With_Loopback")) return Roaming__With__Loopback; else return UNKNOWN_VALUE; } boolean DCA__3GPP__NNI__Type::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: case 2: return TRUE; default: return FALSE; } } int DCA__3GPP__NNI__Type::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_NNI_Type.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int DCA__3GPP__NNI__Type::enum2int(const DCA__3GPP__NNI__Type& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_NNI_Type.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void DCA__3GPP__NNI__Type::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_NNI_Type.", int_val); enum_value = (enum_type)int_val; } DCA__3GPP__NNI__Type::operator DCA__3GPP__NNI__Type::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.DCA_3GPP_NNI_Type."); return enum_value; } void DCA__3GPP__NNI__Type::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void DCA__3GPP__NNI__Type::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.DCA_3GPP_NNI_Type"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_NNI_Type."); } } void DCA__3GPP__NNI__Type::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_NNI_Type."); text_buf.push_int(enum_value); } void DCA__3GPP__NNI__Type::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.DCA_3GPP_NNI_Type.", enum_value); } void DCA__3GPP__NNI__Type::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void DCA__3GPP__NNI__Type::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int DCA__3GPP__NNI__Type::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int DCA__3GPP__NNI__Type::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void DCA__3GPP__NNI__Type_template::copy_template(const DCA__3GPP__NNI__Type_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new DCA__3GPP__NNI__Type_template[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 DCA__3GPP__NNI__Type_template(*other_value.implication_.precondition); implication_.implied_template = new DCA__3GPP__NNI__Type_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_NNI_Type."); } } DCA__3GPP__NNI__Type_template::DCA__3GPP__NNI__Type_template() { } DCA__3GPP__NNI__Type_template::DCA__3GPP__NNI__Type_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } DCA__3GPP__NNI__Type_template::DCA__3GPP__NNI__Type_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!DCA__3GPP__NNI__Type::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.DCA_3GPP_NNI_Type with unknown numeric value %d.", other_value); single_value = (DCA__3GPP__NNI__Type::enum_type)other_value; } DCA__3GPP__NNI__Type_template::DCA__3GPP__NNI__Type_template(DCA__3GPP__NNI__Type::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } DCA__3GPP__NNI__Type_template::DCA__3GPP__NNI__Type_template(const DCA__3GPP__NNI__Type& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == DCA__3GPP__NNI__Type::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_NNI_Type."); single_value = other_value.enum_value; } DCA__3GPP__NNI__Type_template::DCA__3GPP__NNI__Type_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__NNI__Type::enum_type)(const DCA__3GPP__NNI__Type&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.DCA_3GPP_NNI_Type from an unbound optional field."); } } DCA__3GPP__NNI__Type_template::DCA__3GPP__NNI__Type_template(DCA__3GPP__NNI__Type_template* p_precondition, DCA__3GPP__NNI__Type_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } DCA__3GPP__NNI__Type_template::DCA__3GPP__NNI__Type_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; } DCA__3GPP__NNI__Type_template::DCA__3GPP__NNI__Type_template(const DCA__3GPP__NNI__Type_template& other_value) : Base_Template() { copy_template(other_value); } DCA__3GPP__NNI__Type_template::~DCA__3GPP__NNI__Type_template() { clean_up(); } boolean DCA__3GPP__NNI__Type_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean DCA__3GPP__NNI__Type_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != DCA__3GPP__NNI__Type::UNBOUND_VALUE; } void DCA__3GPP__NNI__Type_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } DCA__3GPP__NNI__Type_template& DCA__3GPP__NNI__Type_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } DCA__3GPP__NNI__Type_template& DCA__3GPP__NNI__Type_template::operator=(int other_value) { if (!DCA__3GPP__NNI__Type::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.DCA_3GPP_NNI_Type.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__NNI__Type::enum_type)other_value; return *this; } DCA__3GPP__NNI__Type_template& DCA__3GPP__NNI__Type_template::operator=(DCA__3GPP__NNI__Type::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } DCA__3GPP__NNI__Type_template& DCA__3GPP__NNI__Type_template::operator=(const DCA__3GPP__NNI__Type& other_value) { if (other_value.enum_value == DCA__3GPP__NNI__Type::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_NNI_Type to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } DCA__3GPP__NNI__Type_template& DCA__3GPP__NNI__Type_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__NNI__Type::enum_type)(const DCA__3GPP__NNI__Type&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.DCA_3GPP_NNI_Type."); } return *this; } DCA__3GPP__NNI__Type_template& DCA__3GPP__NNI__Type_template::operator=(const DCA__3GPP__NNI__Type_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean DCA__3GPP__NNI__Type_template::match(DCA__3GPP__NNI__Type::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_NNI_Type."); } return FALSE; } boolean DCA__3GPP__NNI__Type_template::match(const DCA__3GPP__NNI__Type& other_value, boolean) const { if (other_value.enum_value == DCA__3GPP__NNI__Type::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.DCA_3GPP_NNI_Type with an unbound value."); return match(other_value.enum_value); } DCA__3GPP__NNI__Type::enum_type DCA__3GPP__NNI__Type_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.DCA_3GPP_NNI_Type."); return single_value; } void DCA__3GPP__NNI__Type_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.DCA_3GPP_NNI_Type."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new DCA__3GPP__NNI__Type_template[list_length]; } DCA__3GPP__NNI__Type_template& DCA__3GPP__NNI__Type_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.DCA_3GPP_NNI_Type."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.DCA_3GPP_NNI_Type."); return value_list.list_value[list_index]; } void DCA__3GPP__NNI__Type_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(DCA__3GPP__NNI__Type::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void DCA__3GPP__NNI__Type_template::log_match(const DCA__3GPP__NNI__Type& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void DCA__3GPP__NNI__Type_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_NNI_Type."); } } void DCA__3GPP__NNI__Type_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (DCA__3GPP__NNI__Type::enum_type)text_buf.pull_int().get_val(); if (!DCA__3GPP__NNI__Type::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_NNI_Type.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new DCA__3GPP__NNI__Type_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_NNI_Type."); } } boolean DCA__3GPP__NNI__Type_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean DCA__3GPP__NNI__Type_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { DCA__3GPP__NNI__Type_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { DCA__3GPP__NNI__Type::enum_type enum_val = DCA__3GPP__NNI__Type::str_to_enum(m_p->get_enumerated()); if (!DCA__3GPP__NNI__Type::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_NNI_Type."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { DCA__3GPP__NNI__Type_template* precondition = new DCA__3GPP__NNI__Type_template; precondition->set_param(*m_p->get_elem(0)); DCA__3GPP__NNI__Type_template* implied_template = new DCA__3GPP__NNI__Type_template; implied_template->set_param(*m_p->get_elem(1)); *this = DCA__3GPP__NNI__Type_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.DCA_3GPP_NNI_Type"); } is_ifpresent = param.get_ifpresent(); } void DCA__3GPP__NNI__Type_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.DCA_3GPP_NNI_Type"); } RX__3GPP__Service__Info__Status::RX__3GPP__Service__Info__Status() { enum_value = UNBOUND_VALUE; } RX__3GPP__Service__Info__Status::RX__3GPP__Service__Info__Status(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.RX_3GPP_Service_Info_Status with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } RX__3GPP__Service__Info__Status::RX__3GPP__Service__Info__Status(enum_type other_value) { enum_value = other_value; } RX__3GPP__Service__Info__Status::RX__3GPP__Service__Info__Status(const RX__3GPP__Service__Info__Status& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Service_Info_Status."); enum_value = other_value.enum_value; } RX__3GPP__Service__Info__Status& RX__3GPP__Service__Info__Status::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.RX_3GPP_Service_Info_Status.", other_value); enum_value = (enum_type)other_value; return *this; } RX__3GPP__Service__Info__Status& RX__3GPP__Service__Info__Status::operator=(enum_type other_value) { enum_value = other_value; return *this; } RX__3GPP__Service__Info__Status& RX__3GPP__Service__Info__Status::operator=(const RX__3GPP__Service__Info__Status& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Service_Info_Status."); enum_value = other_value.enum_value; return *this; } boolean RX__3GPP__Service__Info__Status::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Service_Info_Status."); return enum_value == other_value; } boolean RX__3GPP__Service__Info__Status::operator==(const RX__3GPP__Service__Info__Status& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Service_Info_Status."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Service_Info_Status."); return enum_value == other_value.enum_value; } boolean RX__3GPP__Service__Info__Status::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Service_Info_Status."); return enum_value < other_value; } boolean RX__3GPP__Service__Info__Status::operator<(const RX__3GPP__Service__Info__Status& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Service_Info_Status."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Service_Info_Status."); return enum_value < other_value.enum_value; } boolean RX__3GPP__Service__Info__Status::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Service_Info_Status."); return enum_value > other_value; } boolean RX__3GPP__Service__Info__Status::operator>(const RX__3GPP__Service__Info__Status& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Service_Info_Status."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Service_Info_Status."); return enum_value > other_value.enum_value; } const char *RX__3GPP__Service__Info__Status::enum_to_str(enum_type enum_par) { switch (enum_par) { case FINAL__SERVICE__INFORMATION: return "FINAL_SERVICE_INFORMATION"; case PRELIMINARY__SERVICE__INFORMATION: return "PRELIMINARY_SERVICE_INFORMATION"; default: return ""; } } RX__3GPP__Service__Info__Status::enum_type RX__3GPP__Service__Info__Status::str_to_enum(const char *str_par) { if (!strcmp(str_par, "FINAL_SERVICE_INFORMATION")) return FINAL__SERVICE__INFORMATION; else if (!strcmp(str_par, "PRELIMINARY_SERVICE_INFORMATION")) return PRELIMINARY__SERVICE__INFORMATION; else return UNKNOWN_VALUE; } boolean RX__3GPP__Service__Info__Status::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: return TRUE; default: return FALSE; } } int RX__3GPP__Service__Info__Status::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.RX_3GPP_Service_Info_Status.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int RX__3GPP__Service__Info__Status::enum2int(const RX__3GPP__Service__Info__Status& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.RX_3GPP_Service_Info_Status.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void RX__3GPP__Service__Info__Status::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.RX_3GPP_Service_Info_Status.", int_val); enum_value = (enum_type)int_val; } RX__3GPP__Service__Info__Status::operator RX__3GPP__Service__Info__Status::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.RX_3GPP_Service_Info_Status."); return enum_value; } void RX__3GPP__Service__Info__Status::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void RX__3GPP__Service__Info__Status::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.RX_3GPP_Service_Info_Status"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.RX_3GPP_Service_Info_Status."); } } void RX__3GPP__Service__Info__Status::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Service_Info_Status."); text_buf.push_int(enum_value); } void RX__3GPP__Service__Info__Status::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.RX_3GPP_Service_Info_Status.", enum_value); } void RX__3GPP__Service__Info__Status::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void RX__3GPP__Service__Info__Status::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int RX__3GPP__Service__Info__Status::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int RX__3GPP__Service__Info__Status::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void RX__3GPP__Service__Info__Status_template::copy_template(const RX__3GPP__Service__Info__Status_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new RX__3GPP__Service__Info__Status_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].copy_template(other_value.value_list.list_value[list_count]); break; case IMPLICATION_MATCH: implication_.precondition = new RX__3GPP__Service__Info__Status_template(*other_value.implication_.precondition); implication_.implied_template = new RX__3GPP__Service__Info__Status_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.RX_3GPP_Service_Info_Status."); } } RX__3GPP__Service__Info__Status_template::RX__3GPP__Service__Info__Status_template() { } RX__3GPP__Service__Info__Status_template::RX__3GPP__Service__Info__Status_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } RX__3GPP__Service__Info__Status_template::RX__3GPP__Service__Info__Status_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!RX__3GPP__Service__Info__Status::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.RX_3GPP_Service_Info_Status with unknown numeric value %d.", other_value); single_value = (RX__3GPP__Service__Info__Status::enum_type)other_value; } RX__3GPP__Service__Info__Status_template::RX__3GPP__Service__Info__Status_template(RX__3GPP__Service__Info__Status::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } RX__3GPP__Service__Info__Status_template::RX__3GPP__Service__Info__Status_template(const RX__3GPP__Service__Info__Status& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == RX__3GPP__Service__Info__Status::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Service_Info_Status."); single_value = other_value.enum_value; } RX__3GPP__Service__Info__Status_template::RX__3GPP__Service__Info__Status_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (RX__3GPP__Service__Info__Status::enum_type)(const RX__3GPP__Service__Info__Status&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.RX_3GPP_Service_Info_Status from an unbound optional field."); } } RX__3GPP__Service__Info__Status_template::RX__3GPP__Service__Info__Status_template(RX__3GPP__Service__Info__Status_template* p_precondition, RX__3GPP__Service__Info__Status_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } RX__3GPP__Service__Info__Status_template::RX__3GPP__Service__Info__Status_template(Dynamic_Match_Interface* p_dyn_match) : Base_Template(DYNAMIC_MATCH) { dyn_match = new dynmatch_struct; dyn_match->ptr = p_dyn_match; dyn_match->ref_count = 1; } RX__3GPP__Service__Info__Status_template::RX__3GPP__Service__Info__Status_template(const RX__3GPP__Service__Info__Status_template& other_value) : Base_Template() { copy_template(other_value); } RX__3GPP__Service__Info__Status_template::~RX__3GPP__Service__Info__Status_template() { clean_up(); } boolean RX__3GPP__Service__Info__Status_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean RX__3GPP__Service__Info__Status_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != RX__3GPP__Service__Info__Status::UNBOUND_VALUE; } void RX__3GPP__Service__Info__Status_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } RX__3GPP__Service__Info__Status_template& RX__3GPP__Service__Info__Status_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } RX__3GPP__Service__Info__Status_template& RX__3GPP__Service__Info__Status_template::operator=(int other_value) { if (!RX__3GPP__Service__Info__Status::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.RX_3GPP_Service_Info_Status.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (RX__3GPP__Service__Info__Status::enum_type)other_value; return *this; } RX__3GPP__Service__Info__Status_template& RX__3GPP__Service__Info__Status_template::operator=(RX__3GPP__Service__Info__Status::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } RX__3GPP__Service__Info__Status_template& RX__3GPP__Service__Info__Status_template::operator=(const RX__3GPP__Service__Info__Status& other_value) { if (other_value.enum_value == RX__3GPP__Service__Info__Status::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Service_Info_Status to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } RX__3GPP__Service__Info__Status_template& RX__3GPP__Service__Info__Status_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (RX__3GPP__Service__Info__Status::enum_type)(const RX__3GPP__Service__Info__Status&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.RX_3GPP_Service_Info_Status."); } return *this; } RX__3GPP__Service__Info__Status_template& RX__3GPP__Service__Info__Status_template::operator=(const RX__3GPP__Service__Info__Status_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean RX__3GPP__Service__Info__Status_template::match(RX__3GPP__Service__Info__Status::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.RX_3GPP_Service_Info_Status."); } return FALSE; } boolean RX__3GPP__Service__Info__Status_template::match(const RX__3GPP__Service__Info__Status& other_value, boolean) const { if (other_value.enum_value == RX__3GPP__Service__Info__Status::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.RX_3GPP_Service_Info_Status with an unbound value."); return match(other_value.enum_value); } RX__3GPP__Service__Info__Status::enum_type RX__3GPP__Service__Info__Status_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.RX_3GPP_Service_Info_Status."); return single_value; } void RX__3GPP__Service__Info__Status_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.RX_3GPP_Service_Info_Status."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new RX__3GPP__Service__Info__Status_template[list_length]; } RX__3GPP__Service__Info__Status_template& RX__3GPP__Service__Info__Status_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.RX_3GPP_Service_Info_Status."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.RX_3GPP_Service_Info_Status."); return value_list.list_value[list_index]; } void RX__3GPP__Service__Info__Status_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(RX__3GPP__Service__Info__Status::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void RX__3GPP__Service__Info__Status_template::log_match(const RX__3GPP__Service__Info__Status& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void RX__3GPP__Service__Info__Status_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.RX_3GPP_Service_Info_Status."); } } void RX__3GPP__Service__Info__Status_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (RX__3GPP__Service__Info__Status::enum_type)text_buf.pull_int().get_val(); if (!RX__3GPP__Service__Info__Status::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.RX_3GPP_Service_Info_Status.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new RX__3GPP__Service__Info__Status_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.RX_3GPP_Service_Info_Status."); } } boolean RX__3GPP__Service__Info__Status_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean RX__3GPP__Service__Info__Status_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { RX__3GPP__Service__Info__Status_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { RX__3GPP__Service__Info__Status::enum_type enum_val = RX__3GPP__Service__Info__Status::str_to_enum(m_p->get_enumerated()); if (!RX__3GPP__Service__Info__Status::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.RX_3GPP_Service_Info_Status."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { RX__3GPP__Service__Info__Status_template* precondition = new RX__3GPP__Service__Info__Status_template; precondition->set_param(*m_p->get_elem(0)); RX__3GPP__Service__Info__Status_template* implied_template = new RX__3GPP__Service__Info__Status_template; implied_template->set_param(*m_p->get_elem(1)); *this = RX__3GPP__Service__Info__Status_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.RX_3GPP_Service_Info_Status"); } is_ifpresent = param.get_ifpresent(); } void RX__3GPP__Service__Info__Status_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.RX_3GPP_Service_Info_Status"); } DCA__3GPP__User__Participating__Type::DCA__3GPP__User__Participating__Type() { enum_value = UNBOUND_VALUE; } DCA__3GPP__User__Participating__Type::DCA__3GPP__User__Participating__Type(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.DCA_3GPP_User_Participating_Type with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } DCA__3GPP__User__Participating__Type::DCA__3GPP__User__Participating__Type(enum_type other_value) { enum_value = other_value; } DCA__3GPP__User__Participating__Type::DCA__3GPP__User__Participating__Type(const DCA__3GPP__User__Participating__Type& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_User_Participating_Type."); enum_value = other_value.enum_value; } DCA__3GPP__User__Participating__Type& DCA__3GPP__User__Participating__Type::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_User_Participating_Type.", other_value); enum_value = (enum_type)other_value; return *this; } DCA__3GPP__User__Participating__Type& DCA__3GPP__User__Participating__Type::operator=(enum_type other_value) { enum_value = other_value; return *this; } DCA__3GPP__User__Participating__Type& DCA__3GPP__User__Participating__Type::operator=(const DCA__3GPP__User__Participating__Type& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_User_Participating_Type."); enum_value = other_value.enum_value; return *this; } boolean DCA__3GPP__User__Participating__Type::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_User_Participating_Type."); return enum_value == other_value; } boolean DCA__3GPP__User__Participating__Type::operator==(const DCA__3GPP__User__Participating__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_User_Participating_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_User_Participating_Type."); return enum_value == other_value.enum_value; } boolean DCA__3GPP__User__Participating__Type::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_User_Participating_Type."); return enum_value < other_value; } boolean DCA__3GPP__User__Participating__Type::operator<(const DCA__3GPP__User__Participating__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_User_Participating_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_User_Participating_Type."); return enum_value < other_value.enum_value; } boolean DCA__3GPP__User__Participating__Type::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_User_Participating_Type."); return enum_value > other_value; } boolean DCA__3GPP__User__Participating__Type::operator>(const DCA__3GPP__User__Participating__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_User_Participating_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_User_Participating_Type."); return enum_value > other_value.enum_value; } const char *DCA__3GPP__User__Participating__Type::enum_to_str(enum_type enum_par) { switch (enum_par) { case NORMAL: return "NORMAL"; case NW__POC__BOX: return "NW_POC_BOX"; case UE__POC__BOX: return "UE_POC_BOX"; default: return ""; } } DCA__3GPP__User__Participating__Type::enum_type DCA__3GPP__User__Participating__Type::str_to_enum(const char *str_par) { if (!strcmp(str_par, "NORMAL")) return NORMAL; else if (!strcmp(str_par, "NW_POC_BOX")) return NW__POC__BOX; else if (!strcmp(str_par, "UE_POC_BOX")) return UE__POC__BOX; else return UNKNOWN_VALUE; } boolean DCA__3GPP__User__Participating__Type::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: case 2: return TRUE; default: return FALSE; } } int DCA__3GPP__User__Participating__Type::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_User_Participating_Type.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int DCA__3GPP__User__Participating__Type::enum2int(const DCA__3GPP__User__Participating__Type& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_User_Participating_Type.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void DCA__3GPP__User__Participating__Type::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_User_Participating_Type.", int_val); enum_value = (enum_type)int_val; } DCA__3GPP__User__Participating__Type::operator DCA__3GPP__User__Participating__Type::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.DCA_3GPP_User_Participating_Type."); return enum_value; } void DCA__3GPP__User__Participating__Type::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void DCA__3GPP__User__Participating__Type::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.DCA_3GPP_User_Participating_Type"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_User_Participating_Type."); } } void DCA__3GPP__User__Participating__Type::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_User_Participating_Type."); text_buf.push_int(enum_value); } void DCA__3GPP__User__Participating__Type::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.DCA_3GPP_User_Participating_Type.", enum_value); } void DCA__3GPP__User__Participating__Type::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void DCA__3GPP__User__Participating__Type::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int DCA__3GPP__User__Participating__Type::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int DCA__3GPP__User__Participating__Type::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void DCA__3GPP__User__Participating__Type_template::copy_template(const DCA__3GPP__User__Participating__Type_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new DCA__3GPP__User__Participating__Type_template[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 DCA__3GPP__User__Participating__Type_template(*other_value.implication_.precondition); implication_.implied_template = new DCA__3GPP__User__Participating__Type_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_User_Participating_Type."); } } DCA__3GPP__User__Participating__Type_template::DCA__3GPP__User__Participating__Type_template() { } DCA__3GPP__User__Participating__Type_template::DCA__3GPP__User__Participating__Type_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } DCA__3GPP__User__Participating__Type_template::DCA__3GPP__User__Participating__Type_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!DCA__3GPP__User__Participating__Type::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.DCA_3GPP_User_Participating_Type with unknown numeric value %d.", other_value); single_value = (DCA__3GPP__User__Participating__Type::enum_type)other_value; } DCA__3GPP__User__Participating__Type_template::DCA__3GPP__User__Participating__Type_template(DCA__3GPP__User__Participating__Type::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } DCA__3GPP__User__Participating__Type_template::DCA__3GPP__User__Participating__Type_template(const DCA__3GPP__User__Participating__Type& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == DCA__3GPP__User__Participating__Type::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_User_Participating_Type."); single_value = other_value.enum_value; } DCA__3GPP__User__Participating__Type_template::DCA__3GPP__User__Participating__Type_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__User__Participating__Type::enum_type)(const DCA__3GPP__User__Participating__Type&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.DCA_3GPP_User_Participating_Type from an unbound optional field."); } } DCA__3GPP__User__Participating__Type_template::DCA__3GPP__User__Participating__Type_template(DCA__3GPP__User__Participating__Type_template* p_precondition, DCA__3GPP__User__Participating__Type_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } DCA__3GPP__User__Participating__Type_template::DCA__3GPP__User__Participating__Type_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; } DCA__3GPP__User__Participating__Type_template::DCA__3GPP__User__Participating__Type_template(const DCA__3GPP__User__Participating__Type_template& other_value) : Base_Template() { copy_template(other_value); } DCA__3GPP__User__Participating__Type_template::~DCA__3GPP__User__Participating__Type_template() { clean_up(); } boolean DCA__3GPP__User__Participating__Type_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean DCA__3GPP__User__Participating__Type_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != DCA__3GPP__User__Participating__Type::UNBOUND_VALUE; } void DCA__3GPP__User__Participating__Type_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } DCA__3GPP__User__Participating__Type_template& DCA__3GPP__User__Participating__Type_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } DCA__3GPP__User__Participating__Type_template& DCA__3GPP__User__Participating__Type_template::operator=(int other_value) { if (!DCA__3GPP__User__Participating__Type::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.DCA_3GPP_User_Participating_Type.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__User__Participating__Type::enum_type)other_value; return *this; } DCA__3GPP__User__Participating__Type_template& DCA__3GPP__User__Participating__Type_template::operator=(DCA__3GPP__User__Participating__Type::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } DCA__3GPP__User__Participating__Type_template& DCA__3GPP__User__Participating__Type_template::operator=(const DCA__3GPP__User__Participating__Type& other_value) { if (other_value.enum_value == DCA__3GPP__User__Participating__Type::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_User_Participating_Type to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } DCA__3GPP__User__Participating__Type_template& DCA__3GPP__User__Participating__Type_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__User__Participating__Type::enum_type)(const DCA__3GPP__User__Participating__Type&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.DCA_3GPP_User_Participating_Type."); } return *this; } DCA__3GPP__User__Participating__Type_template& DCA__3GPP__User__Participating__Type_template::operator=(const DCA__3GPP__User__Participating__Type_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean DCA__3GPP__User__Participating__Type_template::match(DCA__3GPP__User__Participating__Type::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_User_Participating_Type."); } return FALSE; } boolean DCA__3GPP__User__Participating__Type_template::match(const DCA__3GPP__User__Participating__Type& other_value, boolean) const { if (other_value.enum_value == DCA__3GPP__User__Participating__Type::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.DCA_3GPP_User_Participating_Type with an unbound value."); return match(other_value.enum_value); } DCA__3GPP__User__Participating__Type::enum_type DCA__3GPP__User__Participating__Type_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.DCA_3GPP_User_Participating_Type."); return single_value; } void DCA__3GPP__User__Participating__Type_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.DCA_3GPP_User_Participating_Type."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new DCA__3GPP__User__Participating__Type_template[list_length]; } DCA__3GPP__User__Participating__Type_template& DCA__3GPP__User__Participating__Type_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.DCA_3GPP_User_Participating_Type."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.DCA_3GPP_User_Participating_Type."); return value_list.list_value[list_index]; } void DCA__3GPP__User__Participating__Type_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(DCA__3GPP__User__Participating__Type::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void DCA__3GPP__User__Participating__Type_template::log_match(const DCA__3GPP__User__Participating__Type& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void DCA__3GPP__User__Participating__Type_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_User_Participating_Type."); } } void DCA__3GPP__User__Participating__Type_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (DCA__3GPP__User__Participating__Type::enum_type)text_buf.pull_int().get_val(); if (!DCA__3GPP__User__Participating__Type::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_User_Participating_Type.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new DCA__3GPP__User__Participating__Type_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_User_Participating_Type."); } } boolean DCA__3GPP__User__Participating__Type_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean DCA__3GPP__User__Participating__Type_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { DCA__3GPP__User__Participating__Type_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { DCA__3GPP__User__Participating__Type::enum_type enum_val = DCA__3GPP__User__Participating__Type::str_to_enum(m_p->get_enumerated()); if (!DCA__3GPP__User__Participating__Type::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_User_Participating_Type."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { DCA__3GPP__User__Participating__Type_template* precondition = new DCA__3GPP__User__Participating__Type_template; precondition->set_param(*m_p->get_elem(0)); DCA__3GPP__User__Participating__Type_template* implied_template = new DCA__3GPP__User__Participating__Type_template; implied_template->set_param(*m_p->get_elem(1)); *this = DCA__3GPP__User__Participating__Type_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.DCA_3GPP_User_Participating_Type"); } is_ifpresent = param.get_ifpresent(); } void DCA__3GPP__User__Participating__Type_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.DCA_3GPP_User_Participating_Type"); } RX__3GPP__Sponsoring__Action::RX__3GPP__Sponsoring__Action() { enum_value = UNBOUND_VALUE; } RX__3GPP__Sponsoring__Action::RX__3GPP__Sponsoring__Action(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.RX_3GPP_Sponsoring_Action with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } RX__3GPP__Sponsoring__Action::RX__3GPP__Sponsoring__Action(enum_type other_value) { enum_value = other_value; } RX__3GPP__Sponsoring__Action::RX__3GPP__Sponsoring__Action(const RX__3GPP__Sponsoring__Action& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Sponsoring_Action."); enum_value = other_value.enum_value; } RX__3GPP__Sponsoring__Action& RX__3GPP__Sponsoring__Action::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.RX_3GPP_Sponsoring_Action.", other_value); enum_value = (enum_type)other_value; return *this; } RX__3GPP__Sponsoring__Action& RX__3GPP__Sponsoring__Action::operator=(enum_type other_value) { enum_value = other_value; return *this; } RX__3GPP__Sponsoring__Action& RX__3GPP__Sponsoring__Action::operator=(const RX__3GPP__Sponsoring__Action& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Sponsoring_Action."); enum_value = other_value.enum_value; return *this; } boolean RX__3GPP__Sponsoring__Action::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Sponsoring_Action."); return enum_value == other_value; } boolean RX__3GPP__Sponsoring__Action::operator==(const RX__3GPP__Sponsoring__Action& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Sponsoring_Action."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Sponsoring_Action."); return enum_value == other_value.enum_value; } boolean RX__3GPP__Sponsoring__Action::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Sponsoring_Action."); return enum_value < other_value; } boolean RX__3GPP__Sponsoring__Action::operator<(const RX__3GPP__Sponsoring__Action& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Sponsoring_Action."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Sponsoring_Action."); return enum_value < other_value.enum_value; } boolean RX__3GPP__Sponsoring__Action::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Sponsoring_Action."); return enum_value > other_value; } boolean RX__3GPP__Sponsoring__Action::operator>(const RX__3GPP__Sponsoring__Action& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Sponsoring_Action."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Sponsoring_Action."); return enum_value > other_value.enum_value; } const char *RX__3GPP__Sponsoring__Action::enum_to_str(enum_type enum_par) { switch (enum_par) { case DISABLE__SPONSORING: return "DISABLE_SPONSORING"; case ENABLE__SPONSORING: return "ENABLE_SPONSORING"; default: return ""; } } RX__3GPP__Sponsoring__Action::enum_type RX__3GPP__Sponsoring__Action::str_to_enum(const char *str_par) { if (!strcmp(str_par, "DISABLE_SPONSORING")) return DISABLE__SPONSORING; else if (!strcmp(str_par, "ENABLE_SPONSORING")) return ENABLE__SPONSORING; else return UNKNOWN_VALUE; } boolean RX__3GPP__Sponsoring__Action::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: return TRUE; default: return FALSE; } } int RX__3GPP__Sponsoring__Action::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.RX_3GPP_Sponsoring_Action.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int RX__3GPP__Sponsoring__Action::enum2int(const RX__3GPP__Sponsoring__Action& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.RX_3GPP_Sponsoring_Action.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void RX__3GPP__Sponsoring__Action::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.RX_3GPP_Sponsoring_Action.", int_val); enum_value = (enum_type)int_val; } RX__3GPP__Sponsoring__Action::operator RX__3GPP__Sponsoring__Action::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.RX_3GPP_Sponsoring_Action."); return enum_value; } void RX__3GPP__Sponsoring__Action::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void RX__3GPP__Sponsoring__Action::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.RX_3GPP_Sponsoring_Action"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.RX_3GPP_Sponsoring_Action."); } } void RX__3GPP__Sponsoring__Action::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Sponsoring_Action."); text_buf.push_int(enum_value); } void RX__3GPP__Sponsoring__Action::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.RX_3GPP_Sponsoring_Action.", enum_value); } void RX__3GPP__Sponsoring__Action::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void RX__3GPP__Sponsoring__Action::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int RX__3GPP__Sponsoring__Action::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int RX__3GPP__Sponsoring__Action::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void RX__3GPP__Sponsoring__Action_template::copy_template(const RX__3GPP__Sponsoring__Action_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new RX__3GPP__Sponsoring__Action_template[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 RX__3GPP__Sponsoring__Action_template(*other_value.implication_.precondition); implication_.implied_template = new RX__3GPP__Sponsoring__Action_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.RX_3GPP_Sponsoring_Action."); } } RX__3GPP__Sponsoring__Action_template::RX__3GPP__Sponsoring__Action_template() { } RX__3GPP__Sponsoring__Action_template::RX__3GPP__Sponsoring__Action_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } RX__3GPP__Sponsoring__Action_template::RX__3GPP__Sponsoring__Action_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!RX__3GPP__Sponsoring__Action::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.RX_3GPP_Sponsoring_Action with unknown numeric value %d.", other_value); single_value = (RX__3GPP__Sponsoring__Action::enum_type)other_value; } RX__3GPP__Sponsoring__Action_template::RX__3GPP__Sponsoring__Action_template(RX__3GPP__Sponsoring__Action::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } RX__3GPP__Sponsoring__Action_template::RX__3GPP__Sponsoring__Action_template(const RX__3GPP__Sponsoring__Action& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == RX__3GPP__Sponsoring__Action::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Sponsoring_Action."); single_value = other_value.enum_value; } RX__3GPP__Sponsoring__Action_template::RX__3GPP__Sponsoring__Action_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (RX__3GPP__Sponsoring__Action::enum_type)(const RX__3GPP__Sponsoring__Action&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.RX_3GPP_Sponsoring_Action from an unbound optional field."); } } RX__3GPP__Sponsoring__Action_template::RX__3GPP__Sponsoring__Action_template(RX__3GPP__Sponsoring__Action_template* p_precondition, RX__3GPP__Sponsoring__Action_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } RX__3GPP__Sponsoring__Action_template::RX__3GPP__Sponsoring__Action_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; } RX__3GPP__Sponsoring__Action_template::RX__3GPP__Sponsoring__Action_template(const RX__3GPP__Sponsoring__Action_template& other_value) : Base_Template() { copy_template(other_value); } RX__3GPP__Sponsoring__Action_template::~RX__3GPP__Sponsoring__Action_template() { clean_up(); } boolean RX__3GPP__Sponsoring__Action_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean RX__3GPP__Sponsoring__Action_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != RX__3GPP__Sponsoring__Action::UNBOUND_VALUE; } void RX__3GPP__Sponsoring__Action_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } RX__3GPP__Sponsoring__Action_template& RX__3GPP__Sponsoring__Action_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } RX__3GPP__Sponsoring__Action_template& RX__3GPP__Sponsoring__Action_template::operator=(int other_value) { if (!RX__3GPP__Sponsoring__Action::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.RX_3GPP_Sponsoring_Action.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (RX__3GPP__Sponsoring__Action::enum_type)other_value; return *this; } RX__3GPP__Sponsoring__Action_template& RX__3GPP__Sponsoring__Action_template::operator=(RX__3GPP__Sponsoring__Action::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } RX__3GPP__Sponsoring__Action_template& RX__3GPP__Sponsoring__Action_template::operator=(const RX__3GPP__Sponsoring__Action& other_value) { if (other_value.enum_value == RX__3GPP__Sponsoring__Action::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.RX_3GPP_Sponsoring_Action to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } RX__3GPP__Sponsoring__Action_template& RX__3GPP__Sponsoring__Action_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (RX__3GPP__Sponsoring__Action::enum_type)(const RX__3GPP__Sponsoring__Action&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.RX_3GPP_Sponsoring_Action."); } return *this; } RX__3GPP__Sponsoring__Action_template& RX__3GPP__Sponsoring__Action_template::operator=(const RX__3GPP__Sponsoring__Action_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean RX__3GPP__Sponsoring__Action_template::match(RX__3GPP__Sponsoring__Action::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.RX_3GPP_Sponsoring_Action."); } return FALSE; } boolean RX__3GPP__Sponsoring__Action_template::match(const RX__3GPP__Sponsoring__Action& other_value, boolean) const { if (other_value.enum_value == RX__3GPP__Sponsoring__Action::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.RX_3GPP_Sponsoring_Action with an unbound value."); return match(other_value.enum_value); } RX__3GPP__Sponsoring__Action::enum_type RX__3GPP__Sponsoring__Action_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.RX_3GPP_Sponsoring_Action."); return single_value; } void RX__3GPP__Sponsoring__Action_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.RX_3GPP_Sponsoring_Action."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new RX__3GPP__Sponsoring__Action_template[list_length]; } RX__3GPP__Sponsoring__Action_template& RX__3GPP__Sponsoring__Action_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.RX_3GPP_Sponsoring_Action."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.RX_3GPP_Sponsoring_Action."); return value_list.list_value[list_index]; } void RX__3GPP__Sponsoring__Action_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(RX__3GPP__Sponsoring__Action::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void RX__3GPP__Sponsoring__Action_template::log_match(const RX__3GPP__Sponsoring__Action& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void RX__3GPP__Sponsoring__Action_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.RX_3GPP_Sponsoring_Action."); } } void RX__3GPP__Sponsoring__Action_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (RX__3GPP__Sponsoring__Action::enum_type)text_buf.pull_int().get_val(); if (!RX__3GPP__Sponsoring__Action::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.RX_3GPP_Sponsoring_Action.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new RX__3GPP__Sponsoring__Action_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.RX_3GPP_Sponsoring_Action."); } } boolean RX__3GPP__Sponsoring__Action_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean RX__3GPP__Sponsoring__Action_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { RX__3GPP__Sponsoring__Action_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { RX__3GPP__Sponsoring__Action::enum_type enum_val = RX__3GPP__Sponsoring__Action::str_to_enum(m_p->get_enumerated()); if (!RX__3GPP__Sponsoring__Action::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.RX_3GPP_Sponsoring_Action."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { RX__3GPP__Sponsoring__Action_template* precondition = new RX__3GPP__Sponsoring__Action_template; precondition->set_param(*m_p->get_elem(0)); RX__3GPP__Sponsoring__Action_template* implied_template = new RX__3GPP__Sponsoring__Action_template; implied_template->set_param(*m_p->get_elem(1)); *this = RX__3GPP__Sponsoring__Action_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.RX_3GPP_Sponsoring_Action"); } is_ifpresent = param.get_ifpresent(); } void RX__3GPP__Sponsoring__Action_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.RX_3GPP_Sponsoring_Action"); } DCA__3GPP__Node__Functionality::DCA__3GPP__Node__Functionality() { enum_value = UNBOUND_VALUE; } DCA__3GPP__Node__Functionality::DCA__3GPP__Node__Functionality(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Node_Functionality with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } DCA__3GPP__Node__Functionality::DCA__3GPP__Node__Functionality(enum_type other_value) { enum_value = other_value; } DCA__3GPP__Node__Functionality::DCA__3GPP__Node__Functionality(const DCA__3GPP__Node__Functionality& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Node_Functionality."); enum_value = other_value.enum_value; } DCA__3GPP__Node__Functionality& DCA__3GPP__Node__Functionality::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Node_Functionality.", other_value); enum_value = (enum_type)other_value; return *this; } DCA__3GPP__Node__Functionality& DCA__3GPP__Node__Functionality::operator=(enum_type other_value) { enum_value = other_value; return *this; } DCA__3GPP__Node__Functionality& DCA__3GPP__Node__Functionality::operator=(const DCA__3GPP__Node__Functionality& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Node_Functionality."); enum_value = other_value.enum_value; return *this; } boolean DCA__3GPP__Node__Functionality::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Node_Functionality."); return enum_value == other_value; } boolean DCA__3GPP__Node__Functionality::operator==(const DCA__3GPP__Node__Functionality& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Node_Functionality."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Node_Functionality."); return enum_value == other_value.enum_value; } boolean DCA__3GPP__Node__Functionality::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Node_Functionality."); return enum_value < other_value; } boolean DCA__3GPP__Node__Functionality::operator<(const DCA__3GPP__Node__Functionality& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Node_Functionality."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Node_Functionality."); return enum_value < other_value.enum_value; } boolean DCA__3GPP__Node__Functionality::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Node_Functionality."); return enum_value > other_value; } boolean DCA__3GPP__Node__Functionality::operator>(const DCA__3GPP__Node__Functionality& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Node_Functionality."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Node_Functionality."); return enum_value > other_value.enum_value; } const char *DCA__3GPP__Node__Functionality::enum_to_str(enum_type enum_par) { switch (enum_par) { case S__CSCF: return "S_CSCF"; case P__CSCF: return "P_CSCF"; case I__CSCF: return "I_CSCF"; case MRFC: return "MRFC"; case MGCF: return "MGCF"; case BGCF: return "BGCF"; case AS: return "AS"; case IBCF: return "IBCF"; case S__GW: return "S_GW"; case P__GW: return "P_GW"; case HSGW: return "HSGW"; case E__CSCF: return "E_CSCF"; case MME: return "MME"; case TRF: return "TRF"; case TF: return "TF"; case ATCF: return "ATCF"; case Proxy__Function: return "Proxy_Function"; case ePDG: return "ePDG"; case TDF: return "TDF"; case TWAG: return "TWAG"; case SCEF: return "SCEF"; case IWK__SCEF: return "IWK_SCEF"; default: return ""; } } DCA__3GPP__Node__Functionality::enum_type DCA__3GPP__Node__Functionality::str_to_enum(const char *str_par) { if (!strcmp(str_par, "S_CSCF")) return S__CSCF; else if (!strcmp(str_par, "P_CSCF")) return P__CSCF; else if (!strcmp(str_par, "I_CSCF")) return I__CSCF; else if (!strcmp(str_par, "MRFC")) return MRFC; else if (!strcmp(str_par, "MGCF")) return MGCF; else if (!strcmp(str_par, "BGCF")) return BGCF; else if (!strcmp(str_par, "AS")) return AS; else if (!strcmp(str_par, "IBCF")) return IBCF; else if (!strcmp(str_par, "S_GW")) return S__GW; else if (!strcmp(str_par, "P_GW")) return P__GW; else if (!strcmp(str_par, "HSGW")) return HSGW; else if (!strcmp(str_par, "E_CSCF")) return E__CSCF; else if (!strcmp(str_par, "MME")) return MME; else if (!strcmp(str_par, "TRF")) return TRF; else if (!strcmp(str_par, "TF")) return TF; else if (!strcmp(str_par, "ATCF")) return ATCF; else if (!strcmp(str_par, "Proxy_Function")) return Proxy__Function; else if (!strcmp(str_par, "ePDG")) return ePDG; else if (!strcmp(str_par, "TDF")) return TDF; else if (!strcmp(str_par, "TWAG")) return TWAG; else if (!strcmp(str_par, "SCEF")) return SCEF; else if (!strcmp(str_par, "IWK_SCEF")) return IWK__SCEF; else return UNKNOWN_VALUE; } boolean DCA__3GPP__Node__Functionality::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: case 16: case 17: case 18: case 19: case 20: case 21: return TRUE; default: return FALSE; } } int DCA__3GPP__Node__Functionality::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_Node_Functionality.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int DCA__3GPP__Node__Functionality::enum2int(const DCA__3GPP__Node__Functionality& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_Node_Functionality.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void DCA__3GPP__Node__Functionality::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Node_Functionality.", int_val); enum_value = (enum_type)int_val; } DCA__3GPP__Node__Functionality::operator DCA__3GPP__Node__Functionality::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.DCA_3GPP_Node_Functionality."); return enum_value; } void DCA__3GPP__Node__Functionality::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void DCA__3GPP__Node__Functionality::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.DCA_3GPP_Node_Functionality"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_Node_Functionality."); } } void DCA__3GPP__Node__Functionality::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Node_Functionality."); text_buf.push_int(enum_value); } void DCA__3GPP__Node__Functionality::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.DCA_3GPP_Node_Functionality.", enum_value); } void DCA__3GPP__Node__Functionality::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void DCA__3GPP__Node__Functionality::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int DCA__3GPP__Node__Functionality::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 5, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int DCA__3GPP__Node__Functionality::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 5); } void DCA__3GPP__Node__Functionality_template::copy_template(const DCA__3GPP__Node__Functionality_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new DCA__3GPP__Node__Functionality_template[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 DCA__3GPP__Node__Functionality_template(*other_value.implication_.precondition); implication_.implied_template = new DCA__3GPP__Node__Functionality_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Node_Functionality."); } } DCA__3GPP__Node__Functionality_template::DCA__3GPP__Node__Functionality_template() { } DCA__3GPP__Node__Functionality_template::DCA__3GPP__Node__Functionality_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } DCA__3GPP__Node__Functionality_template::DCA__3GPP__Node__Functionality_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!DCA__3GPP__Node__Functionality::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.DCA_3GPP_Node_Functionality with unknown numeric value %d.", other_value); single_value = (DCA__3GPP__Node__Functionality::enum_type)other_value; } DCA__3GPP__Node__Functionality_template::DCA__3GPP__Node__Functionality_template(DCA__3GPP__Node__Functionality::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } DCA__3GPP__Node__Functionality_template::DCA__3GPP__Node__Functionality_template(const DCA__3GPP__Node__Functionality& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == DCA__3GPP__Node__Functionality::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Node_Functionality."); single_value = other_value.enum_value; } DCA__3GPP__Node__Functionality_template::DCA__3GPP__Node__Functionality_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Node__Functionality::enum_type)(const DCA__3GPP__Node__Functionality&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.DCA_3GPP_Node_Functionality from an unbound optional field."); } } DCA__3GPP__Node__Functionality_template::DCA__3GPP__Node__Functionality_template(DCA__3GPP__Node__Functionality_template* p_precondition, DCA__3GPP__Node__Functionality_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } DCA__3GPP__Node__Functionality_template::DCA__3GPP__Node__Functionality_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; } DCA__3GPP__Node__Functionality_template::DCA__3GPP__Node__Functionality_template(const DCA__3GPP__Node__Functionality_template& other_value) : Base_Template() { copy_template(other_value); } DCA__3GPP__Node__Functionality_template::~DCA__3GPP__Node__Functionality_template() { clean_up(); } boolean DCA__3GPP__Node__Functionality_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean DCA__3GPP__Node__Functionality_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != DCA__3GPP__Node__Functionality::UNBOUND_VALUE; } void DCA__3GPP__Node__Functionality_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } DCA__3GPP__Node__Functionality_template& DCA__3GPP__Node__Functionality_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } DCA__3GPP__Node__Functionality_template& DCA__3GPP__Node__Functionality_template::operator=(int other_value) { if (!DCA__3GPP__Node__Functionality::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.DCA_3GPP_Node_Functionality.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Node__Functionality::enum_type)other_value; return *this; } DCA__3GPP__Node__Functionality_template& DCA__3GPP__Node__Functionality_template::operator=(DCA__3GPP__Node__Functionality::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } DCA__3GPP__Node__Functionality_template& DCA__3GPP__Node__Functionality_template::operator=(const DCA__3GPP__Node__Functionality& other_value) { if (other_value.enum_value == DCA__3GPP__Node__Functionality::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Node_Functionality to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } DCA__3GPP__Node__Functionality_template& DCA__3GPP__Node__Functionality_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Node__Functionality::enum_type)(const DCA__3GPP__Node__Functionality&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.DCA_3GPP_Node_Functionality."); } return *this; } DCA__3GPP__Node__Functionality_template& DCA__3GPP__Node__Functionality_template::operator=(const DCA__3GPP__Node__Functionality_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean DCA__3GPP__Node__Functionality_template::match(DCA__3GPP__Node__Functionality::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Node_Functionality."); } return FALSE; } boolean DCA__3GPP__Node__Functionality_template::match(const DCA__3GPP__Node__Functionality& other_value, boolean) const { if (other_value.enum_value == DCA__3GPP__Node__Functionality::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.DCA_3GPP_Node_Functionality with an unbound value."); return match(other_value.enum_value); } DCA__3GPP__Node__Functionality::enum_type DCA__3GPP__Node__Functionality_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.DCA_3GPP_Node_Functionality."); return single_value; } void DCA__3GPP__Node__Functionality_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Node_Functionality."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new DCA__3GPP__Node__Functionality_template[list_length]; } DCA__3GPP__Node__Functionality_template& DCA__3GPP__Node__Functionality_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.DCA_3GPP_Node_Functionality."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.DCA_3GPP_Node_Functionality."); return value_list.list_value[list_index]; } void DCA__3GPP__Node__Functionality_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(DCA__3GPP__Node__Functionality::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void DCA__3GPP__Node__Functionality_template::log_match(const DCA__3GPP__Node__Functionality& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void DCA__3GPP__Node__Functionality_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Node_Functionality."); } } void DCA__3GPP__Node__Functionality_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (DCA__3GPP__Node__Functionality::enum_type)text_buf.pull_int().get_val(); if (!DCA__3GPP__Node__Functionality::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Node_Functionality.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new DCA__3GPP__Node__Functionality_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Node_Functionality."); } } boolean DCA__3GPP__Node__Functionality_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean DCA__3GPP__Node__Functionality_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { DCA__3GPP__Node__Functionality_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { DCA__3GPP__Node__Functionality::enum_type enum_val = DCA__3GPP__Node__Functionality::str_to_enum(m_p->get_enumerated()); if (!DCA__3GPP__Node__Functionality::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_Node_Functionality."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { DCA__3GPP__Node__Functionality_template* precondition = new DCA__3GPP__Node__Functionality_template; precondition->set_param(*m_p->get_elem(0)); DCA__3GPP__Node__Functionality_template* implied_template = new DCA__3GPP__Node__Functionality_template; implied_template->set_param(*m_p->get_elem(1)); *this = DCA__3GPP__Node__Functionality_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.DCA_3GPP_Node_Functionality"); } is_ifpresent = param.get_ifpresent(); } void DCA__3GPP__Node__Functionality_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.DCA_3GPP_Node_Functionality"); } AAA__3GPP__Daylight__Saving__Time::AAA__3GPP__Daylight__Saving__Time() { enum_value = UNBOUND_VALUE; } AAA__3GPP__Daylight__Saving__Time::AAA__3GPP__Daylight__Saving__Time(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.AAA_3GPP_Daylight_Saving_Time with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } AAA__3GPP__Daylight__Saving__Time::AAA__3GPP__Daylight__Saving__Time(enum_type other_value) { enum_value = other_value; } AAA__3GPP__Daylight__Saving__Time::AAA__3GPP__Daylight__Saving__Time(const AAA__3GPP__Daylight__Saving__Time& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Daylight_Saving_Time."); enum_value = other_value.enum_value; } AAA__3GPP__Daylight__Saving__Time& AAA__3GPP__Daylight__Saving__Time::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.AAA_3GPP_Daylight_Saving_Time.", other_value); enum_value = (enum_type)other_value; return *this; } AAA__3GPP__Daylight__Saving__Time& AAA__3GPP__Daylight__Saving__Time::operator=(enum_type other_value) { enum_value = other_value; return *this; } AAA__3GPP__Daylight__Saving__Time& AAA__3GPP__Daylight__Saving__Time::operator=(const AAA__3GPP__Daylight__Saving__Time& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Daylight_Saving_Time."); enum_value = other_value.enum_value; return *this; } boolean AAA__3GPP__Daylight__Saving__Time::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Daylight_Saving_Time."); return enum_value == other_value; } boolean AAA__3GPP__Daylight__Saving__Time::operator==(const AAA__3GPP__Daylight__Saving__Time& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Daylight_Saving_Time."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Daylight_Saving_Time."); return enum_value == other_value.enum_value; } boolean AAA__3GPP__Daylight__Saving__Time::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Daylight_Saving_Time."); return enum_value < other_value; } boolean AAA__3GPP__Daylight__Saving__Time::operator<(const AAA__3GPP__Daylight__Saving__Time& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Daylight_Saving_Time."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Daylight_Saving_Time."); return enum_value < other_value.enum_value; } boolean AAA__3GPP__Daylight__Saving__Time::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Daylight_Saving_Time."); return enum_value > other_value; } boolean AAA__3GPP__Daylight__Saving__Time::operator>(const AAA__3GPP__Daylight__Saving__Time& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Daylight_Saving_Time."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Daylight_Saving_Time."); return enum_value > other_value.enum_value; } const char *AAA__3GPP__Daylight__Saving__Time::enum_to_str(enum_type enum_par) { switch (enum_par) { case NO__ADJUSTMENT: return "NO_ADJUSTMENT"; case PLUS__ONE__HOUR__ADJUSTMENT: return "PLUS_ONE_HOUR_ADJUSTMENT"; case PLUS__TWO__HOURS__ADJUSTMENT: return "PLUS_TWO_HOURS_ADJUSTMENT"; default: return ""; } } AAA__3GPP__Daylight__Saving__Time::enum_type AAA__3GPP__Daylight__Saving__Time::str_to_enum(const char *str_par) { if (!strcmp(str_par, "NO_ADJUSTMENT")) return NO__ADJUSTMENT; else if (!strcmp(str_par, "PLUS_ONE_HOUR_ADJUSTMENT")) return PLUS__ONE__HOUR__ADJUSTMENT; else if (!strcmp(str_par, "PLUS_TWO_HOURS_ADJUSTMENT")) return PLUS__TWO__HOURS__ADJUSTMENT; else return UNKNOWN_VALUE; } boolean AAA__3GPP__Daylight__Saving__Time::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: case 2: return TRUE; default: return FALSE; } } int AAA__3GPP__Daylight__Saving__Time::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.AAA_3GPP_Daylight_Saving_Time.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int AAA__3GPP__Daylight__Saving__Time::enum2int(const AAA__3GPP__Daylight__Saving__Time& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.AAA_3GPP_Daylight_Saving_Time.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void AAA__3GPP__Daylight__Saving__Time::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.AAA_3GPP_Daylight_Saving_Time.", int_val); enum_value = (enum_type)int_val; } AAA__3GPP__Daylight__Saving__Time::operator AAA__3GPP__Daylight__Saving__Time::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.AAA_3GPP_Daylight_Saving_Time."); return enum_value; } void AAA__3GPP__Daylight__Saving__Time::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void AAA__3GPP__Daylight__Saving__Time::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.AAA_3GPP_Daylight_Saving_Time"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.AAA_3GPP_Daylight_Saving_Time."); } } void AAA__3GPP__Daylight__Saving__Time::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Daylight_Saving_Time."); text_buf.push_int(enum_value); } void AAA__3GPP__Daylight__Saving__Time::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.AAA_3GPP_Daylight_Saving_Time.", enum_value); } void AAA__3GPP__Daylight__Saving__Time::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void AAA__3GPP__Daylight__Saving__Time::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int AAA__3GPP__Daylight__Saving__Time::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int AAA__3GPP__Daylight__Saving__Time::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void AAA__3GPP__Daylight__Saving__Time_template::copy_template(const AAA__3GPP__Daylight__Saving__Time_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new AAA__3GPP__Daylight__Saving__Time_template[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 AAA__3GPP__Daylight__Saving__Time_template(*other_value.implication_.precondition); implication_.implied_template = new AAA__3GPP__Daylight__Saving__Time_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_Daylight_Saving_Time."); } } AAA__3GPP__Daylight__Saving__Time_template::AAA__3GPP__Daylight__Saving__Time_template() { } AAA__3GPP__Daylight__Saving__Time_template::AAA__3GPP__Daylight__Saving__Time_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } AAA__3GPP__Daylight__Saving__Time_template::AAA__3GPP__Daylight__Saving__Time_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!AAA__3GPP__Daylight__Saving__Time::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.AAA_3GPP_Daylight_Saving_Time with unknown numeric value %d.", other_value); single_value = (AAA__3GPP__Daylight__Saving__Time::enum_type)other_value; } AAA__3GPP__Daylight__Saving__Time_template::AAA__3GPP__Daylight__Saving__Time_template(AAA__3GPP__Daylight__Saving__Time::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } AAA__3GPP__Daylight__Saving__Time_template::AAA__3GPP__Daylight__Saving__Time_template(const AAA__3GPP__Daylight__Saving__Time& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == AAA__3GPP__Daylight__Saving__Time::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Daylight_Saving_Time."); single_value = other_value.enum_value; } AAA__3GPP__Daylight__Saving__Time_template::AAA__3GPP__Daylight__Saving__Time_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__Daylight__Saving__Time::enum_type)(const AAA__3GPP__Daylight__Saving__Time&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.AAA_3GPP_Daylight_Saving_Time from an unbound optional field."); } } AAA__3GPP__Daylight__Saving__Time_template::AAA__3GPP__Daylight__Saving__Time_template(AAA__3GPP__Daylight__Saving__Time_template* p_precondition, AAA__3GPP__Daylight__Saving__Time_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } AAA__3GPP__Daylight__Saving__Time_template::AAA__3GPP__Daylight__Saving__Time_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; } AAA__3GPP__Daylight__Saving__Time_template::AAA__3GPP__Daylight__Saving__Time_template(const AAA__3GPP__Daylight__Saving__Time_template& other_value) : Base_Template() { copy_template(other_value); } AAA__3GPP__Daylight__Saving__Time_template::~AAA__3GPP__Daylight__Saving__Time_template() { clean_up(); } boolean AAA__3GPP__Daylight__Saving__Time_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean AAA__3GPP__Daylight__Saving__Time_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != AAA__3GPP__Daylight__Saving__Time::UNBOUND_VALUE; } void AAA__3GPP__Daylight__Saving__Time_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } AAA__3GPP__Daylight__Saving__Time_template& AAA__3GPP__Daylight__Saving__Time_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } AAA__3GPP__Daylight__Saving__Time_template& AAA__3GPP__Daylight__Saving__Time_template::operator=(int other_value) { if (!AAA__3GPP__Daylight__Saving__Time::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.AAA_3GPP_Daylight_Saving_Time.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__Daylight__Saving__Time::enum_type)other_value; return *this; } AAA__3GPP__Daylight__Saving__Time_template& AAA__3GPP__Daylight__Saving__Time_template::operator=(AAA__3GPP__Daylight__Saving__Time::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } AAA__3GPP__Daylight__Saving__Time_template& AAA__3GPP__Daylight__Saving__Time_template::operator=(const AAA__3GPP__Daylight__Saving__Time& other_value) { if (other_value.enum_value == AAA__3GPP__Daylight__Saving__Time::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Daylight_Saving_Time to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } AAA__3GPP__Daylight__Saving__Time_template& AAA__3GPP__Daylight__Saving__Time_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__Daylight__Saving__Time::enum_type)(const AAA__3GPP__Daylight__Saving__Time&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.AAA_3GPP_Daylight_Saving_Time."); } return *this; } AAA__3GPP__Daylight__Saving__Time_template& AAA__3GPP__Daylight__Saving__Time_template::operator=(const AAA__3GPP__Daylight__Saving__Time_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean AAA__3GPP__Daylight__Saving__Time_template::match(AAA__3GPP__Daylight__Saving__Time::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_Daylight_Saving_Time."); } return FALSE; } boolean AAA__3GPP__Daylight__Saving__Time_template::match(const AAA__3GPP__Daylight__Saving__Time& other_value, boolean) const { if (other_value.enum_value == AAA__3GPP__Daylight__Saving__Time::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.AAA_3GPP_Daylight_Saving_Time with an unbound value."); return match(other_value.enum_value); } AAA__3GPP__Daylight__Saving__Time::enum_type AAA__3GPP__Daylight__Saving__Time_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.AAA_3GPP_Daylight_Saving_Time."); return single_value; } void AAA__3GPP__Daylight__Saving__Time_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.AAA_3GPP_Daylight_Saving_Time."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new AAA__3GPP__Daylight__Saving__Time_template[list_length]; } AAA__3GPP__Daylight__Saving__Time_template& AAA__3GPP__Daylight__Saving__Time_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.AAA_3GPP_Daylight_Saving_Time."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.AAA_3GPP_Daylight_Saving_Time."); return value_list.list_value[list_index]; } void AAA__3GPP__Daylight__Saving__Time_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(AAA__3GPP__Daylight__Saving__Time::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void AAA__3GPP__Daylight__Saving__Time_template::log_match(const AAA__3GPP__Daylight__Saving__Time& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void AAA__3GPP__Daylight__Saving__Time_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_Daylight_Saving_Time."); } } void AAA__3GPP__Daylight__Saving__Time_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (AAA__3GPP__Daylight__Saving__Time::enum_type)text_buf.pull_int().get_val(); if (!AAA__3GPP__Daylight__Saving__Time::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.AAA_3GPP_Daylight_Saving_Time.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new AAA__3GPP__Daylight__Saving__Time_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.AAA_3GPP_Daylight_Saving_Time."); } } boolean AAA__3GPP__Daylight__Saving__Time_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean AAA__3GPP__Daylight__Saving__Time_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { AAA__3GPP__Daylight__Saving__Time_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { AAA__3GPP__Daylight__Saving__Time::enum_type enum_val = AAA__3GPP__Daylight__Saving__Time::str_to_enum(m_p->get_enumerated()); if (!AAA__3GPP__Daylight__Saving__Time::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.AAA_3GPP_Daylight_Saving_Time."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { AAA__3GPP__Daylight__Saving__Time_template* precondition = new AAA__3GPP__Daylight__Saving__Time_template; precondition->set_param(*m_p->get_elem(0)); AAA__3GPP__Daylight__Saving__Time_template* implied_template = new AAA__3GPP__Daylight__Saving__Time_template; implied_template->set_param(*m_p->get_elem(1)); *this = AAA__3GPP__Daylight__Saving__Time_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.AAA_3GPP_Daylight_Saving_Time"); } is_ifpresent = param.get_ifpresent(); } void AAA__3GPP__Daylight__Saving__Time_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.AAA_3GPP_Daylight_Saving_Time"); } PCC__3GPP__Removal__Of__Access::PCC__3GPP__Removal__Of__Access() { enum_value = UNBOUND_VALUE; } PCC__3GPP__Removal__Of__Access::PCC__3GPP__Removal__Of__Access(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.PCC_3GPP_Removal_Of_Access with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } PCC__3GPP__Removal__Of__Access::PCC__3GPP__Removal__Of__Access(enum_type other_value) { enum_value = other_value; } PCC__3GPP__Removal__Of__Access::PCC__3GPP__Removal__Of__Access(const PCC__3GPP__Removal__Of__Access& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Removal_Of_Access."); enum_value = other_value.enum_value; } PCC__3GPP__Removal__Of__Access& PCC__3GPP__Removal__Of__Access::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.PCC_3GPP_Removal_Of_Access.", other_value); enum_value = (enum_type)other_value; return *this; } PCC__3GPP__Removal__Of__Access& PCC__3GPP__Removal__Of__Access::operator=(enum_type other_value) { enum_value = other_value; return *this; } PCC__3GPP__Removal__Of__Access& PCC__3GPP__Removal__Of__Access::operator=(const PCC__3GPP__Removal__Of__Access& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Removal_Of_Access."); enum_value = other_value.enum_value; return *this; } boolean PCC__3GPP__Removal__Of__Access::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Removal_Of_Access."); return enum_value == other_value; } boolean PCC__3GPP__Removal__Of__Access::operator==(const PCC__3GPP__Removal__Of__Access& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Removal_Of_Access."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Removal_Of_Access."); return enum_value == other_value.enum_value; } boolean PCC__3GPP__Removal__Of__Access::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Removal_Of_Access."); return enum_value < other_value; } boolean PCC__3GPP__Removal__Of__Access::operator<(const PCC__3GPP__Removal__Of__Access& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Removal_Of_Access."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Removal_Of_Access."); return enum_value < other_value.enum_value; } boolean PCC__3GPP__Removal__Of__Access::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Removal_Of_Access."); return enum_value > other_value; } boolean PCC__3GPP__Removal__Of__Access::operator>(const PCC__3GPP__Removal__Of__Access& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Removal_Of_Access."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Removal_Of_Access."); return enum_value > other_value.enum_value; } const char *PCC__3GPP__Removal__Of__Access::enum_to_str(enum_type enum_par) { switch (enum_par) { case REMOVAL__OF__ACCESS: return "REMOVAL_OF_ACCESS"; default: return ""; } } PCC__3GPP__Removal__Of__Access::enum_type PCC__3GPP__Removal__Of__Access::str_to_enum(const char *str_par) { if (!strcmp(str_par, "REMOVAL_OF_ACCESS")) return REMOVAL__OF__ACCESS; else return UNKNOWN_VALUE; } boolean PCC__3GPP__Removal__Of__Access::is_valid_enum(int int_par) { switch (int_par) { case 0: return TRUE; default: return FALSE; } } int PCC__3GPP__Removal__Of__Access::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.PCC_3GPP_Removal_Of_Access.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int PCC__3GPP__Removal__Of__Access::enum2int(const PCC__3GPP__Removal__Of__Access& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.PCC_3GPP_Removal_Of_Access.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void PCC__3GPP__Removal__Of__Access::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.PCC_3GPP_Removal_Of_Access.", int_val); enum_value = (enum_type)int_val; } PCC__3GPP__Removal__Of__Access::operator PCC__3GPP__Removal__Of__Access::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.PCC_3GPP_Removal_Of_Access."); return enum_value; } void PCC__3GPP__Removal__Of__Access::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void PCC__3GPP__Removal__Of__Access::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.PCC_3GPP_Removal_Of_Access"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.PCC_3GPP_Removal_Of_Access."); } } void PCC__3GPP__Removal__Of__Access::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Removal_Of_Access."); text_buf.push_int(enum_value); } void PCC__3GPP__Removal__Of__Access::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.PCC_3GPP_Removal_Of_Access.", enum_value); } void PCC__3GPP__Removal__Of__Access::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void PCC__3GPP__Removal__Of__Access::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int PCC__3GPP__Removal__Of__Access::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 1, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int PCC__3GPP__Removal__Of__Access::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 1); } void PCC__3GPP__Removal__Of__Access_template::copy_template(const PCC__3GPP__Removal__Of__Access_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new PCC__3GPP__Removal__Of__Access_template[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 PCC__3GPP__Removal__Of__Access_template(*other_value.implication_.precondition); implication_.implied_template = new PCC__3GPP__Removal__Of__Access_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.PCC_3GPP_Removal_Of_Access."); } } PCC__3GPP__Removal__Of__Access_template::PCC__3GPP__Removal__Of__Access_template() { } PCC__3GPP__Removal__Of__Access_template::PCC__3GPP__Removal__Of__Access_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } PCC__3GPP__Removal__Of__Access_template::PCC__3GPP__Removal__Of__Access_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!PCC__3GPP__Removal__Of__Access::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.PCC_3GPP_Removal_Of_Access with unknown numeric value %d.", other_value); single_value = (PCC__3GPP__Removal__Of__Access::enum_type)other_value; } PCC__3GPP__Removal__Of__Access_template::PCC__3GPP__Removal__Of__Access_template(PCC__3GPP__Removal__Of__Access::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } PCC__3GPP__Removal__Of__Access_template::PCC__3GPP__Removal__Of__Access_template(const PCC__3GPP__Removal__Of__Access& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == PCC__3GPP__Removal__Of__Access::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Removal_Of_Access."); single_value = other_value.enum_value; } PCC__3GPP__Removal__Of__Access_template::PCC__3GPP__Removal__Of__Access_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (PCC__3GPP__Removal__Of__Access::enum_type)(const PCC__3GPP__Removal__Of__Access&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.PCC_3GPP_Removal_Of_Access from an unbound optional field."); } } PCC__3GPP__Removal__Of__Access_template::PCC__3GPP__Removal__Of__Access_template(PCC__3GPP__Removal__Of__Access_template* p_precondition, PCC__3GPP__Removal__Of__Access_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } PCC__3GPP__Removal__Of__Access_template::PCC__3GPP__Removal__Of__Access_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; } PCC__3GPP__Removal__Of__Access_template::PCC__3GPP__Removal__Of__Access_template(const PCC__3GPP__Removal__Of__Access_template& other_value) : Base_Template() { copy_template(other_value); } PCC__3GPP__Removal__Of__Access_template::~PCC__3GPP__Removal__Of__Access_template() { clean_up(); } boolean PCC__3GPP__Removal__Of__Access_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean PCC__3GPP__Removal__Of__Access_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != PCC__3GPP__Removal__Of__Access::UNBOUND_VALUE; } void PCC__3GPP__Removal__Of__Access_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } PCC__3GPP__Removal__Of__Access_template& PCC__3GPP__Removal__Of__Access_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } PCC__3GPP__Removal__Of__Access_template& PCC__3GPP__Removal__Of__Access_template::operator=(int other_value) { if (!PCC__3GPP__Removal__Of__Access::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.PCC_3GPP_Removal_Of_Access.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (PCC__3GPP__Removal__Of__Access::enum_type)other_value; return *this; } PCC__3GPP__Removal__Of__Access_template& PCC__3GPP__Removal__Of__Access_template::operator=(PCC__3GPP__Removal__Of__Access::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } PCC__3GPP__Removal__Of__Access_template& PCC__3GPP__Removal__Of__Access_template::operator=(const PCC__3GPP__Removal__Of__Access& other_value) { if (other_value.enum_value == PCC__3GPP__Removal__Of__Access::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Removal_Of_Access to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } PCC__3GPP__Removal__Of__Access_template& PCC__3GPP__Removal__Of__Access_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (PCC__3GPP__Removal__Of__Access::enum_type)(const PCC__3GPP__Removal__Of__Access&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.PCC_3GPP_Removal_Of_Access."); } return *this; } PCC__3GPP__Removal__Of__Access_template& PCC__3GPP__Removal__Of__Access_template::operator=(const PCC__3GPP__Removal__Of__Access_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean PCC__3GPP__Removal__Of__Access_template::match(PCC__3GPP__Removal__Of__Access::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.PCC_3GPP_Removal_Of_Access."); } return FALSE; } boolean PCC__3GPP__Removal__Of__Access_template::match(const PCC__3GPP__Removal__Of__Access& other_value, boolean) const { if (other_value.enum_value == PCC__3GPP__Removal__Of__Access::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.PCC_3GPP_Removal_Of_Access with an unbound value."); return match(other_value.enum_value); } PCC__3GPP__Removal__Of__Access::enum_type PCC__3GPP__Removal__Of__Access_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.PCC_3GPP_Removal_Of_Access."); return single_value; } void PCC__3GPP__Removal__Of__Access_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.PCC_3GPP_Removal_Of_Access."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new PCC__3GPP__Removal__Of__Access_template[list_length]; } PCC__3GPP__Removal__Of__Access_template& PCC__3GPP__Removal__Of__Access_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.PCC_3GPP_Removal_Of_Access."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.PCC_3GPP_Removal_Of_Access."); return value_list.list_value[list_index]; } void PCC__3GPP__Removal__Of__Access_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(PCC__3GPP__Removal__Of__Access::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void PCC__3GPP__Removal__Of__Access_template::log_match(const PCC__3GPP__Removal__Of__Access& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void PCC__3GPP__Removal__Of__Access_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.PCC_3GPP_Removal_Of_Access."); } } void PCC__3GPP__Removal__Of__Access_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (PCC__3GPP__Removal__Of__Access::enum_type)text_buf.pull_int().get_val(); if (!PCC__3GPP__Removal__Of__Access::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.PCC_3GPP_Removal_Of_Access.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new PCC__3GPP__Removal__Of__Access_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.PCC_3GPP_Removal_Of_Access."); } } boolean PCC__3GPP__Removal__Of__Access_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean PCC__3GPP__Removal__Of__Access_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { PCC__3GPP__Removal__Of__Access_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { PCC__3GPP__Removal__Of__Access::enum_type enum_val = PCC__3GPP__Removal__Of__Access::str_to_enum(m_p->get_enumerated()); if (!PCC__3GPP__Removal__Of__Access::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.PCC_3GPP_Removal_Of_Access."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { PCC__3GPP__Removal__Of__Access_template* precondition = new PCC__3GPP__Removal__Of__Access_template; precondition->set_param(*m_p->get_elem(0)); PCC__3GPP__Removal__Of__Access_template* implied_template = new PCC__3GPP__Removal__Of__Access_template; implied_template->set_param(*m_p->get_elem(1)); *this = PCC__3GPP__Removal__Of__Access_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.PCC_3GPP_Removal_Of_Access"); } is_ifpresent = param.get_ifpresent(); } void PCC__3GPP__Removal__Of__Access_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.PCC_3GPP_Removal_Of_Access"); } DCA__3GPP__ProSe__Functionality::DCA__3GPP__ProSe__Functionality() { enum_value = UNBOUND_VALUE; } DCA__3GPP__ProSe__Functionality::DCA__3GPP__ProSe__Functionality(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Functionality with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } DCA__3GPP__ProSe__Functionality::DCA__3GPP__ProSe__Functionality(enum_type other_value) { enum_value = other_value; } DCA__3GPP__ProSe__Functionality::DCA__3GPP__ProSe__Functionality(const DCA__3GPP__ProSe__Functionality& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Functionality."); enum_value = other_value.enum_value; } DCA__3GPP__ProSe__Functionality& DCA__3GPP__ProSe__Functionality::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Functionality.", other_value); enum_value = (enum_type)other_value; return *this; } DCA__3GPP__ProSe__Functionality& DCA__3GPP__ProSe__Functionality::operator=(enum_type other_value) { enum_value = other_value; return *this; } DCA__3GPP__ProSe__Functionality& DCA__3GPP__ProSe__Functionality::operator=(const DCA__3GPP__ProSe__Functionality& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Functionality."); enum_value = other_value.enum_value; return *this; } boolean DCA__3GPP__ProSe__Functionality::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Functionality."); return enum_value == other_value; } boolean DCA__3GPP__ProSe__Functionality::operator==(const DCA__3GPP__ProSe__Functionality& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Functionality."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Functionality."); return enum_value == other_value.enum_value; } boolean DCA__3GPP__ProSe__Functionality::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Functionality."); return enum_value < other_value; } boolean DCA__3GPP__ProSe__Functionality::operator<(const DCA__3GPP__ProSe__Functionality& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Functionality."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Functionality."); return enum_value < other_value.enum_value; } boolean DCA__3GPP__ProSe__Functionality::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Functionality."); return enum_value > other_value; } boolean DCA__3GPP__ProSe__Functionality::operator>(const DCA__3GPP__ProSe__Functionality& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Functionality."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Functionality."); return enum_value > other_value.enum_value; } const char *DCA__3GPP__ProSe__Functionality::enum_to_str(enum_type enum_par) { switch (enum_par) { case DIRECT__DISCOVERY: return "DIRECT_DISCOVERY"; case EPC__LEVEL__DISCOVERY: return "EPC_LEVEL_DISCOVERY"; case DIRECT__COMMUNICATION: return "DIRECT_COMMUNICATION"; default: return ""; } } DCA__3GPP__ProSe__Functionality::enum_type DCA__3GPP__ProSe__Functionality::str_to_enum(const char *str_par) { if (!strcmp(str_par, "DIRECT_DISCOVERY")) return DIRECT__DISCOVERY; else if (!strcmp(str_par, "EPC_LEVEL_DISCOVERY")) return EPC__LEVEL__DISCOVERY; else if (!strcmp(str_par, "DIRECT_COMMUNICATION")) return DIRECT__COMMUNICATION; else return UNKNOWN_VALUE; } boolean DCA__3GPP__ProSe__Functionality::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: case 2: return TRUE; default: return FALSE; } } int DCA__3GPP__ProSe__Functionality::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Functionality.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int DCA__3GPP__ProSe__Functionality::enum2int(const DCA__3GPP__ProSe__Functionality& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Functionality.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void DCA__3GPP__ProSe__Functionality::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Functionality.", int_val); enum_value = (enum_type)int_val; } DCA__3GPP__ProSe__Functionality::operator DCA__3GPP__ProSe__Functionality::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Functionality."); return enum_value; } void DCA__3GPP__ProSe__Functionality::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void DCA__3GPP__ProSe__Functionality::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.DCA_3GPP_ProSe_Functionality"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_ProSe_Functionality."); } } void DCA__3GPP__ProSe__Functionality::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Functionality."); text_buf.push_int(enum_value); } void DCA__3GPP__ProSe__Functionality::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Functionality.", enum_value); } void DCA__3GPP__ProSe__Functionality::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void DCA__3GPP__ProSe__Functionality::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int DCA__3GPP__ProSe__Functionality::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int DCA__3GPP__ProSe__Functionality::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void DCA__3GPP__ProSe__Functionality_template::copy_template(const DCA__3GPP__ProSe__Functionality_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new DCA__3GPP__ProSe__Functionality_template[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 DCA__3GPP__ProSe__Functionality_template(*other_value.implication_.precondition); implication_.implied_template = new DCA__3GPP__ProSe__Functionality_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Functionality."); } } DCA__3GPP__ProSe__Functionality_template::DCA__3GPP__ProSe__Functionality_template() { } DCA__3GPP__ProSe__Functionality_template::DCA__3GPP__ProSe__Functionality_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } DCA__3GPP__ProSe__Functionality_template::DCA__3GPP__ProSe__Functionality_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!DCA__3GPP__ProSe__Functionality::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Functionality with unknown numeric value %d.", other_value); single_value = (DCA__3GPP__ProSe__Functionality::enum_type)other_value; } DCA__3GPP__ProSe__Functionality_template::DCA__3GPP__ProSe__Functionality_template(DCA__3GPP__ProSe__Functionality::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } DCA__3GPP__ProSe__Functionality_template::DCA__3GPP__ProSe__Functionality_template(const DCA__3GPP__ProSe__Functionality& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == DCA__3GPP__ProSe__Functionality::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Functionality."); single_value = other_value.enum_value; } DCA__3GPP__ProSe__Functionality_template::DCA__3GPP__ProSe__Functionality_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__ProSe__Functionality::enum_type)(const DCA__3GPP__ProSe__Functionality&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Functionality from an unbound optional field."); } } DCA__3GPP__ProSe__Functionality_template::DCA__3GPP__ProSe__Functionality_template(DCA__3GPP__ProSe__Functionality_template* p_precondition, DCA__3GPP__ProSe__Functionality_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } DCA__3GPP__ProSe__Functionality_template::DCA__3GPP__ProSe__Functionality_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; } DCA__3GPP__ProSe__Functionality_template::DCA__3GPP__ProSe__Functionality_template(const DCA__3GPP__ProSe__Functionality_template& other_value) : Base_Template() { copy_template(other_value); } DCA__3GPP__ProSe__Functionality_template::~DCA__3GPP__ProSe__Functionality_template() { clean_up(); } boolean DCA__3GPP__ProSe__Functionality_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean DCA__3GPP__ProSe__Functionality_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != DCA__3GPP__ProSe__Functionality::UNBOUND_VALUE; } void DCA__3GPP__ProSe__Functionality_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } DCA__3GPP__ProSe__Functionality_template& DCA__3GPP__ProSe__Functionality_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } DCA__3GPP__ProSe__Functionality_template& DCA__3GPP__ProSe__Functionality_template::operator=(int other_value) { if (!DCA__3GPP__ProSe__Functionality::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Functionality.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__ProSe__Functionality::enum_type)other_value; return *this; } DCA__3GPP__ProSe__Functionality_template& DCA__3GPP__ProSe__Functionality_template::operator=(DCA__3GPP__ProSe__Functionality::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } DCA__3GPP__ProSe__Functionality_template& DCA__3GPP__ProSe__Functionality_template::operator=(const DCA__3GPP__ProSe__Functionality& other_value) { if (other_value.enum_value == DCA__3GPP__ProSe__Functionality::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Functionality to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } DCA__3GPP__ProSe__Functionality_template& DCA__3GPP__ProSe__Functionality_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__ProSe__Functionality::enum_type)(const DCA__3GPP__ProSe__Functionality&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Functionality."); } return *this; } DCA__3GPP__ProSe__Functionality_template& DCA__3GPP__ProSe__Functionality_template::operator=(const DCA__3GPP__ProSe__Functionality_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean DCA__3GPP__ProSe__Functionality_template::match(DCA__3GPP__ProSe__Functionality::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Functionality."); } return FALSE; } boolean DCA__3GPP__ProSe__Functionality_template::match(const DCA__3GPP__ProSe__Functionality& other_value, boolean) const { if (other_value.enum_value == DCA__3GPP__ProSe__Functionality::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Functionality with an unbound value."); return match(other_value.enum_value); } DCA__3GPP__ProSe__Functionality::enum_type DCA__3GPP__ProSe__Functionality_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Functionality."); return single_value; } void DCA__3GPP__ProSe__Functionality_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Functionality."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new DCA__3GPP__ProSe__Functionality_template[list_length]; } DCA__3GPP__ProSe__Functionality_template& DCA__3GPP__ProSe__Functionality_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Functionality."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Functionality."); return value_list.list_value[list_index]; } void DCA__3GPP__ProSe__Functionality_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(DCA__3GPP__ProSe__Functionality::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void DCA__3GPP__ProSe__Functionality_template::log_match(const DCA__3GPP__ProSe__Functionality& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void DCA__3GPP__ProSe__Functionality_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Functionality."); } } void DCA__3GPP__ProSe__Functionality_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (DCA__3GPP__ProSe__Functionality::enum_type)text_buf.pull_int().get_val(); if (!DCA__3GPP__ProSe__Functionality::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Functionality.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new DCA__3GPP__ProSe__Functionality_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Functionality."); } } boolean DCA__3GPP__ProSe__Functionality_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean DCA__3GPP__ProSe__Functionality_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { DCA__3GPP__ProSe__Functionality_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { DCA__3GPP__ProSe__Functionality::enum_type enum_val = DCA__3GPP__ProSe__Functionality::str_to_enum(m_p->get_enumerated()); if (!DCA__3GPP__ProSe__Functionality::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_ProSe_Functionality."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { DCA__3GPP__ProSe__Functionality_template* precondition = new DCA__3GPP__ProSe__Functionality_template; precondition->set_param(*m_p->get_elem(0)); DCA__3GPP__ProSe__Functionality_template* implied_template = new DCA__3GPP__ProSe__Functionality_template; implied_template->set_param(*m_p->get_elem(1)); *this = DCA__3GPP__ProSe__Functionality_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.DCA_3GPP_ProSe_Functionality"); } is_ifpresent = param.get_ifpresent(); } void DCA__3GPP__ProSe__Functionality_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.DCA_3GPP_ProSe_Functionality"); } DCA__3GPP__Low__Balance__Indication::DCA__3GPP__Low__Balance__Indication() { enum_value = UNBOUND_VALUE; } DCA__3GPP__Low__Balance__Indication::DCA__3GPP__Low__Balance__Indication(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Low_Balance_Indication with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } DCA__3GPP__Low__Balance__Indication::DCA__3GPP__Low__Balance__Indication(enum_type other_value) { enum_value = other_value; } DCA__3GPP__Low__Balance__Indication::DCA__3GPP__Low__Balance__Indication(const DCA__3GPP__Low__Balance__Indication& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Low_Balance_Indication."); enum_value = other_value.enum_value; } DCA__3GPP__Low__Balance__Indication& DCA__3GPP__Low__Balance__Indication::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Low_Balance_Indication.", other_value); enum_value = (enum_type)other_value; return *this; } DCA__3GPP__Low__Balance__Indication& DCA__3GPP__Low__Balance__Indication::operator=(enum_type other_value) { enum_value = other_value; return *this; } DCA__3GPP__Low__Balance__Indication& DCA__3GPP__Low__Balance__Indication::operator=(const DCA__3GPP__Low__Balance__Indication& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Low_Balance_Indication."); enum_value = other_value.enum_value; return *this; } boolean DCA__3GPP__Low__Balance__Indication::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Low_Balance_Indication."); return enum_value == other_value; } boolean DCA__3GPP__Low__Balance__Indication::operator==(const DCA__3GPP__Low__Balance__Indication& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Low_Balance_Indication."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Low_Balance_Indication."); return enum_value == other_value.enum_value; } boolean DCA__3GPP__Low__Balance__Indication::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Low_Balance_Indication."); return enum_value < other_value; } boolean DCA__3GPP__Low__Balance__Indication::operator<(const DCA__3GPP__Low__Balance__Indication& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Low_Balance_Indication."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Low_Balance_Indication."); return enum_value < other_value.enum_value; } boolean DCA__3GPP__Low__Balance__Indication::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Low_Balance_Indication."); return enum_value > other_value; } boolean DCA__3GPP__Low__Balance__Indication::operator>(const DCA__3GPP__Low__Balance__Indication& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Low_Balance_Indication."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Low_Balance_Indication."); return enum_value > other_value.enum_value; } const char *DCA__3GPP__Low__Balance__Indication::enum_to_str(enum_type enum_par) { switch (enum_par) { case NOT__APPLICABLE: return "NOT_APPLICABLE"; case YES: return "YES"; default: return ""; } } DCA__3GPP__Low__Balance__Indication::enum_type DCA__3GPP__Low__Balance__Indication::str_to_enum(const char *str_par) { if (!strcmp(str_par, "NOT_APPLICABLE")) return NOT__APPLICABLE; else if (!strcmp(str_par, "YES")) return YES; else return UNKNOWN_VALUE; } boolean DCA__3GPP__Low__Balance__Indication::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: return TRUE; default: return FALSE; } } int DCA__3GPP__Low__Balance__Indication::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_Low_Balance_Indication.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int DCA__3GPP__Low__Balance__Indication::enum2int(const DCA__3GPP__Low__Balance__Indication& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_Low_Balance_Indication.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void DCA__3GPP__Low__Balance__Indication::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Low_Balance_Indication.", int_val); enum_value = (enum_type)int_val; } DCA__3GPP__Low__Balance__Indication::operator DCA__3GPP__Low__Balance__Indication::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.DCA_3GPP_Low_Balance_Indication."); return enum_value; } void DCA__3GPP__Low__Balance__Indication::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void DCA__3GPP__Low__Balance__Indication::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.DCA_3GPP_Low_Balance_Indication"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_Low_Balance_Indication."); } } void DCA__3GPP__Low__Balance__Indication::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Low_Balance_Indication."); text_buf.push_int(enum_value); } void DCA__3GPP__Low__Balance__Indication::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.DCA_3GPP_Low_Balance_Indication.", enum_value); } void DCA__3GPP__Low__Balance__Indication::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void DCA__3GPP__Low__Balance__Indication::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int DCA__3GPP__Low__Balance__Indication::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int DCA__3GPP__Low__Balance__Indication::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void DCA__3GPP__Low__Balance__Indication_template::copy_template(const DCA__3GPP__Low__Balance__Indication_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new DCA__3GPP__Low__Balance__Indication_template[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 DCA__3GPP__Low__Balance__Indication_template(*other_value.implication_.precondition); implication_.implied_template = new DCA__3GPP__Low__Balance__Indication_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Low_Balance_Indication."); } } DCA__3GPP__Low__Balance__Indication_template::DCA__3GPP__Low__Balance__Indication_template() { } DCA__3GPP__Low__Balance__Indication_template::DCA__3GPP__Low__Balance__Indication_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } DCA__3GPP__Low__Balance__Indication_template::DCA__3GPP__Low__Balance__Indication_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!DCA__3GPP__Low__Balance__Indication::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.DCA_3GPP_Low_Balance_Indication with unknown numeric value %d.", other_value); single_value = (DCA__3GPP__Low__Balance__Indication::enum_type)other_value; } DCA__3GPP__Low__Balance__Indication_template::DCA__3GPP__Low__Balance__Indication_template(DCA__3GPP__Low__Balance__Indication::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } DCA__3GPP__Low__Balance__Indication_template::DCA__3GPP__Low__Balance__Indication_template(const DCA__3GPP__Low__Balance__Indication& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == DCA__3GPP__Low__Balance__Indication::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Low_Balance_Indication."); single_value = other_value.enum_value; } DCA__3GPP__Low__Balance__Indication_template::DCA__3GPP__Low__Balance__Indication_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Low__Balance__Indication::enum_type)(const DCA__3GPP__Low__Balance__Indication&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.DCA_3GPP_Low_Balance_Indication from an unbound optional field."); } } DCA__3GPP__Low__Balance__Indication_template::DCA__3GPP__Low__Balance__Indication_template(DCA__3GPP__Low__Balance__Indication_template* p_precondition, DCA__3GPP__Low__Balance__Indication_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } DCA__3GPP__Low__Balance__Indication_template::DCA__3GPP__Low__Balance__Indication_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; } DCA__3GPP__Low__Balance__Indication_template::DCA__3GPP__Low__Balance__Indication_template(const DCA__3GPP__Low__Balance__Indication_template& other_value) : Base_Template() { copy_template(other_value); } DCA__3GPP__Low__Balance__Indication_template::~DCA__3GPP__Low__Balance__Indication_template() { clean_up(); } boolean DCA__3GPP__Low__Balance__Indication_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean DCA__3GPP__Low__Balance__Indication_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != DCA__3GPP__Low__Balance__Indication::UNBOUND_VALUE; } void DCA__3GPP__Low__Balance__Indication_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } DCA__3GPP__Low__Balance__Indication_template& DCA__3GPP__Low__Balance__Indication_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } DCA__3GPP__Low__Balance__Indication_template& DCA__3GPP__Low__Balance__Indication_template::operator=(int other_value) { if (!DCA__3GPP__Low__Balance__Indication::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.DCA_3GPP_Low_Balance_Indication.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Low__Balance__Indication::enum_type)other_value; return *this; } DCA__3GPP__Low__Balance__Indication_template& DCA__3GPP__Low__Balance__Indication_template::operator=(DCA__3GPP__Low__Balance__Indication::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } DCA__3GPP__Low__Balance__Indication_template& DCA__3GPP__Low__Balance__Indication_template::operator=(const DCA__3GPP__Low__Balance__Indication& other_value) { if (other_value.enum_value == DCA__3GPP__Low__Balance__Indication::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Low_Balance_Indication to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } DCA__3GPP__Low__Balance__Indication_template& DCA__3GPP__Low__Balance__Indication_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Low__Balance__Indication::enum_type)(const DCA__3GPP__Low__Balance__Indication&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.DCA_3GPP_Low_Balance_Indication."); } return *this; } DCA__3GPP__Low__Balance__Indication_template& DCA__3GPP__Low__Balance__Indication_template::operator=(const DCA__3GPP__Low__Balance__Indication_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean DCA__3GPP__Low__Balance__Indication_template::match(DCA__3GPP__Low__Balance__Indication::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Low_Balance_Indication."); } return FALSE; } boolean DCA__3GPP__Low__Balance__Indication_template::match(const DCA__3GPP__Low__Balance__Indication& other_value, boolean) const { if (other_value.enum_value == DCA__3GPP__Low__Balance__Indication::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.DCA_3GPP_Low_Balance_Indication with an unbound value."); return match(other_value.enum_value); } DCA__3GPP__Low__Balance__Indication::enum_type DCA__3GPP__Low__Balance__Indication_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.DCA_3GPP_Low_Balance_Indication."); return single_value; } void DCA__3GPP__Low__Balance__Indication_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Low_Balance_Indication."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new DCA__3GPP__Low__Balance__Indication_template[list_length]; } DCA__3GPP__Low__Balance__Indication_template& DCA__3GPP__Low__Balance__Indication_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.DCA_3GPP_Low_Balance_Indication."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.DCA_3GPP_Low_Balance_Indication."); return value_list.list_value[list_index]; } void DCA__3GPP__Low__Balance__Indication_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(DCA__3GPP__Low__Balance__Indication::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void DCA__3GPP__Low__Balance__Indication_template::log_match(const DCA__3GPP__Low__Balance__Indication& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void DCA__3GPP__Low__Balance__Indication_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Low_Balance_Indication."); } } void DCA__3GPP__Low__Balance__Indication_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (DCA__3GPP__Low__Balance__Indication::enum_type)text_buf.pull_int().get_val(); if (!DCA__3GPP__Low__Balance__Indication::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Low_Balance_Indication.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new DCA__3GPP__Low__Balance__Indication_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Low_Balance_Indication."); } } boolean DCA__3GPP__Low__Balance__Indication_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean DCA__3GPP__Low__Balance__Indication_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { DCA__3GPP__Low__Balance__Indication_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { DCA__3GPP__Low__Balance__Indication::enum_type enum_val = DCA__3GPP__Low__Balance__Indication::str_to_enum(m_p->get_enumerated()); if (!DCA__3GPP__Low__Balance__Indication::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_Low_Balance_Indication."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { DCA__3GPP__Low__Balance__Indication_template* precondition = new DCA__3GPP__Low__Balance__Indication_template; precondition->set_param(*m_p->get_elem(0)); DCA__3GPP__Low__Balance__Indication_template* implied_template = new DCA__3GPP__Low__Balance__Indication_template; implied_template->set_param(*m_p->get_elem(1)); *this = DCA__3GPP__Low__Balance__Indication_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.DCA_3GPP_Low_Balance_Indication"); } is_ifpresent = param.get_ifpresent(); } void DCA__3GPP__Low__Balance__Indication_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.DCA_3GPP_Low_Balance_Indication"); } AAA__3GPP__UE__SRVCC__Capability::AAA__3GPP__UE__SRVCC__Capability() { enum_value = UNBOUND_VALUE; } AAA__3GPP__UE__SRVCC__Capability::AAA__3GPP__UE__SRVCC__Capability(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.AAA_3GPP_UE_SRVCC_Capability with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } AAA__3GPP__UE__SRVCC__Capability::AAA__3GPP__UE__SRVCC__Capability(enum_type other_value) { enum_value = other_value; } AAA__3GPP__UE__SRVCC__Capability::AAA__3GPP__UE__SRVCC__Capability(const AAA__3GPP__UE__SRVCC__Capability& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_UE_SRVCC_Capability."); enum_value = other_value.enum_value; } AAA__3GPP__UE__SRVCC__Capability& AAA__3GPP__UE__SRVCC__Capability::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.AAA_3GPP_UE_SRVCC_Capability.", other_value); enum_value = (enum_type)other_value; return *this; } AAA__3GPP__UE__SRVCC__Capability& AAA__3GPP__UE__SRVCC__Capability::operator=(enum_type other_value) { enum_value = other_value; return *this; } AAA__3GPP__UE__SRVCC__Capability& AAA__3GPP__UE__SRVCC__Capability::operator=(const AAA__3GPP__UE__SRVCC__Capability& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_UE_SRVCC_Capability."); enum_value = other_value.enum_value; return *this; } boolean AAA__3GPP__UE__SRVCC__Capability::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_UE_SRVCC_Capability."); return enum_value == other_value; } boolean AAA__3GPP__UE__SRVCC__Capability::operator==(const AAA__3GPP__UE__SRVCC__Capability& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_UE_SRVCC_Capability."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_UE_SRVCC_Capability."); return enum_value == other_value.enum_value; } boolean AAA__3GPP__UE__SRVCC__Capability::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_UE_SRVCC_Capability."); return enum_value < other_value; } boolean AAA__3GPP__UE__SRVCC__Capability::operator<(const AAA__3GPP__UE__SRVCC__Capability& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_UE_SRVCC_Capability."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_UE_SRVCC_Capability."); return enum_value < other_value.enum_value; } boolean AAA__3GPP__UE__SRVCC__Capability::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_UE_SRVCC_Capability."); return enum_value > other_value; } boolean AAA__3GPP__UE__SRVCC__Capability::operator>(const AAA__3GPP__UE__SRVCC__Capability& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_UE_SRVCC_Capability."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_UE_SRVCC_Capability."); return enum_value > other_value.enum_value; } const char *AAA__3GPP__UE__SRVCC__Capability::enum_to_str(enum_type enum_par) { switch (enum_par) { case UE__SRVCC__NOT__SUPPORTED: return "UE_SRVCC_NOT_SUPPORTED"; case UE__SRVCC__SUPPORTED: return "UE_SRVCC_SUPPORTED"; default: return ""; } } AAA__3GPP__UE__SRVCC__Capability::enum_type AAA__3GPP__UE__SRVCC__Capability::str_to_enum(const char *str_par) { if (!strcmp(str_par, "UE_SRVCC_NOT_SUPPORTED")) return UE__SRVCC__NOT__SUPPORTED; else if (!strcmp(str_par, "UE_SRVCC_SUPPORTED")) return UE__SRVCC__SUPPORTED; else return UNKNOWN_VALUE; } boolean AAA__3GPP__UE__SRVCC__Capability::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: return TRUE; default: return FALSE; } } int AAA__3GPP__UE__SRVCC__Capability::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.AAA_3GPP_UE_SRVCC_Capability.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int AAA__3GPP__UE__SRVCC__Capability::enum2int(const AAA__3GPP__UE__SRVCC__Capability& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.AAA_3GPP_UE_SRVCC_Capability.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void AAA__3GPP__UE__SRVCC__Capability::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.AAA_3GPP_UE_SRVCC_Capability.", int_val); enum_value = (enum_type)int_val; } AAA__3GPP__UE__SRVCC__Capability::operator AAA__3GPP__UE__SRVCC__Capability::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.AAA_3GPP_UE_SRVCC_Capability."); return enum_value; } void AAA__3GPP__UE__SRVCC__Capability::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void AAA__3GPP__UE__SRVCC__Capability::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.AAA_3GPP_UE_SRVCC_Capability"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.AAA_3GPP_UE_SRVCC_Capability."); } } void AAA__3GPP__UE__SRVCC__Capability::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_UE_SRVCC_Capability."); text_buf.push_int(enum_value); } void AAA__3GPP__UE__SRVCC__Capability::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.AAA_3GPP_UE_SRVCC_Capability.", enum_value); } void AAA__3GPP__UE__SRVCC__Capability::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void AAA__3GPP__UE__SRVCC__Capability::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int AAA__3GPP__UE__SRVCC__Capability::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int AAA__3GPP__UE__SRVCC__Capability::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void AAA__3GPP__UE__SRVCC__Capability_template::copy_template(const AAA__3GPP__UE__SRVCC__Capability_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new AAA__3GPP__UE__SRVCC__Capability_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].copy_template(other_value.value_list.list_value[list_count]); break; case IMPLICATION_MATCH: implication_.precondition = new AAA__3GPP__UE__SRVCC__Capability_template(*other_value.implication_.precondition); implication_.implied_template = new AAA__3GPP__UE__SRVCC__Capability_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_UE_SRVCC_Capability."); } } AAA__3GPP__UE__SRVCC__Capability_template::AAA__3GPP__UE__SRVCC__Capability_template() { } AAA__3GPP__UE__SRVCC__Capability_template::AAA__3GPP__UE__SRVCC__Capability_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } AAA__3GPP__UE__SRVCC__Capability_template::AAA__3GPP__UE__SRVCC__Capability_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!AAA__3GPP__UE__SRVCC__Capability::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.AAA_3GPP_UE_SRVCC_Capability with unknown numeric value %d.", other_value); single_value = (AAA__3GPP__UE__SRVCC__Capability::enum_type)other_value; } AAA__3GPP__UE__SRVCC__Capability_template::AAA__3GPP__UE__SRVCC__Capability_template(AAA__3GPP__UE__SRVCC__Capability::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } AAA__3GPP__UE__SRVCC__Capability_template::AAA__3GPP__UE__SRVCC__Capability_template(const AAA__3GPP__UE__SRVCC__Capability& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == AAA__3GPP__UE__SRVCC__Capability::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_UE_SRVCC_Capability."); single_value = other_value.enum_value; } AAA__3GPP__UE__SRVCC__Capability_template::AAA__3GPP__UE__SRVCC__Capability_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__UE__SRVCC__Capability::enum_type)(const AAA__3GPP__UE__SRVCC__Capability&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.AAA_3GPP_UE_SRVCC_Capability from an unbound optional field."); } } AAA__3GPP__UE__SRVCC__Capability_template::AAA__3GPP__UE__SRVCC__Capability_template(AAA__3GPP__UE__SRVCC__Capability_template* p_precondition, AAA__3GPP__UE__SRVCC__Capability_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } AAA__3GPP__UE__SRVCC__Capability_template::AAA__3GPP__UE__SRVCC__Capability_template(Dynamic_Match_Interface* p_dyn_match) : Base_Template(DYNAMIC_MATCH) { dyn_match = new dynmatch_struct; dyn_match->ptr = p_dyn_match; dyn_match->ref_count = 1; } AAA__3GPP__UE__SRVCC__Capability_template::AAA__3GPP__UE__SRVCC__Capability_template(const AAA__3GPP__UE__SRVCC__Capability_template& other_value) : Base_Template() { copy_template(other_value); } AAA__3GPP__UE__SRVCC__Capability_template::~AAA__3GPP__UE__SRVCC__Capability_template() { clean_up(); } boolean AAA__3GPP__UE__SRVCC__Capability_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean AAA__3GPP__UE__SRVCC__Capability_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != AAA__3GPP__UE__SRVCC__Capability::UNBOUND_VALUE; } void AAA__3GPP__UE__SRVCC__Capability_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } AAA__3GPP__UE__SRVCC__Capability_template& AAA__3GPP__UE__SRVCC__Capability_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } AAA__3GPP__UE__SRVCC__Capability_template& AAA__3GPP__UE__SRVCC__Capability_template::operator=(int other_value) { if (!AAA__3GPP__UE__SRVCC__Capability::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.AAA_3GPP_UE_SRVCC_Capability.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__UE__SRVCC__Capability::enum_type)other_value; return *this; } AAA__3GPP__UE__SRVCC__Capability_template& AAA__3GPP__UE__SRVCC__Capability_template::operator=(AAA__3GPP__UE__SRVCC__Capability::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } AAA__3GPP__UE__SRVCC__Capability_template& AAA__3GPP__UE__SRVCC__Capability_template::operator=(const AAA__3GPP__UE__SRVCC__Capability& other_value) { if (other_value.enum_value == AAA__3GPP__UE__SRVCC__Capability::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_UE_SRVCC_Capability to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } AAA__3GPP__UE__SRVCC__Capability_template& AAA__3GPP__UE__SRVCC__Capability_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__UE__SRVCC__Capability::enum_type)(const AAA__3GPP__UE__SRVCC__Capability&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.AAA_3GPP_UE_SRVCC_Capability."); } return *this; } AAA__3GPP__UE__SRVCC__Capability_template& AAA__3GPP__UE__SRVCC__Capability_template::operator=(const AAA__3GPP__UE__SRVCC__Capability_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean AAA__3GPP__UE__SRVCC__Capability_template::match(AAA__3GPP__UE__SRVCC__Capability::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_UE_SRVCC_Capability."); } return FALSE; } boolean AAA__3GPP__UE__SRVCC__Capability_template::match(const AAA__3GPP__UE__SRVCC__Capability& other_value, boolean) const { if (other_value.enum_value == AAA__3GPP__UE__SRVCC__Capability::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.AAA_3GPP_UE_SRVCC_Capability with an unbound value."); return match(other_value.enum_value); } AAA__3GPP__UE__SRVCC__Capability::enum_type AAA__3GPP__UE__SRVCC__Capability_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.AAA_3GPP_UE_SRVCC_Capability."); return single_value; } void AAA__3GPP__UE__SRVCC__Capability_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.AAA_3GPP_UE_SRVCC_Capability."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new AAA__3GPP__UE__SRVCC__Capability_template[list_length]; } AAA__3GPP__UE__SRVCC__Capability_template& AAA__3GPP__UE__SRVCC__Capability_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.AAA_3GPP_UE_SRVCC_Capability."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.AAA_3GPP_UE_SRVCC_Capability."); return value_list.list_value[list_index]; } void AAA__3GPP__UE__SRVCC__Capability_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(AAA__3GPP__UE__SRVCC__Capability::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void AAA__3GPP__UE__SRVCC__Capability_template::log_match(const AAA__3GPP__UE__SRVCC__Capability& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void AAA__3GPP__UE__SRVCC__Capability_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_UE_SRVCC_Capability."); } } void AAA__3GPP__UE__SRVCC__Capability_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (AAA__3GPP__UE__SRVCC__Capability::enum_type)text_buf.pull_int().get_val(); if (!AAA__3GPP__UE__SRVCC__Capability::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.AAA_3GPP_UE_SRVCC_Capability.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new AAA__3GPP__UE__SRVCC__Capability_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.AAA_3GPP_UE_SRVCC_Capability."); } } boolean AAA__3GPP__UE__SRVCC__Capability_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean AAA__3GPP__UE__SRVCC__Capability_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { AAA__3GPP__UE__SRVCC__Capability_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { AAA__3GPP__UE__SRVCC__Capability::enum_type enum_val = AAA__3GPP__UE__SRVCC__Capability::str_to_enum(m_p->get_enumerated()); if (!AAA__3GPP__UE__SRVCC__Capability::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.AAA_3GPP_UE_SRVCC_Capability."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { AAA__3GPP__UE__SRVCC__Capability_template* precondition = new AAA__3GPP__UE__SRVCC__Capability_template; precondition->set_param(*m_p->get_elem(0)); AAA__3GPP__UE__SRVCC__Capability_template* implied_template = new AAA__3GPP__UE__SRVCC__Capability_template; implied_template->set_param(*m_p->get_elem(1)); *this = AAA__3GPP__UE__SRVCC__Capability_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.AAA_3GPP_UE_SRVCC_Capability"); } is_ifpresent = param.get_ifpresent(); } void AAA__3GPP__UE__SRVCC__Capability_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.AAA_3GPP_UE_SRVCC_Capability"); } DCA__3GPP__SDP__Type::DCA__3GPP__SDP__Type() { enum_value = UNBOUND_VALUE; } DCA__3GPP__SDP__Type::DCA__3GPP__SDP__Type(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.DCA_3GPP_SDP_Type with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } DCA__3GPP__SDP__Type::DCA__3GPP__SDP__Type(enum_type other_value) { enum_value = other_value; } DCA__3GPP__SDP__Type::DCA__3GPP__SDP__Type(const DCA__3GPP__SDP__Type& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_SDP_Type."); enum_value = other_value.enum_value; } DCA__3GPP__SDP__Type& DCA__3GPP__SDP__Type::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_SDP_Type.", other_value); enum_value = (enum_type)other_value; return *this; } DCA__3GPP__SDP__Type& DCA__3GPP__SDP__Type::operator=(enum_type other_value) { enum_value = other_value; return *this; } DCA__3GPP__SDP__Type& DCA__3GPP__SDP__Type::operator=(const DCA__3GPP__SDP__Type& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_SDP_Type."); enum_value = other_value.enum_value; return *this; } boolean DCA__3GPP__SDP__Type::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_SDP_Type."); return enum_value == other_value; } boolean DCA__3GPP__SDP__Type::operator==(const DCA__3GPP__SDP__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_SDP_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_SDP_Type."); return enum_value == other_value.enum_value; } boolean DCA__3GPP__SDP__Type::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_SDP_Type."); return enum_value < other_value; } boolean DCA__3GPP__SDP__Type::operator<(const DCA__3GPP__SDP__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_SDP_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_SDP_Type."); return enum_value < other_value.enum_value; } boolean DCA__3GPP__SDP__Type::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_SDP_Type."); return enum_value > other_value; } boolean DCA__3GPP__SDP__Type::operator>(const DCA__3GPP__SDP__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_SDP_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_SDP_Type."); return enum_value > other_value.enum_value; } const char *DCA__3GPP__SDP__Type::enum_to_str(enum_type enum_par) { switch (enum_par) { case SDP__OFFER: return "SDP_OFFER"; case SDP__ANSWER: return "SDP_ANSWER"; default: return ""; } } DCA__3GPP__SDP__Type::enum_type DCA__3GPP__SDP__Type::str_to_enum(const char *str_par) { if (!strcmp(str_par, "SDP_OFFER")) return SDP__OFFER; else if (!strcmp(str_par, "SDP_ANSWER")) return SDP__ANSWER; else return UNKNOWN_VALUE; } boolean DCA__3GPP__SDP__Type::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: return TRUE; default: return FALSE; } } int DCA__3GPP__SDP__Type::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_SDP_Type.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int DCA__3GPP__SDP__Type::enum2int(const DCA__3GPP__SDP__Type& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_SDP_Type.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void DCA__3GPP__SDP__Type::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_SDP_Type.", int_val); enum_value = (enum_type)int_val; } DCA__3GPP__SDP__Type::operator DCA__3GPP__SDP__Type::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.DCA_3GPP_SDP_Type."); return enum_value; } void DCA__3GPP__SDP__Type::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void DCA__3GPP__SDP__Type::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.DCA_3GPP_SDP_Type"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_SDP_Type."); } } void DCA__3GPP__SDP__Type::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_SDP_Type."); text_buf.push_int(enum_value); } void DCA__3GPP__SDP__Type::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.DCA_3GPP_SDP_Type.", enum_value); } void DCA__3GPP__SDP__Type::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void DCA__3GPP__SDP__Type::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int DCA__3GPP__SDP__Type::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int DCA__3GPP__SDP__Type::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void DCA__3GPP__SDP__Type_template::copy_template(const DCA__3GPP__SDP__Type_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new DCA__3GPP__SDP__Type_template[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 DCA__3GPP__SDP__Type_template(*other_value.implication_.precondition); implication_.implied_template = new DCA__3GPP__SDP__Type_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_SDP_Type."); } } DCA__3GPP__SDP__Type_template::DCA__3GPP__SDP__Type_template() { } DCA__3GPP__SDP__Type_template::DCA__3GPP__SDP__Type_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } DCA__3GPP__SDP__Type_template::DCA__3GPP__SDP__Type_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!DCA__3GPP__SDP__Type::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.DCA_3GPP_SDP_Type with unknown numeric value %d.", other_value); single_value = (DCA__3GPP__SDP__Type::enum_type)other_value; } DCA__3GPP__SDP__Type_template::DCA__3GPP__SDP__Type_template(DCA__3GPP__SDP__Type::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } DCA__3GPP__SDP__Type_template::DCA__3GPP__SDP__Type_template(const DCA__3GPP__SDP__Type& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == DCA__3GPP__SDP__Type::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_SDP_Type."); single_value = other_value.enum_value; } DCA__3GPP__SDP__Type_template::DCA__3GPP__SDP__Type_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__SDP__Type::enum_type)(const DCA__3GPP__SDP__Type&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.DCA_3GPP_SDP_Type from an unbound optional field."); } } DCA__3GPP__SDP__Type_template::DCA__3GPP__SDP__Type_template(DCA__3GPP__SDP__Type_template* p_precondition, DCA__3GPP__SDP__Type_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } DCA__3GPP__SDP__Type_template::DCA__3GPP__SDP__Type_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; } DCA__3GPP__SDP__Type_template::DCA__3GPP__SDP__Type_template(const DCA__3GPP__SDP__Type_template& other_value) : Base_Template() { copy_template(other_value); } DCA__3GPP__SDP__Type_template::~DCA__3GPP__SDP__Type_template() { clean_up(); } boolean DCA__3GPP__SDP__Type_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean DCA__3GPP__SDP__Type_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != DCA__3GPP__SDP__Type::UNBOUND_VALUE; } void DCA__3GPP__SDP__Type_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } DCA__3GPP__SDP__Type_template& DCA__3GPP__SDP__Type_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } DCA__3GPP__SDP__Type_template& DCA__3GPP__SDP__Type_template::operator=(int other_value) { if (!DCA__3GPP__SDP__Type::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.DCA_3GPP_SDP_Type.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__SDP__Type::enum_type)other_value; return *this; } DCA__3GPP__SDP__Type_template& DCA__3GPP__SDP__Type_template::operator=(DCA__3GPP__SDP__Type::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } DCA__3GPP__SDP__Type_template& DCA__3GPP__SDP__Type_template::operator=(const DCA__3GPP__SDP__Type& other_value) { if (other_value.enum_value == DCA__3GPP__SDP__Type::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_SDP_Type to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } DCA__3GPP__SDP__Type_template& DCA__3GPP__SDP__Type_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__SDP__Type::enum_type)(const DCA__3GPP__SDP__Type&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.DCA_3GPP_SDP_Type."); } return *this; } DCA__3GPP__SDP__Type_template& DCA__3GPP__SDP__Type_template::operator=(const DCA__3GPP__SDP__Type_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean DCA__3GPP__SDP__Type_template::match(DCA__3GPP__SDP__Type::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_SDP_Type."); } return FALSE; } boolean DCA__3GPP__SDP__Type_template::match(const DCA__3GPP__SDP__Type& other_value, boolean) const { if (other_value.enum_value == DCA__3GPP__SDP__Type::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.DCA_3GPP_SDP_Type with an unbound value."); return match(other_value.enum_value); } DCA__3GPP__SDP__Type::enum_type DCA__3GPP__SDP__Type_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.DCA_3GPP_SDP_Type."); return single_value; } void DCA__3GPP__SDP__Type_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.DCA_3GPP_SDP_Type."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new DCA__3GPP__SDP__Type_template[list_length]; } DCA__3GPP__SDP__Type_template& DCA__3GPP__SDP__Type_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.DCA_3GPP_SDP_Type."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.DCA_3GPP_SDP_Type."); return value_list.list_value[list_index]; } void DCA__3GPP__SDP__Type_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(DCA__3GPP__SDP__Type::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void DCA__3GPP__SDP__Type_template::log_match(const DCA__3GPP__SDP__Type& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void DCA__3GPP__SDP__Type_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_SDP_Type."); } } void DCA__3GPP__SDP__Type_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (DCA__3GPP__SDP__Type::enum_type)text_buf.pull_int().get_val(); if (!DCA__3GPP__SDP__Type::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_SDP_Type.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new DCA__3GPP__SDP__Type_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_SDP_Type."); } } boolean DCA__3GPP__SDP__Type_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean DCA__3GPP__SDP__Type_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { DCA__3GPP__SDP__Type_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { DCA__3GPP__SDP__Type::enum_type enum_val = DCA__3GPP__SDP__Type::str_to_enum(m_p->get_enumerated()); if (!DCA__3GPP__SDP__Type::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_SDP_Type."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { DCA__3GPP__SDP__Type_template* precondition = new DCA__3GPP__SDP__Type_template; precondition->set_param(*m_p->get_elem(0)); DCA__3GPP__SDP__Type_template* implied_template = new DCA__3GPP__SDP__Type_template; implied_template->set_param(*m_p->get_elem(1)); *this = DCA__3GPP__SDP__Type_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.DCA_3GPP_SDP_Type"); } is_ifpresent = param.get_ifpresent(); } void DCA__3GPP__SDP__Type_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.DCA_3GPP_SDP_Type"); } DNAS__NONE__Acct__Authentic::DNAS__NONE__Acct__Authentic() { enum_value = UNBOUND_VALUE; } DNAS__NONE__Acct__Authentic::DNAS__NONE__Acct__Authentic(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.DNAS_NONE_Acct_Authentic with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } DNAS__NONE__Acct__Authentic::DNAS__NONE__Acct__Authentic(enum_type other_value) { enum_value = other_value; } DNAS__NONE__Acct__Authentic::DNAS__NONE__Acct__Authentic(const DNAS__NONE__Acct__Authentic& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Acct_Authentic."); enum_value = other_value.enum_value; } DNAS__NONE__Acct__Authentic& DNAS__NONE__Acct__Authentic::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.DNAS_NONE_Acct_Authentic.", other_value); enum_value = (enum_type)other_value; return *this; } DNAS__NONE__Acct__Authentic& DNAS__NONE__Acct__Authentic::operator=(enum_type other_value) { enum_value = other_value; return *this; } DNAS__NONE__Acct__Authentic& DNAS__NONE__Acct__Authentic::operator=(const DNAS__NONE__Acct__Authentic& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Acct_Authentic."); enum_value = other_value.enum_value; return *this; } boolean DNAS__NONE__Acct__Authentic::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Acct_Authentic."); return enum_value == other_value; } boolean DNAS__NONE__Acct__Authentic::operator==(const DNAS__NONE__Acct__Authentic& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Acct_Authentic."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Acct_Authentic."); return enum_value == other_value.enum_value; } boolean DNAS__NONE__Acct__Authentic::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Acct_Authentic."); return enum_value < other_value; } boolean DNAS__NONE__Acct__Authentic::operator<(const DNAS__NONE__Acct__Authentic& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Acct_Authentic."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Acct_Authentic."); return enum_value < other_value.enum_value; } boolean DNAS__NONE__Acct__Authentic::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Acct_Authentic."); return enum_value > other_value; } boolean DNAS__NONE__Acct__Authentic::operator>(const DNAS__NONE__Acct__Authentic& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Acct_Authentic."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Acct_Authentic."); return enum_value > other_value.enum_value; } const char *DNAS__NONE__Acct__Authentic::enum_to_str(enum_type enum_par) { switch (enum_par) { case RADIUS: return "RADIUS"; case LOCAL: return "LOCAL"; case REMOTE: return "REMOTE"; case DIAMETER: return "DIAMETER"; default: return ""; } } DNAS__NONE__Acct__Authentic::enum_type DNAS__NONE__Acct__Authentic::str_to_enum(const char *str_par) { if (!strcmp(str_par, "RADIUS")) return RADIUS; else if (!strcmp(str_par, "LOCAL")) return LOCAL; else if (!strcmp(str_par, "REMOTE")) return REMOTE; else if (!strcmp(str_par, "DIAMETER")) return DIAMETER; else return UNKNOWN_VALUE; } boolean DNAS__NONE__Acct__Authentic::is_valid_enum(int int_par) { switch (int_par) { case 1: case 2: case 3: case 4: return TRUE; default: return FALSE; } } int DNAS__NONE__Acct__Authentic::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DNAS_NONE_Acct_Authentic.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int DNAS__NONE__Acct__Authentic::enum2int(const DNAS__NONE__Acct__Authentic& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DNAS_NONE_Acct_Authentic.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void DNAS__NONE__Acct__Authentic::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.DNAS_NONE_Acct_Authentic.", int_val); enum_value = (enum_type)int_val; } DNAS__NONE__Acct__Authentic::operator DNAS__NONE__Acct__Authentic::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.DNAS_NONE_Acct_Authentic."); return enum_value; } void DNAS__NONE__Acct__Authentic::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void DNAS__NONE__Acct__Authentic::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.DNAS_NONE_Acct_Authentic"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DNAS_NONE_Acct_Authentic."); } } void DNAS__NONE__Acct__Authentic::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Acct_Authentic."); text_buf.push_int(enum_value); } void DNAS__NONE__Acct__Authentic::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.DNAS_NONE_Acct_Authentic.", enum_value); } void DNAS__NONE__Acct__Authentic::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void DNAS__NONE__Acct__Authentic::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int DNAS__NONE__Acct__Authentic::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 3, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int DNAS__NONE__Acct__Authentic::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 3); } void DNAS__NONE__Acct__Authentic_template::copy_template(const DNAS__NONE__Acct__Authentic_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new DNAS__NONE__Acct__Authentic_template[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 DNAS__NONE__Acct__Authentic_template(*other_value.implication_.precondition); implication_.implied_template = new DNAS__NONE__Acct__Authentic_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DNAS_NONE_Acct_Authentic."); } } DNAS__NONE__Acct__Authentic_template::DNAS__NONE__Acct__Authentic_template() { } DNAS__NONE__Acct__Authentic_template::DNAS__NONE__Acct__Authentic_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } DNAS__NONE__Acct__Authentic_template::DNAS__NONE__Acct__Authentic_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!DNAS__NONE__Acct__Authentic::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.DNAS_NONE_Acct_Authentic with unknown numeric value %d.", other_value); single_value = (DNAS__NONE__Acct__Authentic::enum_type)other_value; } DNAS__NONE__Acct__Authentic_template::DNAS__NONE__Acct__Authentic_template(DNAS__NONE__Acct__Authentic::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } DNAS__NONE__Acct__Authentic_template::DNAS__NONE__Acct__Authentic_template(const DNAS__NONE__Acct__Authentic& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == DNAS__NONE__Acct__Authentic::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Acct_Authentic."); single_value = other_value.enum_value; } DNAS__NONE__Acct__Authentic_template::DNAS__NONE__Acct__Authentic_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DNAS__NONE__Acct__Authentic::enum_type)(const DNAS__NONE__Acct__Authentic&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.DNAS_NONE_Acct_Authentic from an unbound optional field."); } } DNAS__NONE__Acct__Authentic_template::DNAS__NONE__Acct__Authentic_template(DNAS__NONE__Acct__Authentic_template* p_precondition, DNAS__NONE__Acct__Authentic_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } DNAS__NONE__Acct__Authentic_template::DNAS__NONE__Acct__Authentic_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; } DNAS__NONE__Acct__Authentic_template::DNAS__NONE__Acct__Authentic_template(const DNAS__NONE__Acct__Authentic_template& other_value) : Base_Template() { copy_template(other_value); } DNAS__NONE__Acct__Authentic_template::~DNAS__NONE__Acct__Authentic_template() { clean_up(); } boolean DNAS__NONE__Acct__Authentic_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean DNAS__NONE__Acct__Authentic_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != DNAS__NONE__Acct__Authentic::UNBOUND_VALUE; } void DNAS__NONE__Acct__Authentic_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } DNAS__NONE__Acct__Authentic_template& DNAS__NONE__Acct__Authentic_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } DNAS__NONE__Acct__Authentic_template& DNAS__NONE__Acct__Authentic_template::operator=(int other_value) { if (!DNAS__NONE__Acct__Authentic::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.DNAS_NONE_Acct_Authentic.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (DNAS__NONE__Acct__Authentic::enum_type)other_value; return *this; } DNAS__NONE__Acct__Authentic_template& DNAS__NONE__Acct__Authentic_template::operator=(DNAS__NONE__Acct__Authentic::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } DNAS__NONE__Acct__Authentic_template& DNAS__NONE__Acct__Authentic_template::operator=(const DNAS__NONE__Acct__Authentic& other_value) { if (other_value.enum_value == DNAS__NONE__Acct__Authentic::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Acct_Authentic to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } DNAS__NONE__Acct__Authentic_template& DNAS__NONE__Acct__Authentic_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DNAS__NONE__Acct__Authentic::enum_type)(const DNAS__NONE__Acct__Authentic&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.DNAS_NONE_Acct_Authentic."); } return *this; } DNAS__NONE__Acct__Authentic_template& DNAS__NONE__Acct__Authentic_template::operator=(const DNAS__NONE__Acct__Authentic_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean DNAS__NONE__Acct__Authentic_template::match(DNAS__NONE__Acct__Authentic::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DNAS_NONE_Acct_Authentic."); } return FALSE; } boolean DNAS__NONE__Acct__Authentic_template::match(const DNAS__NONE__Acct__Authentic& other_value, boolean) const { if (other_value.enum_value == DNAS__NONE__Acct__Authentic::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.DNAS_NONE_Acct_Authentic with an unbound value."); return match(other_value.enum_value); } DNAS__NONE__Acct__Authentic::enum_type DNAS__NONE__Acct__Authentic_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.DNAS_NONE_Acct_Authentic."); return single_value; } void DNAS__NONE__Acct__Authentic_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.DNAS_NONE_Acct_Authentic."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new DNAS__NONE__Acct__Authentic_template[list_length]; } DNAS__NONE__Acct__Authentic_template& DNAS__NONE__Acct__Authentic_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.DNAS_NONE_Acct_Authentic."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.DNAS_NONE_Acct_Authentic."); return value_list.list_value[list_index]; } void DNAS__NONE__Acct__Authentic_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(DNAS__NONE__Acct__Authentic::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void DNAS__NONE__Acct__Authentic_template::log_match(const DNAS__NONE__Acct__Authentic& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void DNAS__NONE__Acct__Authentic_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DNAS_NONE_Acct_Authentic."); } } void DNAS__NONE__Acct__Authentic_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (DNAS__NONE__Acct__Authentic::enum_type)text_buf.pull_int().get_val(); if (!DNAS__NONE__Acct__Authentic::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.DNAS_NONE_Acct_Authentic.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new DNAS__NONE__Acct__Authentic_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.DNAS_NONE_Acct_Authentic."); } } boolean DNAS__NONE__Acct__Authentic_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean DNAS__NONE__Acct__Authentic_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { DNAS__NONE__Acct__Authentic_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { DNAS__NONE__Acct__Authentic::enum_type enum_val = DNAS__NONE__Acct__Authentic::str_to_enum(m_p->get_enumerated()); if (!DNAS__NONE__Acct__Authentic::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DNAS_NONE_Acct_Authentic."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { DNAS__NONE__Acct__Authentic_template* precondition = new DNAS__NONE__Acct__Authentic_template; precondition->set_param(*m_p->get_elem(0)); DNAS__NONE__Acct__Authentic_template* implied_template = new DNAS__NONE__Acct__Authentic_template; implied_template->set_param(*m_p->get_elem(1)); *this = DNAS__NONE__Acct__Authentic_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.DNAS_NONE_Acct_Authentic"); } is_ifpresent = param.get_ifpresent(); } void DNAS__NONE__Acct__Authentic_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.DNAS_NONE_Acct_Authentic"); } DCA__3GPP__Delivery__Report__Requested::DCA__3GPP__Delivery__Report__Requested() { enum_value = UNBOUND_VALUE; } DCA__3GPP__Delivery__Report__Requested::DCA__3GPP__Delivery__Report__Requested(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Delivery_Report_Requested with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } DCA__3GPP__Delivery__Report__Requested::DCA__3GPP__Delivery__Report__Requested(enum_type other_value) { enum_value = other_value; } DCA__3GPP__Delivery__Report__Requested::DCA__3GPP__Delivery__Report__Requested(const DCA__3GPP__Delivery__Report__Requested& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Delivery_Report_Requested."); enum_value = other_value.enum_value; } DCA__3GPP__Delivery__Report__Requested& DCA__3GPP__Delivery__Report__Requested::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Delivery_Report_Requested.", other_value); enum_value = (enum_type)other_value; return *this; } DCA__3GPP__Delivery__Report__Requested& DCA__3GPP__Delivery__Report__Requested::operator=(enum_type other_value) { enum_value = other_value; return *this; } DCA__3GPP__Delivery__Report__Requested& DCA__3GPP__Delivery__Report__Requested::operator=(const DCA__3GPP__Delivery__Report__Requested& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Delivery_Report_Requested."); enum_value = other_value.enum_value; return *this; } boolean DCA__3GPP__Delivery__Report__Requested::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Delivery_Report_Requested."); return enum_value == other_value; } boolean DCA__3GPP__Delivery__Report__Requested::operator==(const DCA__3GPP__Delivery__Report__Requested& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Delivery_Report_Requested."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Delivery_Report_Requested."); return enum_value == other_value.enum_value; } boolean DCA__3GPP__Delivery__Report__Requested::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Delivery_Report_Requested."); return enum_value < other_value; } boolean DCA__3GPP__Delivery__Report__Requested::operator<(const DCA__3GPP__Delivery__Report__Requested& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Delivery_Report_Requested."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Delivery_Report_Requested."); return enum_value < other_value.enum_value; } boolean DCA__3GPP__Delivery__Report__Requested::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Delivery_Report_Requested."); return enum_value > other_value; } boolean DCA__3GPP__Delivery__Report__Requested::operator>(const DCA__3GPP__Delivery__Report__Requested& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Delivery_Report_Requested."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Delivery_Report_Requested."); return enum_value > other_value.enum_value; } const char *DCA__3GPP__Delivery__Report__Requested::enum_to_str(enum_type enum_par) { switch (enum_par) { case NO: return "NO"; case YES: return "YES"; default: return ""; } } DCA__3GPP__Delivery__Report__Requested::enum_type DCA__3GPP__Delivery__Report__Requested::str_to_enum(const char *str_par) { if (!strcmp(str_par, "NO")) return NO; else if (!strcmp(str_par, "YES")) return YES; else return UNKNOWN_VALUE; } boolean DCA__3GPP__Delivery__Report__Requested::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: return TRUE; default: return FALSE; } } int DCA__3GPP__Delivery__Report__Requested::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_Delivery_Report_Requested.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int DCA__3GPP__Delivery__Report__Requested::enum2int(const DCA__3GPP__Delivery__Report__Requested& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_Delivery_Report_Requested.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void DCA__3GPP__Delivery__Report__Requested::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Delivery_Report_Requested.", int_val); enum_value = (enum_type)int_val; } DCA__3GPP__Delivery__Report__Requested::operator DCA__3GPP__Delivery__Report__Requested::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.DCA_3GPP_Delivery_Report_Requested."); return enum_value; } void DCA__3GPP__Delivery__Report__Requested::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void DCA__3GPP__Delivery__Report__Requested::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.DCA_3GPP_Delivery_Report_Requested"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_Delivery_Report_Requested."); } } void DCA__3GPP__Delivery__Report__Requested::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Delivery_Report_Requested."); text_buf.push_int(enum_value); } void DCA__3GPP__Delivery__Report__Requested::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.DCA_3GPP_Delivery_Report_Requested.", enum_value); } void DCA__3GPP__Delivery__Report__Requested::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void DCA__3GPP__Delivery__Report__Requested::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int DCA__3GPP__Delivery__Report__Requested::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int DCA__3GPP__Delivery__Report__Requested::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void DCA__3GPP__Delivery__Report__Requested_template::copy_template(const DCA__3GPP__Delivery__Report__Requested_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new DCA__3GPP__Delivery__Report__Requested_template[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 DCA__3GPP__Delivery__Report__Requested_template(*other_value.implication_.precondition); implication_.implied_template = new DCA__3GPP__Delivery__Report__Requested_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Delivery_Report_Requested."); } } DCA__3GPP__Delivery__Report__Requested_template::DCA__3GPP__Delivery__Report__Requested_template() { } DCA__3GPP__Delivery__Report__Requested_template::DCA__3GPP__Delivery__Report__Requested_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } DCA__3GPP__Delivery__Report__Requested_template::DCA__3GPP__Delivery__Report__Requested_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!DCA__3GPP__Delivery__Report__Requested::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.DCA_3GPP_Delivery_Report_Requested with unknown numeric value %d.", other_value); single_value = (DCA__3GPP__Delivery__Report__Requested::enum_type)other_value; } DCA__3GPP__Delivery__Report__Requested_template::DCA__3GPP__Delivery__Report__Requested_template(DCA__3GPP__Delivery__Report__Requested::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } DCA__3GPP__Delivery__Report__Requested_template::DCA__3GPP__Delivery__Report__Requested_template(const DCA__3GPP__Delivery__Report__Requested& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == DCA__3GPP__Delivery__Report__Requested::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Delivery_Report_Requested."); single_value = other_value.enum_value; } DCA__3GPP__Delivery__Report__Requested_template::DCA__3GPP__Delivery__Report__Requested_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Delivery__Report__Requested::enum_type)(const DCA__3GPP__Delivery__Report__Requested&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.DCA_3GPP_Delivery_Report_Requested from an unbound optional field."); } } DCA__3GPP__Delivery__Report__Requested_template::DCA__3GPP__Delivery__Report__Requested_template(DCA__3GPP__Delivery__Report__Requested_template* p_precondition, DCA__3GPP__Delivery__Report__Requested_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } DCA__3GPP__Delivery__Report__Requested_template::DCA__3GPP__Delivery__Report__Requested_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; } DCA__3GPP__Delivery__Report__Requested_template::DCA__3GPP__Delivery__Report__Requested_template(const DCA__3GPP__Delivery__Report__Requested_template& other_value) : Base_Template() { copy_template(other_value); } DCA__3GPP__Delivery__Report__Requested_template::~DCA__3GPP__Delivery__Report__Requested_template() { clean_up(); } boolean DCA__3GPP__Delivery__Report__Requested_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean DCA__3GPP__Delivery__Report__Requested_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != DCA__3GPP__Delivery__Report__Requested::UNBOUND_VALUE; } void DCA__3GPP__Delivery__Report__Requested_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } DCA__3GPP__Delivery__Report__Requested_template& DCA__3GPP__Delivery__Report__Requested_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } DCA__3GPP__Delivery__Report__Requested_template& DCA__3GPP__Delivery__Report__Requested_template::operator=(int other_value) { if (!DCA__3GPP__Delivery__Report__Requested::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.DCA_3GPP_Delivery_Report_Requested.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Delivery__Report__Requested::enum_type)other_value; return *this; } DCA__3GPP__Delivery__Report__Requested_template& DCA__3GPP__Delivery__Report__Requested_template::operator=(DCA__3GPP__Delivery__Report__Requested::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } DCA__3GPP__Delivery__Report__Requested_template& DCA__3GPP__Delivery__Report__Requested_template::operator=(const DCA__3GPP__Delivery__Report__Requested& other_value) { if (other_value.enum_value == DCA__3GPP__Delivery__Report__Requested::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Delivery_Report_Requested to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } DCA__3GPP__Delivery__Report__Requested_template& DCA__3GPP__Delivery__Report__Requested_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Delivery__Report__Requested::enum_type)(const DCA__3GPP__Delivery__Report__Requested&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.DCA_3GPP_Delivery_Report_Requested."); } return *this; } DCA__3GPP__Delivery__Report__Requested_template& DCA__3GPP__Delivery__Report__Requested_template::operator=(const DCA__3GPP__Delivery__Report__Requested_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean DCA__3GPP__Delivery__Report__Requested_template::match(DCA__3GPP__Delivery__Report__Requested::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Delivery_Report_Requested."); } return FALSE; } boolean DCA__3GPP__Delivery__Report__Requested_template::match(const DCA__3GPP__Delivery__Report__Requested& other_value, boolean) const { if (other_value.enum_value == DCA__3GPP__Delivery__Report__Requested::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.DCA_3GPP_Delivery_Report_Requested with an unbound value."); return match(other_value.enum_value); } DCA__3GPP__Delivery__Report__Requested::enum_type DCA__3GPP__Delivery__Report__Requested_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.DCA_3GPP_Delivery_Report_Requested."); return single_value; } void DCA__3GPP__Delivery__Report__Requested_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Delivery_Report_Requested."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new DCA__3GPP__Delivery__Report__Requested_template[list_length]; } DCA__3GPP__Delivery__Report__Requested_template& DCA__3GPP__Delivery__Report__Requested_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.DCA_3GPP_Delivery_Report_Requested."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.DCA_3GPP_Delivery_Report_Requested."); return value_list.list_value[list_index]; } void DCA__3GPP__Delivery__Report__Requested_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(DCA__3GPP__Delivery__Report__Requested::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void DCA__3GPP__Delivery__Report__Requested_template::log_match(const DCA__3GPP__Delivery__Report__Requested& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void DCA__3GPP__Delivery__Report__Requested_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Delivery_Report_Requested."); } } void DCA__3GPP__Delivery__Report__Requested_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (DCA__3GPP__Delivery__Report__Requested::enum_type)text_buf.pull_int().get_val(); if (!DCA__3GPP__Delivery__Report__Requested::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Delivery_Report_Requested.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new DCA__3GPP__Delivery__Report__Requested_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Delivery_Report_Requested."); } } boolean DCA__3GPP__Delivery__Report__Requested_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean DCA__3GPP__Delivery__Report__Requested_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { DCA__3GPP__Delivery__Report__Requested_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { DCA__3GPP__Delivery__Report__Requested::enum_type enum_val = DCA__3GPP__Delivery__Report__Requested::str_to_enum(m_p->get_enumerated()); if (!DCA__3GPP__Delivery__Report__Requested::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_Delivery_Report_Requested."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { DCA__3GPP__Delivery__Report__Requested_template* precondition = new DCA__3GPP__Delivery__Report__Requested_template; precondition->set_param(*m_p->get_elem(0)); DCA__3GPP__Delivery__Report__Requested_template* implied_template = new DCA__3GPP__Delivery__Report__Requested_template; implied_template->set_param(*m_p->get_elem(1)); *this = DCA__3GPP__Delivery__Report__Requested_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.DCA_3GPP_Delivery_Report_Requested"); } is_ifpresent = param.get_ifpresent(); } void DCA__3GPP__Delivery__Report__Requested_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.DCA_3GPP_Delivery_Report_Requested"); } PCC__3GPP__NBIFOM__Mode::PCC__3GPP__NBIFOM__Mode() { enum_value = UNBOUND_VALUE; } PCC__3GPP__NBIFOM__Mode::PCC__3GPP__NBIFOM__Mode(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.PCC_3GPP_NBIFOM_Mode with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } PCC__3GPP__NBIFOM__Mode::PCC__3GPP__NBIFOM__Mode(enum_type other_value) { enum_value = other_value; } PCC__3GPP__NBIFOM__Mode::PCC__3GPP__NBIFOM__Mode(const PCC__3GPP__NBIFOM__Mode& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_NBIFOM_Mode."); enum_value = other_value.enum_value; } PCC__3GPP__NBIFOM__Mode& PCC__3GPP__NBIFOM__Mode::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.PCC_3GPP_NBIFOM_Mode.", other_value); enum_value = (enum_type)other_value; return *this; } PCC__3GPP__NBIFOM__Mode& PCC__3GPP__NBIFOM__Mode::operator=(enum_type other_value) { enum_value = other_value; return *this; } PCC__3GPP__NBIFOM__Mode& PCC__3GPP__NBIFOM__Mode::operator=(const PCC__3GPP__NBIFOM__Mode& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_NBIFOM_Mode."); enum_value = other_value.enum_value; return *this; } boolean PCC__3GPP__NBIFOM__Mode::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_NBIFOM_Mode."); return enum_value == other_value; } boolean PCC__3GPP__NBIFOM__Mode::operator==(const PCC__3GPP__NBIFOM__Mode& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_NBIFOM_Mode."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_NBIFOM_Mode."); return enum_value == other_value.enum_value; } boolean PCC__3GPP__NBIFOM__Mode::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_NBIFOM_Mode."); return enum_value < other_value; } boolean PCC__3GPP__NBIFOM__Mode::operator<(const PCC__3GPP__NBIFOM__Mode& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_NBIFOM_Mode."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_NBIFOM_Mode."); return enum_value < other_value.enum_value; } boolean PCC__3GPP__NBIFOM__Mode::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_NBIFOM_Mode."); return enum_value > other_value; } boolean PCC__3GPP__NBIFOM__Mode::operator>(const PCC__3GPP__NBIFOM__Mode& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_NBIFOM_Mode."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_NBIFOM_Mode."); return enum_value > other_value.enum_value; } const char *PCC__3GPP__NBIFOM__Mode::enum_to_str(enum_type enum_par) { switch (enum_par) { case UE__INITIATED: return "UE_INITIATED"; case NETWORK__INITIATED: return "NETWORK_INITIATED"; default: return ""; } } PCC__3GPP__NBIFOM__Mode::enum_type PCC__3GPP__NBIFOM__Mode::str_to_enum(const char *str_par) { if (!strcmp(str_par, "UE_INITIATED")) return UE__INITIATED; else if (!strcmp(str_par, "NETWORK_INITIATED")) return NETWORK__INITIATED; else return UNKNOWN_VALUE; } boolean PCC__3GPP__NBIFOM__Mode::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: return TRUE; default: return FALSE; } } int PCC__3GPP__NBIFOM__Mode::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.PCC_3GPP_NBIFOM_Mode.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int PCC__3GPP__NBIFOM__Mode::enum2int(const PCC__3GPP__NBIFOM__Mode& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.PCC_3GPP_NBIFOM_Mode.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void PCC__3GPP__NBIFOM__Mode::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.PCC_3GPP_NBIFOM_Mode.", int_val); enum_value = (enum_type)int_val; } PCC__3GPP__NBIFOM__Mode::operator PCC__3GPP__NBIFOM__Mode::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.PCC_3GPP_NBIFOM_Mode."); return enum_value; } void PCC__3GPP__NBIFOM__Mode::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void PCC__3GPP__NBIFOM__Mode::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.PCC_3GPP_NBIFOM_Mode"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.PCC_3GPP_NBIFOM_Mode."); } } void PCC__3GPP__NBIFOM__Mode::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_NBIFOM_Mode."); text_buf.push_int(enum_value); } void PCC__3GPP__NBIFOM__Mode::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.PCC_3GPP_NBIFOM_Mode.", enum_value); } void PCC__3GPP__NBIFOM__Mode::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void PCC__3GPP__NBIFOM__Mode::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int PCC__3GPP__NBIFOM__Mode::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int PCC__3GPP__NBIFOM__Mode::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void PCC__3GPP__NBIFOM__Mode_template::copy_template(const PCC__3GPP__NBIFOM__Mode_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new PCC__3GPP__NBIFOM__Mode_template[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 PCC__3GPP__NBIFOM__Mode_template(*other_value.implication_.precondition); implication_.implied_template = new PCC__3GPP__NBIFOM__Mode_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.PCC_3GPP_NBIFOM_Mode."); } } PCC__3GPP__NBIFOM__Mode_template::PCC__3GPP__NBIFOM__Mode_template() { } PCC__3GPP__NBIFOM__Mode_template::PCC__3GPP__NBIFOM__Mode_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } PCC__3GPP__NBIFOM__Mode_template::PCC__3GPP__NBIFOM__Mode_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!PCC__3GPP__NBIFOM__Mode::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.PCC_3GPP_NBIFOM_Mode with unknown numeric value %d.", other_value); single_value = (PCC__3GPP__NBIFOM__Mode::enum_type)other_value; } PCC__3GPP__NBIFOM__Mode_template::PCC__3GPP__NBIFOM__Mode_template(PCC__3GPP__NBIFOM__Mode::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } PCC__3GPP__NBIFOM__Mode_template::PCC__3GPP__NBIFOM__Mode_template(const PCC__3GPP__NBIFOM__Mode& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == PCC__3GPP__NBIFOM__Mode::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_NBIFOM_Mode."); single_value = other_value.enum_value; } PCC__3GPP__NBIFOM__Mode_template::PCC__3GPP__NBIFOM__Mode_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (PCC__3GPP__NBIFOM__Mode::enum_type)(const PCC__3GPP__NBIFOM__Mode&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.PCC_3GPP_NBIFOM_Mode from an unbound optional field."); } } PCC__3GPP__NBIFOM__Mode_template::PCC__3GPP__NBIFOM__Mode_template(PCC__3GPP__NBIFOM__Mode_template* p_precondition, PCC__3GPP__NBIFOM__Mode_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } PCC__3GPP__NBIFOM__Mode_template::PCC__3GPP__NBIFOM__Mode_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; } PCC__3GPP__NBIFOM__Mode_template::PCC__3GPP__NBIFOM__Mode_template(const PCC__3GPP__NBIFOM__Mode_template& other_value) : Base_Template() { copy_template(other_value); } PCC__3GPP__NBIFOM__Mode_template::~PCC__3GPP__NBIFOM__Mode_template() { clean_up(); } boolean PCC__3GPP__NBIFOM__Mode_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean PCC__3GPP__NBIFOM__Mode_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != PCC__3GPP__NBIFOM__Mode::UNBOUND_VALUE; } void PCC__3GPP__NBIFOM__Mode_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } PCC__3GPP__NBIFOM__Mode_template& PCC__3GPP__NBIFOM__Mode_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } PCC__3GPP__NBIFOM__Mode_template& PCC__3GPP__NBIFOM__Mode_template::operator=(int other_value) { if (!PCC__3GPP__NBIFOM__Mode::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.PCC_3GPP_NBIFOM_Mode.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (PCC__3GPP__NBIFOM__Mode::enum_type)other_value; return *this; } PCC__3GPP__NBIFOM__Mode_template& PCC__3GPP__NBIFOM__Mode_template::operator=(PCC__3GPP__NBIFOM__Mode::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } PCC__3GPP__NBIFOM__Mode_template& PCC__3GPP__NBIFOM__Mode_template::operator=(const PCC__3GPP__NBIFOM__Mode& other_value) { if (other_value.enum_value == PCC__3GPP__NBIFOM__Mode::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_NBIFOM_Mode to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } PCC__3GPP__NBIFOM__Mode_template& PCC__3GPP__NBIFOM__Mode_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (PCC__3GPP__NBIFOM__Mode::enum_type)(const PCC__3GPP__NBIFOM__Mode&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.PCC_3GPP_NBIFOM_Mode."); } return *this; } PCC__3GPP__NBIFOM__Mode_template& PCC__3GPP__NBIFOM__Mode_template::operator=(const PCC__3GPP__NBIFOM__Mode_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean PCC__3GPP__NBIFOM__Mode_template::match(PCC__3GPP__NBIFOM__Mode::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.PCC_3GPP_NBIFOM_Mode."); } return FALSE; } boolean PCC__3GPP__NBIFOM__Mode_template::match(const PCC__3GPP__NBIFOM__Mode& other_value, boolean) const { if (other_value.enum_value == PCC__3GPP__NBIFOM__Mode::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.PCC_3GPP_NBIFOM_Mode with an unbound value."); return match(other_value.enum_value); } PCC__3GPP__NBIFOM__Mode::enum_type PCC__3GPP__NBIFOM__Mode_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.PCC_3GPP_NBIFOM_Mode."); return single_value; } void PCC__3GPP__NBIFOM__Mode_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.PCC_3GPP_NBIFOM_Mode."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new PCC__3GPP__NBIFOM__Mode_template[list_length]; } PCC__3GPP__NBIFOM__Mode_template& PCC__3GPP__NBIFOM__Mode_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.PCC_3GPP_NBIFOM_Mode."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.PCC_3GPP_NBIFOM_Mode."); return value_list.list_value[list_index]; } void PCC__3GPP__NBIFOM__Mode_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(PCC__3GPP__NBIFOM__Mode::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void PCC__3GPP__NBIFOM__Mode_template::log_match(const PCC__3GPP__NBIFOM__Mode& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void PCC__3GPP__NBIFOM__Mode_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.PCC_3GPP_NBIFOM_Mode."); } } void PCC__3GPP__NBIFOM__Mode_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (PCC__3GPP__NBIFOM__Mode::enum_type)text_buf.pull_int().get_val(); if (!PCC__3GPP__NBIFOM__Mode::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.PCC_3GPP_NBIFOM_Mode.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new PCC__3GPP__NBIFOM__Mode_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.PCC_3GPP_NBIFOM_Mode."); } } boolean PCC__3GPP__NBIFOM__Mode_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean PCC__3GPP__NBIFOM__Mode_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { PCC__3GPP__NBIFOM__Mode_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { PCC__3GPP__NBIFOM__Mode::enum_type enum_val = PCC__3GPP__NBIFOM__Mode::str_to_enum(m_p->get_enumerated()); if (!PCC__3GPP__NBIFOM__Mode::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.PCC_3GPP_NBIFOM_Mode."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { PCC__3GPP__NBIFOM__Mode_template* precondition = new PCC__3GPP__NBIFOM__Mode_template; precondition->set_param(*m_p->get_elem(0)); PCC__3GPP__NBIFOM__Mode_template* implied_template = new PCC__3GPP__NBIFOM__Mode_template; implied_template->set_param(*m_p->get_elem(1)); *this = PCC__3GPP__NBIFOM__Mode_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.PCC_3GPP_NBIFOM_Mode"); } is_ifpresent = param.get_ifpresent(); } void PCC__3GPP__NBIFOM__Mode_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.PCC_3GPP_NBIFOM_Mode"); } CxDx__3GPP__Originating__Request::CxDx__3GPP__Originating__Request() { enum_value = UNBOUND_VALUE; } CxDx__3GPP__Originating__Request::CxDx__3GPP__Originating__Request(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.CxDx_3GPP_Originating_Request with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } CxDx__3GPP__Originating__Request::CxDx__3GPP__Originating__Request(enum_type other_value) { enum_value = other_value; } CxDx__3GPP__Originating__Request::CxDx__3GPP__Originating__Request(const CxDx__3GPP__Originating__Request& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.CxDx_3GPP_Originating_Request."); enum_value = other_value.enum_value; } CxDx__3GPP__Originating__Request& CxDx__3GPP__Originating__Request::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.CxDx_3GPP_Originating_Request.", other_value); enum_value = (enum_type)other_value; return *this; } CxDx__3GPP__Originating__Request& CxDx__3GPP__Originating__Request::operator=(enum_type other_value) { enum_value = other_value; return *this; } CxDx__3GPP__Originating__Request& CxDx__3GPP__Originating__Request::operator=(const CxDx__3GPP__Originating__Request& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.CxDx_3GPP_Originating_Request."); enum_value = other_value.enum_value; return *this; } boolean CxDx__3GPP__Originating__Request::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.CxDx_3GPP_Originating_Request."); return enum_value == other_value; } boolean CxDx__3GPP__Originating__Request::operator==(const CxDx__3GPP__Originating__Request& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.CxDx_3GPP_Originating_Request."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.CxDx_3GPP_Originating_Request."); return enum_value == other_value.enum_value; } boolean CxDx__3GPP__Originating__Request::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.CxDx_3GPP_Originating_Request."); return enum_value < other_value; } boolean CxDx__3GPP__Originating__Request::operator<(const CxDx__3GPP__Originating__Request& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.CxDx_3GPP_Originating_Request."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.CxDx_3GPP_Originating_Request."); return enum_value < other_value.enum_value; } boolean CxDx__3GPP__Originating__Request::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.CxDx_3GPP_Originating_Request."); return enum_value > other_value; } boolean CxDx__3GPP__Originating__Request::operator>(const CxDx__3GPP__Originating__Request& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.CxDx_3GPP_Originating_Request."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.CxDx_3GPP_Originating_Request."); return enum_value > other_value.enum_value; } const char *CxDx__3GPP__Originating__Request::enum_to_str(enum_type enum_par) { switch (enum_par) { case ORIGINATING: return "ORIGINATING"; default: return ""; } } CxDx__3GPP__Originating__Request::enum_type CxDx__3GPP__Originating__Request::str_to_enum(const char *str_par) { if (!strcmp(str_par, "ORIGINATING")) return ORIGINATING; else return UNKNOWN_VALUE; } boolean CxDx__3GPP__Originating__Request::is_valid_enum(int int_par) { switch (int_par) { case 0: return TRUE; default: return FALSE; } } int CxDx__3GPP__Originating__Request::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.CxDx_3GPP_Originating_Request.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int CxDx__3GPP__Originating__Request::enum2int(const CxDx__3GPP__Originating__Request& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.CxDx_3GPP_Originating_Request.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void CxDx__3GPP__Originating__Request::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.CxDx_3GPP_Originating_Request.", int_val); enum_value = (enum_type)int_val; } CxDx__3GPP__Originating__Request::operator CxDx__3GPP__Originating__Request::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.CxDx_3GPP_Originating_Request."); return enum_value; } void CxDx__3GPP__Originating__Request::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void CxDx__3GPP__Originating__Request::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.CxDx_3GPP_Originating_Request"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.CxDx_3GPP_Originating_Request."); } } void CxDx__3GPP__Originating__Request::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.CxDx_3GPP_Originating_Request."); text_buf.push_int(enum_value); } void CxDx__3GPP__Originating__Request::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.CxDx_3GPP_Originating_Request.", enum_value); } void CxDx__3GPP__Originating__Request::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void CxDx__3GPP__Originating__Request::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int CxDx__3GPP__Originating__Request::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 1, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int CxDx__3GPP__Originating__Request::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 1); } void CxDx__3GPP__Originating__Request_template::copy_template(const CxDx__3GPP__Originating__Request_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new CxDx__3GPP__Originating__Request_template[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 CxDx__3GPP__Originating__Request_template(*other_value.implication_.precondition); implication_.implied_template = new CxDx__3GPP__Originating__Request_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.CxDx_3GPP_Originating_Request."); } } CxDx__3GPP__Originating__Request_template::CxDx__3GPP__Originating__Request_template() { } CxDx__3GPP__Originating__Request_template::CxDx__3GPP__Originating__Request_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } CxDx__3GPP__Originating__Request_template::CxDx__3GPP__Originating__Request_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!CxDx__3GPP__Originating__Request::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.CxDx_3GPP_Originating_Request with unknown numeric value %d.", other_value); single_value = (CxDx__3GPP__Originating__Request::enum_type)other_value; } CxDx__3GPP__Originating__Request_template::CxDx__3GPP__Originating__Request_template(CxDx__3GPP__Originating__Request::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } CxDx__3GPP__Originating__Request_template::CxDx__3GPP__Originating__Request_template(const CxDx__3GPP__Originating__Request& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == CxDx__3GPP__Originating__Request::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.CxDx_3GPP_Originating_Request."); single_value = other_value.enum_value; } CxDx__3GPP__Originating__Request_template::CxDx__3GPP__Originating__Request_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (CxDx__3GPP__Originating__Request::enum_type)(const CxDx__3GPP__Originating__Request&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.CxDx_3GPP_Originating_Request from an unbound optional field."); } } CxDx__3GPP__Originating__Request_template::CxDx__3GPP__Originating__Request_template(CxDx__3GPP__Originating__Request_template* p_precondition, CxDx__3GPP__Originating__Request_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } CxDx__3GPP__Originating__Request_template::CxDx__3GPP__Originating__Request_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; } CxDx__3GPP__Originating__Request_template::CxDx__3GPP__Originating__Request_template(const CxDx__3GPP__Originating__Request_template& other_value) : Base_Template() { copy_template(other_value); } CxDx__3GPP__Originating__Request_template::~CxDx__3GPP__Originating__Request_template() { clean_up(); } boolean CxDx__3GPP__Originating__Request_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean CxDx__3GPP__Originating__Request_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != CxDx__3GPP__Originating__Request::UNBOUND_VALUE; } void CxDx__3GPP__Originating__Request_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } CxDx__3GPP__Originating__Request_template& CxDx__3GPP__Originating__Request_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } CxDx__3GPP__Originating__Request_template& CxDx__3GPP__Originating__Request_template::operator=(int other_value) { if (!CxDx__3GPP__Originating__Request::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.CxDx_3GPP_Originating_Request.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (CxDx__3GPP__Originating__Request::enum_type)other_value; return *this; } CxDx__3GPP__Originating__Request_template& CxDx__3GPP__Originating__Request_template::operator=(CxDx__3GPP__Originating__Request::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } CxDx__3GPP__Originating__Request_template& CxDx__3GPP__Originating__Request_template::operator=(const CxDx__3GPP__Originating__Request& other_value) { if (other_value.enum_value == CxDx__3GPP__Originating__Request::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.CxDx_3GPP_Originating_Request to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } CxDx__3GPP__Originating__Request_template& CxDx__3GPP__Originating__Request_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (CxDx__3GPP__Originating__Request::enum_type)(const CxDx__3GPP__Originating__Request&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.CxDx_3GPP_Originating_Request."); } return *this; } CxDx__3GPP__Originating__Request_template& CxDx__3GPP__Originating__Request_template::operator=(const CxDx__3GPP__Originating__Request_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean CxDx__3GPP__Originating__Request_template::match(CxDx__3GPP__Originating__Request::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.CxDx_3GPP_Originating_Request."); } return FALSE; } boolean CxDx__3GPP__Originating__Request_template::match(const CxDx__3GPP__Originating__Request& other_value, boolean) const { if (other_value.enum_value == CxDx__3GPP__Originating__Request::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.CxDx_3GPP_Originating_Request with an unbound value."); return match(other_value.enum_value); } CxDx__3GPP__Originating__Request::enum_type CxDx__3GPP__Originating__Request_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.CxDx_3GPP_Originating_Request."); return single_value; } void CxDx__3GPP__Originating__Request_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.CxDx_3GPP_Originating_Request."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new CxDx__3GPP__Originating__Request_template[list_length]; } CxDx__3GPP__Originating__Request_template& CxDx__3GPP__Originating__Request_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.CxDx_3GPP_Originating_Request."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.CxDx_3GPP_Originating_Request."); return value_list.list_value[list_index]; } void CxDx__3GPP__Originating__Request_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(CxDx__3GPP__Originating__Request::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void CxDx__3GPP__Originating__Request_template::log_match(const CxDx__3GPP__Originating__Request& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void CxDx__3GPP__Originating__Request_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.CxDx_3GPP_Originating_Request."); } } void CxDx__3GPP__Originating__Request_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (CxDx__3GPP__Originating__Request::enum_type)text_buf.pull_int().get_val(); if (!CxDx__3GPP__Originating__Request::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.CxDx_3GPP_Originating_Request.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new CxDx__3GPP__Originating__Request_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.CxDx_3GPP_Originating_Request."); } } boolean CxDx__3GPP__Originating__Request_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean CxDx__3GPP__Originating__Request_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { CxDx__3GPP__Originating__Request_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { CxDx__3GPP__Originating__Request::enum_type enum_val = CxDx__3GPP__Originating__Request::str_to_enum(m_p->get_enumerated()); if (!CxDx__3GPP__Originating__Request::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.CxDx_3GPP_Originating_Request."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { CxDx__3GPP__Originating__Request_template* precondition = new CxDx__3GPP__Originating__Request_template; precondition->set_param(*m_p->get_elem(0)); CxDx__3GPP__Originating__Request_template* implied_template = new CxDx__3GPP__Originating__Request_template; implied_template->set_param(*m_p->get_elem(1)); *this = CxDx__3GPP__Originating__Request_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.CxDx_3GPP_Originating_Request"); } is_ifpresent = param.get_ifpresent(); } void CxDx__3GPP__Originating__Request_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.CxDx_3GPP_Originating_Request"); } DCA__3GPP__CN__Operator__Selection__Entity::DCA__3GPP__CN__Operator__Selection__Entity() { enum_value = UNBOUND_VALUE; } DCA__3GPP__CN__Operator__Selection__Entity::DCA__3GPP__CN__Operator__Selection__Entity(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.DCA_3GPP_CN_Operator_Selection_Entity with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } DCA__3GPP__CN__Operator__Selection__Entity::DCA__3GPP__CN__Operator__Selection__Entity(enum_type other_value) { enum_value = other_value; } DCA__3GPP__CN__Operator__Selection__Entity::DCA__3GPP__CN__Operator__Selection__Entity(const DCA__3GPP__CN__Operator__Selection__Entity& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_CN_Operator_Selection_Entity."); enum_value = other_value.enum_value; } DCA__3GPP__CN__Operator__Selection__Entity& DCA__3GPP__CN__Operator__Selection__Entity::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_CN_Operator_Selection_Entity.", other_value); enum_value = (enum_type)other_value; return *this; } DCA__3GPP__CN__Operator__Selection__Entity& DCA__3GPP__CN__Operator__Selection__Entity::operator=(enum_type other_value) { enum_value = other_value; return *this; } DCA__3GPP__CN__Operator__Selection__Entity& DCA__3GPP__CN__Operator__Selection__Entity::operator=(const DCA__3GPP__CN__Operator__Selection__Entity& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_CN_Operator_Selection_Entity."); enum_value = other_value.enum_value; return *this; } boolean DCA__3GPP__CN__Operator__Selection__Entity::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_CN_Operator_Selection_Entity."); return enum_value == other_value; } boolean DCA__3GPP__CN__Operator__Selection__Entity::operator==(const DCA__3GPP__CN__Operator__Selection__Entity& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_CN_Operator_Selection_Entity."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_CN_Operator_Selection_Entity."); return enum_value == other_value.enum_value; } boolean DCA__3GPP__CN__Operator__Selection__Entity::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_CN_Operator_Selection_Entity."); return enum_value < other_value; } boolean DCA__3GPP__CN__Operator__Selection__Entity::operator<(const DCA__3GPP__CN__Operator__Selection__Entity& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_CN_Operator_Selection_Entity."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_CN_Operator_Selection_Entity."); return enum_value < other_value.enum_value; } boolean DCA__3GPP__CN__Operator__Selection__Entity::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_CN_Operator_Selection_Entity."); return enum_value > other_value; } boolean DCA__3GPP__CN__Operator__Selection__Entity::operator>(const DCA__3GPP__CN__Operator__Selection__Entity& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_CN_Operator_Selection_Entity."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_CN_Operator_Selection_Entity."); return enum_value > other_value.enum_value; } const char *DCA__3GPP__CN__Operator__Selection__Entity::enum_to_str(enum_type enum_par) { switch (enum_par) { case SN__selected__by__UE: return "SN_selected_by_UE"; case SN__selected__by__network: return "SN_selected_by_network"; default: return ""; } } DCA__3GPP__CN__Operator__Selection__Entity::enum_type DCA__3GPP__CN__Operator__Selection__Entity::str_to_enum(const char *str_par) { if (!strcmp(str_par, "SN_selected_by_UE")) return SN__selected__by__UE; else if (!strcmp(str_par, "SN_selected_by_network")) return SN__selected__by__network; else return UNKNOWN_VALUE; } boolean DCA__3GPP__CN__Operator__Selection__Entity::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: return TRUE; default: return FALSE; } } int DCA__3GPP__CN__Operator__Selection__Entity::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_CN_Operator_Selection_Entity.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int DCA__3GPP__CN__Operator__Selection__Entity::enum2int(const DCA__3GPP__CN__Operator__Selection__Entity& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_CN_Operator_Selection_Entity.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void DCA__3GPP__CN__Operator__Selection__Entity::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_CN_Operator_Selection_Entity.", int_val); enum_value = (enum_type)int_val; } DCA__3GPP__CN__Operator__Selection__Entity::operator DCA__3GPP__CN__Operator__Selection__Entity::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.DCA_3GPP_CN_Operator_Selection_Entity."); return enum_value; } void DCA__3GPP__CN__Operator__Selection__Entity::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void DCA__3GPP__CN__Operator__Selection__Entity::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.DCA_3GPP_CN_Operator_Selection_Entity"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_CN_Operator_Selection_Entity."); } } void DCA__3GPP__CN__Operator__Selection__Entity::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_CN_Operator_Selection_Entity."); text_buf.push_int(enum_value); } void DCA__3GPP__CN__Operator__Selection__Entity::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.DCA_3GPP_CN_Operator_Selection_Entity.", enum_value); } void DCA__3GPP__CN__Operator__Selection__Entity::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void DCA__3GPP__CN__Operator__Selection__Entity::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int DCA__3GPP__CN__Operator__Selection__Entity::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int DCA__3GPP__CN__Operator__Selection__Entity::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void DCA__3GPP__CN__Operator__Selection__Entity_template::copy_template(const DCA__3GPP__CN__Operator__Selection__Entity_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new DCA__3GPP__CN__Operator__Selection__Entity_template[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 DCA__3GPP__CN__Operator__Selection__Entity_template(*other_value.implication_.precondition); implication_.implied_template = new DCA__3GPP__CN__Operator__Selection__Entity_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_CN_Operator_Selection_Entity."); } } DCA__3GPP__CN__Operator__Selection__Entity_template::DCA__3GPP__CN__Operator__Selection__Entity_template() { } DCA__3GPP__CN__Operator__Selection__Entity_template::DCA__3GPP__CN__Operator__Selection__Entity_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } DCA__3GPP__CN__Operator__Selection__Entity_template::DCA__3GPP__CN__Operator__Selection__Entity_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!DCA__3GPP__CN__Operator__Selection__Entity::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.DCA_3GPP_CN_Operator_Selection_Entity with unknown numeric value %d.", other_value); single_value = (DCA__3GPP__CN__Operator__Selection__Entity::enum_type)other_value; } DCA__3GPP__CN__Operator__Selection__Entity_template::DCA__3GPP__CN__Operator__Selection__Entity_template(DCA__3GPP__CN__Operator__Selection__Entity::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } DCA__3GPP__CN__Operator__Selection__Entity_template::DCA__3GPP__CN__Operator__Selection__Entity_template(const DCA__3GPP__CN__Operator__Selection__Entity& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == DCA__3GPP__CN__Operator__Selection__Entity::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_CN_Operator_Selection_Entity."); single_value = other_value.enum_value; } DCA__3GPP__CN__Operator__Selection__Entity_template::DCA__3GPP__CN__Operator__Selection__Entity_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__CN__Operator__Selection__Entity::enum_type)(const DCA__3GPP__CN__Operator__Selection__Entity&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.DCA_3GPP_CN_Operator_Selection_Entity from an unbound optional field."); } } DCA__3GPP__CN__Operator__Selection__Entity_template::DCA__3GPP__CN__Operator__Selection__Entity_template(DCA__3GPP__CN__Operator__Selection__Entity_template* p_precondition, DCA__3GPP__CN__Operator__Selection__Entity_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } DCA__3GPP__CN__Operator__Selection__Entity_template::DCA__3GPP__CN__Operator__Selection__Entity_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; } DCA__3GPP__CN__Operator__Selection__Entity_template::DCA__3GPP__CN__Operator__Selection__Entity_template(const DCA__3GPP__CN__Operator__Selection__Entity_template& other_value) : Base_Template() { copy_template(other_value); } DCA__3GPP__CN__Operator__Selection__Entity_template::~DCA__3GPP__CN__Operator__Selection__Entity_template() { clean_up(); } boolean DCA__3GPP__CN__Operator__Selection__Entity_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean DCA__3GPP__CN__Operator__Selection__Entity_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != DCA__3GPP__CN__Operator__Selection__Entity::UNBOUND_VALUE; } void DCA__3GPP__CN__Operator__Selection__Entity_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } DCA__3GPP__CN__Operator__Selection__Entity_template& DCA__3GPP__CN__Operator__Selection__Entity_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } DCA__3GPP__CN__Operator__Selection__Entity_template& DCA__3GPP__CN__Operator__Selection__Entity_template::operator=(int other_value) { if (!DCA__3GPP__CN__Operator__Selection__Entity::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.DCA_3GPP_CN_Operator_Selection_Entity.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__CN__Operator__Selection__Entity::enum_type)other_value; return *this; } DCA__3GPP__CN__Operator__Selection__Entity_template& DCA__3GPP__CN__Operator__Selection__Entity_template::operator=(DCA__3GPP__CN__Operator__Selection__Entity::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } DCA__3GPP__CN__Operator__Selection__Entity_template& DCA__3GPP__CN__Operator__Selection__Entity_template::operator=(const DCA__3GPP__CN__Operator__Selection__Entity& other_value) { if (other_value.enum_value == DCA__3GPP__CN__Operator__Selection__Entity::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_CN_Operator_Selection_Entity to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } DCA__3GPP__CN__Operator__Selection__Entity_template& DCA__3GPP__CN__Operator__Selection__Entity_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__CN__Operator__Selection__Entity::enum_type)(const DCA__3GPP__CN__Operator__Selection__Entity&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.DCA_3GPP_CN_Operator_Selection_Entity."); } return *this; } DCA__3GPP__CN__Operator__Selection__Entity_template& DCA__3GPP__CN__Operator__Selection__Entity_template::operator=(const DCA__3GPP__CN__Operator__Selection__Entity_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean DCA__3GPP__CN__Operator__Selection__Entity_template::match(DCA__3GPP__CN__Operator__Selection__Entity::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_CN_Operator_Selection_Entity."); } return FALSE; } boolean DCA__3GPP__CN__Operator__Selection__Entity_template::match(const DCA__3GPP__CN__Operator__Selection__Entity& other_value, boolean) const { if (other_value.enum_value == DCA__3GPP__CN__Operator__Selection__Entity::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.DCA_3GPP_CN_Operator_Selection_Entity with an unbound value."); return match(other_value.enum_value); } DCA__3GPP__CN__Operator__Selection__Entity::enum_type DCA__3GPP__CN__Operator__Selection__Entity_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.DCA_3GPP_CN_Operator_Selection_Entity."); return single_value; } void DCA__3GPP__CN__Operator__Selection__Entity_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.DCA_3GPP_CN_Operator_Selection_Entity."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new DCA__3GPP__CN__Operator__Selection__Entity_template[list_length]; } DCA__3GPP__CN__Operator__Selection__Entity_template& DCA__3GPP__CN__Operator__Selection__Entity_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.DCA_3GPP_CN_Operator_Selection_Entity."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.DCA_3GPP_CN_Operator_Selection_Entity."); return value_list.list_value[list_index]; } void DCA__3GPP__CN__Operator__Selection__Entity_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(DCA__3GPP__CN__Operator__Selection__Entity::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void DCA__3GPP__CN__Operator__Selection__Entity_template::log_match(const DCA__3GPP__CN__Operator__Selection__Entity& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void DCA__3GPP__CN__Operator__Selection__Entity_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_CN_Operator_Selection_Entity."); } } void DCA__3GPP__CN__Operator__Selection__Entity_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (DCA__3GPP__CN__Operator__Selection__Entity::enum_type)text_buf.pull_int().get_val(); if (!DCA__3GPP__CN__Operator__Selection__Entity::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_CN_Operator_Selection_Entity.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new DCA__3GPP__CN__Operator__Selection__Entity_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_CN_Operator_Selection_Entity."); } } boolean DCA__3GPP__CN__Operator__Selection__Entity_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean DCA__3GPP__CN__Operator__Selection__Entity_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { DCA__3GPP__CN__Operator__Selection__Entity_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { DCA__3GPP__CN__Operator__Selection__Entity::enum_type enum_val = DCA__3GPP__CN__Operator__Selection__Entity::str_to_enum(m_p->get_enumerated()); if (!DCA__3GPP__CN__Operator__Selection__Entity::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_CN_Operator_Selection_Entity."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { DCA__3GPP__CN__Operator__Selection__Entity_template* precondition = new DCA__3GPP__CN__Operator__Selection__Entity_template; precondition->set_param(*m_p->get_elem(0)); DCA__3GPP__CN__Operator__Selection__Entity_template* implied_template = new DCA__3GPP__CN__Operator__Selection__Entity_template; implied_template->set_param(*m_p->get_elem(1)); *this = DCA__3GPP__CN__Operator__Selection__Entity_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.DCA_3GPP_CN_Operator_Selection_Entity"); } is_ifpresent = param.get_ifpresent(); } void DCA__3GPP__CN__Operator__Selection__Entity_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.DCA_3GPP_CN_Operator_Selection_Entity"); } AAA__3GPP__Collection__Period__RRM__UMTS::AAA__3GPP__Collection__Period__RRM__UMTS() { enum_value = UNBOUND_VALUE; } AAA__3GPP__Collection__Period__RRM__UMTS::AAA__3GPP__Collection__Period__RRM__UMTS(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.AAA_3GPP_Collection_Period_RRM_UMTS with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } AAA__3GPP__Collection__Period__RRM__UMTS::AAA__3GPP__Collection__Period__RRM__UMTS(enum_type other_value) { enum_value = other_value; } AAA__3GPP__Collection__Period__RRM__UMTS::AAA__3GPP__Collection__Period__RRM__UMTS(const AAA__3GPP__Collection__Period__RRM__UMTS& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Collection_Period_RRM_UMTS."); enum_value = other_value.enum_value; } AAA__3GPP__Collection__Period__RRM__UMTS& AAA__3GPP__Collection__Period__RRM__UMTS::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.AAA_3GPP_Collection_Period_RRM_UMTS.", other_value); enum_value = (enum_type)other_value; return *this; } AAA__3GPP__Collection__Period__RRM__UMTS& AAA__3GPP__Collection__Period__RRM__UMTS::operator=(enum_type other_value) { enum_value = other_value; return *this; } AAA__3GPP__Collection__Period__RRM__UMTS& AAA__3GPP__Collection__Period__RRM__UMTS::operator=(const AAA__3GPP__Collection__Period__RRM__UMTS& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Collection_Period_RRM_UMTS."); enum_value = other_value.enum_value; return *this; } boolean AAA__3GPP__Collection__Period__RRM__UMTS::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Collection_Period_RRM_UMTS."); return enum_value == other_value; } boolean AAA__3GPP__Collection__Period__RRM__UMTS::operator==(const AAA__3GPP__Collection__Period__RRM__UMTS& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Collection_Period_RRM_UMTS."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Collection_Period_RRM_UMTS."); return enum_value == other_value.enum_value; } boolean AAA__3GPP__Collection__Period__RRM__UMTS::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Collection_Period_RRM_UMTS."); return enum_value < other_value; } boolean AAA__3GPP__Collection__Period__RRM__UMTS::operator<(const AAA__3GPP__Collection__Period__RRM__UMTS& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Collection_Period_RRM_UMTS."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Collection_Period_RRM_UMTS."); return enum_value < other_value.enum_value; } boolean AAA__3GPP__Collection__Period__RRM__UMTS::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Collection_Period_RRM_UMTS."); return enum_value > other_value; } boolean AAA__3GPP__Collection__Period__RRM__UMTS::operator>(const AAA__3GPP__Collection__Period__RRM__UMTS& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Collection_Period_RRM_UMTS."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Collection_Period_RRM_UMTS."); return enum_value > other_value.enum_value; } const char *AAA__3GPP__Collection__Period__RRM__UMTS::enum_to_str(enum_type enum_par) { switch (enum_par) { case PERIOD__250__ms: return "PERIOD_250_ms"; case PERIOD__500__ms: return "PERIOD_500_ms"; case PERIOD__1000__ms: return "PERIOD_1000_ms"; case PERIOD__2000__ms: return "PERIOD_2000_ms"; case PERIOD__3000__ms: return "PERIOD_3000_ms"; case PERIOD__4000__ms: return "PERIOD_4000_ms"; case PERIOD__6000__ms: return "PERIOD_6000_ms"; case PERIOD__8000__ms: return "PERIOD_8000_ms"; case PERIOD__12000__ms: return "PERIOD_12000_ms"; case PERIOD__16000__ms: return "PERIOD_16000_ms"; case PERIOD__20000__ms: return "PERIOD_20000_ms"; case PERIOD__24000__ms: return "PERIOD_24000_ms"; case PERIOD__28000__ms: return "PERIOD_28000_ms"; case PERIOD__32000__ms: return "PERIOD_32000_ms"; case PERIOD__64000__ms: return "PERIOD_64000_ms"; default: return ""; } } AAA__3GPP__Collection__Period__RRM__UMTS::enum_type AAA__3GPP__Collection__Period__RRM__UMTS::str_to_enum(const char *str_par) { if (!strcmp(str_par, "PERIOD_250_ms")) return PERIOD__250__ms; else if (!strcmp(str_par, "PERIOD_500_ms")) return PERIOD__500__ms; else if (!strcmp(str_par, "PERIOD_1000_ms")) return PERIOD__1000__ms; else if (!strcmp(str_par, "PERIOD_2000_ms")) return PERIOD__2000__ms; else if (!strcmp(str_par, "PERIOD_3000_ms")) return PERIOD__3000__ms; else if (!strcmp(str_par, "PERIOD_4000_ms")) return PERIOD__4000__ms; else if (!strcmp(str_par, "PERIOD_6000_ms")) return PERIOD__6000__ms; else if (!strcmp(str_par, "PERIOD_8000_ms")) return PERIOD__8000__ms; else if (!strcmp(str_par, "PERIOD_12000_ms")) return PERIOD__12000__ms; else if (!strcmp(str_par, "PERIOD_16000_ms")) return PERIOD__16000__ms; else if (!strcmp(str_par, "PERIOD_20000_ms")) return PERIOD__20000__ms; else if (!strcmp(str_par, "PERIOD_24000_ms")) return PERIOD__24000__ms; else if (!strcmp(str_par, "PERIOD_28000_ms")) return PERIOD__28000__ms; else if (!strcmp(str_par, "PERIOD_32000_ms")) return PERIOD__32000__ms; else if (!strcmp(str_par, "PERIOD_64000_ms")) return PERIOD__64000__ms; else return UNKNOWN_VALUE; } boolean AAA__3GPP__Collection__Period__RRM__UMTS::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: case 12: case 13: case 14: return TRUE; default: return FALSE; } } int AAA__3GPP__Collection__Period__RRM__UMTS::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.AAA_3GPP_Collection_Period_RRM_UMTS.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int AAA__3GPP__Collection__Period__RRM__UMTS::enum2int(const AAA__3GPP__Collection__Period__RRM__UMTS& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.AAA_3GPP_Collection_Period_RRM_UMTS.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void AAA__3GPP__Collection__Period__RRM__UMTS::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.AAA_3GPP_Collection_Period_RRM_UMTS.", int_val); enum_value = (enum_type)int_val; } AAA__3GPP__Collection__Period__RRM__UMTS::operator AAA__3GPP__Collection__Period__RRM__UMTS::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.AAA_3GPP_Collection_Period_RRM_UMTS."); return enum_value; } void AAA__3GPP__Collection__Period__RRM__UMTS::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void AAA__3GPP__Collection__Period__RRM__UMTS::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.AAA_3GPP_Collection_Period_RRM_UMTS"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.AAA_3GPP_Collection_Period_RRM_UMTS."); } } void AAA__3GPP__Collection__Period__RRM__UMTS::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Collection_Period_RRM_UMTS."); text_buf.push_int(enum_value); } void AAA__3GPP__Collection__Period__RRM__UMTS::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.AAA_3GPP_Collection_Period_RRM_UMTS.", enum_value); } void AAA__3GPP__Collection__Period__RRM__UMTS::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void AAA__3GPP__Collection__Period__RRM__UMTS::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int AAA__3GPP__Collection__Period__RRM__UMTS::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 4, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int AAA__3GPP__Collection__Period__RRM__UMTS::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 4); } void AAA__3GPP__Collection__Period__RRM__UMTS_template::copy_template(const AAA__3GPP__Collection__Period__RRM__UMTS_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new AAA__3GPP__Collection__Period__RRM__UMTS_template[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 AAA__3GPP__Collection__Period__RRM__UMTS_template(*other_value.implication_.precondition); implication_.implied_template = new AAA__3GPP__Collection__Period__RRM__UMTS_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_Collection_Period_RRM_UMTS."); } } AAA__3GPP__Collection__Period__RRM__UMTS_template::AAA__3GPP__Collection__Period__RRM__UMTS_template() { } AAA__3GPP__Collection__Period__RRM__UMTS_template::AAA__3GPP__Collection__Period__RRM__UMTS_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } AAA__3GPP__Collection__Period__RRM__UMTS_template::AAA__3GPP__Collection__Period__RRM__UMTS_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!AAA__3GPP__Collection__Period__RRM__UMTS::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.AAA_3GPP_Collection_Period_RRM_UMTS with unknown numeric value %d.", other_value); single_value = (AAA__3GPP__Collection__Period__RRM__UMTS::enum_type)other_value; } AAA__3GPP__Collection__Period__RRM__UMTS_template::AAA__3GPP__Collection__Period__RRM__UMTS_template(AAA__3GPP__Collection__Period__RRM__UMTS::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } AAA__3GPP__Collection__Period__RRM__UMTS_template::AAA__3GPP__Collection__Period__RRM__UMTS_template(const AAA__3GPP__Collection__Period__RRM__UMTS& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == AAA__3GPP__Collection__Period__RRM__UMTS::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Collection_Period_RRM_UMTS."); single_value = other_value.enum_value; } AAA__3GPP__Collection__Period__RRM__UMTS_template::AAA__3GPP__Collection__Period__RRM__UMTS_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__Collection__Period__RRM__UMTS::enum_type)(const AAA__3GPP__Collection__Period__RRM__UMTS&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.AAA_3GPP_Collection_Period_RRM_UMTS from an unbound optional field."); } } AAA__3GPP__Collection__Period__RRM__UMTS_template::AAA__3GPP__Collection__Period__RRM__UMTS_template(AAA__3GPP__Collection__Period__RRM__UMTS_template* p_precondition, AAA__3GPP__Collection__Period__RRM__UMTS_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } AAA__3GPP__Collection__Period__RRM__UMTS_template::AAA__3GPP__Collection__Period__RRM__UMTS_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; } AAA__3GPP__Collection__Period__RRM__UMTS_template::AAA__3GPP__Collection__Period__RRM__UMTS_template(const AAA__3GPP__Collection__Period__RRM__UMTS_template& other_value) : Base_Template() { copy_template(other_value); } AAA__3GPP__Collection__Period__RRM__UMTS_template::~AAA__3GPP__Collection__Period__RRM__UMTS_template() { clean_up(); } boolean AAA__3GPP__Collection__Period__RRM__UMTS_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean AAA__3GPP__Collection__Period__RRM__UMTS_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != AAA__3GPP__Collection__Period__RRM__UMTS::UNBOUND_VALUE; } void AAA__3GPP__Collection__Period__RRM__UMTS_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } AAA__3GPP__Collection__Period__RRM__UMTS_template& AAA__3GPP__Collection__Period__RRM__UMTS_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } AAA__3GPP__Collection__Period__RRM__UMTS_template& AAA__3GPP__Collection__Period__RRM__UMTS_template::operator=(int other_value) { if (!AAA__3GPP__Collection__Period__RRM__UMTS::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.AAA_3GPP_Collection_Period_RRM_UMTS.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__Collection__Period__RRM__UMTS::enum_type)other_value; return *this; } AAA__3GPP__Collection__Period__RRM__UMTS_template& AAA__3GPP__Collection__Period__RRM__UMTS_template::operator=(AAA__3GPP__Collection__Period__RRM__UMTS::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } AAA__3GPP__Collection__Period__RRM__UMTS_template& AAA__3GPP__Collection__Period__RRM__UMTS_template::operator=(const AAA__3GPP__Collection__Period__RRM__UMTS& other_value) { if (other_value.enum_value == AAA__3GPP__Collection__Period__RRM__UMTS::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Collection_Period_RRM_UMTS to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } AAA__3GPP__Collection__Period__RRM__UMTS_template& AAA__3GPP__Collection__Period__RRM__UMTS_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__Collection__Period__RRM__UMTS::enum_type)(const AAA__3GPP__Collection__Period__RRM__UMTS&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.AAA_3GPP_Collection_Period_RRM_UMTS."); } return *this; } AAA__3GPP__Collection__Period__RRM__UMTS_template& AAA__3GPP__Collection__Period__RRM__UMTS_template::operator=(const AAA__3GPP__Collection__Period__RRM__UMTS_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean AAA__3GPP__Collection__Period__RRM__UMTS_template::match(AAA__3GPP__Collection__Period__RRM__UMTS::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_Collection_Period_RRM_UMTS."); } return FALSE; } boolean AAA__3GPP__Collection__Period__RRM__UMTS_template::match(const AAA__3GPP__Collection__Period__RRM__UMTS& other_value, boolean) const { if (other_value.enum_value == AAA__3GPP__Collection__Period__RRM__UMTS::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.AAA_3GPP_Collection_Period_RRM_UMTS with an unbound value."); return match(other_value.enum_value); } AAA__3GPP__Collection__Period__RRM__UMTS::enum_type AAA__3GPP__Collection__Period__RRM__UMTS_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.AAA_3GPP_Collection_Period_RRM_UMTS."); return single_value; } void AAA__3GPP__Collection__Period__RRM__UMTS_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.AAA_3GPP_Collection_Period_RRM_UMTS."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new AAA__3GPP__Collection__Period__RRM__UMTS_template[list_length]; } AAA__3GPP__Collection__Period__RRM__UMTS_template& AAA__3GPP__Collection__Period__RRM__UMTS_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.AAA_3GPP_Collection_Period_RRM_UMTS."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.AAA_3GPP_Collection_Period_RRM_UMTS."); return value_list.list_value[list_index]; } void AAA__3GPP__Collection__Period__RRM__UMTS_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(AAA__3GPP__Collection__Period__RRM__UMTS::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void AAA__3GPP__Collection__Period__RRM__UMTS_template::log_match(const AAA__3GPP__Collection__Period__RRM__UMTS& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void AAA__3GPP__Collection__Period__RRM__UMTS_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_Collection_Period_RRM_UMTS."); } } void AAA__3GPP__Collection__Period__RRM__UMTS_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (AAA__3GPP__Collection__Period__RRM__UMTS::enum_type)text_buf.pull_int().get_val(); if (!AAA__3GPP__Collection__Period__RRM__UMTS::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.AAA_3GPP_Collection_Period_RRM_UMTS.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new AAA__3GPP__Collection__Period__RRM__UMTS_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.AAA_3GPP_Collection_Period_RRM_UMTS."); } } boolean AAA__3GPP__Collection__Period__RRM__UMTS_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean AAA__3GPP__Collection__Period__RRM__UMTS_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { AAA__3GPP__Collection__Period__RRM__UMTS_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { AAA__3GPP__Collection__Period__RRM__UMTS::enum_type enum_val = AAA__3GPP__Collection__Period__RRM__UMTS::str_to_enum(m_p->get_enumerated()); if (!AAA__3GPP__Collection__Period__RRM__UMTS::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.AAA_3GPP_Collection_Period_RRM_UMTS."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { AAA__3GPP__Collection__Period__RRM__UMTS_template* precondition = new AAA__3GPP__Collection__Period__RRM__UMTS_template; precondition->set_param(*m_p->get_elem(0)); AAA__3GPP__Collection__Period__RRM__UMTS_template* implied_template = new AAA__3GPP__Collection__Period__RRM__UMTS_template; implied_template->set_param(*m_p->get_elem(1)); *this = AAA__3GPP__Collection__Period__RRM__UMTS_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.AAA_3GPP_Collection_Period_RRM_UMTS"); } is_ifpresent = param.get_ifpresent(); } void AAA__3GPP__Collection__Period__RRM__UMTS_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.AAA_3GPP_Collection_Period_RRM_UMTS"); } DCA__3GPP__Location__Estimate__Type::DCA__3GPP__Location__Estimate__Type() { enum_value = UNBOUND_VALUE; } DCA__3GPP__Location__Estimate__Type::DCA__3GPP__Location__Estimate__Type(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Location_Estimate_Type with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } DCA__3GPP__Location__Estimate__Type::DCA__3GPP__Location__Estimate__Type(enum_type other_value) { enum_value = other_value; } DCA__3GPP__Location__Estimate__Type::DCA__3GPP__Location__Estimate__Type(const DCA__3GPP__Location__Estimate__Type& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Location_Estimate_Type."); enum_value = other_value.enum_value; } DCA__3GPP__Location__Estimate__Type& DCA__3GPP__Location__Estimate__Type::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Location_Estimate_Type.", other_value); enum_value = (enum_type)other_value; return *this; } DCA__3GPP__Location__Estimate__Type& DCA__3GPP__Location__Estimate__Type::operator=(enum_type other_value) { enum_value = other_value; return *this; } DCA__3GPP__Location__Estimate__Type& DCA__3GPP__Location__Estimate__Type::operator=(const DCA__3GPP__Location__Estimate__Type& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Location_Estimate_Type."); enum_value = other_value.enum_value; return *this; } boolean DCA__3GPP__Location__Estimate__Type::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Location_Estimate_Type."); return enum_value == other_value; } boolean DCA__3GPP__Location__Estimate__Type::operator==(const DCA__3GPP__Location__Estimate__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Location_Estimate_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Location_Estimate_Type."); return enum_value == other_value.enum_value; } boolean DCA__3GPP__Location__Estimate__Type::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Location_Estimate_Type."); return enum_value < other_value; } boolean DCA__3GPP__Location__Estimate__Type::operator<(const DCA__3GPP__Location__Estimate__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Location_Estimate_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Location_Estimate_Type."); return enum_value < other_value.enum_value; } boolean DCA__3GPP__Location__Estimate__Type::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Location_Estimate_Type."); return enum_value > other_value; } boolean DCA__3GPP__Location__Estimate__Type::operator>(const DCA__3GPP__Location__Estimate__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Location_Estimate_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Location_Estimate_Type."); return enum_value > other_value.enum_value; } const char *DCA__3GPP__Location__Estimate__Type::enum_to_str(enum_type enum_par) { switch (enum_par) { case CURRENT__LOCATION: return "CURRENT_LOCATION"; case CURRENT__LAST__KNOWN__LOCATION: return "CURRENT_LAST_KNOWN_LOCATION"; case INITIAL__LOCATION: return "INITIAL_LOCATION"; case ACTIVATE__DEFERRED__LOCATION: return "ACTIVATE_DEFERRED_LOCATION"; case CANCEL__DEFERRED__LOCATION: return "CANCEL_DEFERRED_LOCATION"; default: return ""; } } DCA__3GPP__Location__Estimate__Type::enum_type DCA__3GPP__Location__Estimate__Type::str_to_enum(const char *str_par) { if (!strcmp(str_par, "CURRENT_LOCATION")) return CURRENT__LOCATION; else if (!strcmp(str_par, "CURRENT_LAST_KNOWN_LOCATION")) return CURRENT__LAST__KNOWN__LOCATION; else if (!strcmp(str_par, "INITIAL_LOCATION")) return INITIAL__LOCATION; else if (!strcmp(str_par, "ACTIVATE_DEFERRED_LOCATION")) return ACTIVATE__DEFERRED__LOCATION; else if (!strcmp(str_par, "CANCEL_DEFERRED_LOCATION")) return CANCEL__DEFERRED__LOCATION; else return UNKNOWN_VALUE; } boolean DCA__3GPP__Location__Estimate__Type::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: case 2: case 3: case 4: return TRUE; default: return FALSE; } } int DCA__3GPP__Location__Estimate__Type::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_Location_Estimate_Type.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int DCA__3GPP__Location__Estimate__Type::enum2int(const DCA__3GPP__Location__Estimate__Type& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_Location_Estimate_Type.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void DCA__3GPP__Location__Estimate__Type::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Location_Estimate_Type.", int_val); enum_value = (enum_type)int_val; } DCA__3GPP__Location__Estimate__Type::operator DCA__3GPP__Location__Estimate__Type::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.DCA_3GPP_Location_Estimate_Type."); return enum_value; } void DCA__3GPP__Location__Estimate__Type::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void DCA__3GPP__Location__Estimate__Type::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.DCA_3GPP_Location_Estimate_Type"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_Location_Estimate_Type."); } } void DCA__3GPP__Location__Estimate__Type::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Location_Estimate_Type."); text_buf.push_int(enum_value); } void DCA__3GPP__Location__Estimate__Type::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.DCA_3GPP_Location_Estimate_Type.", enum_value); } void DCA__3GPP__Location__Estimate__Type::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void DCA__3GPP__Location__Estimate__Type::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int DCA__3GPP__Location__Estimate__Type::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 3, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int DCA__3GPP__Location__Estimate__Type::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 3); } void DCA__3GPP__Location__Estimate__Type_template::copy_template(const DCA__3GPP__Location__Estimate__Type_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new DCA__3GPP__Location__Estimate__Type_template[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 DCA__3GPP__Location__Estimate__Type_template(*other_value.implication_.precondition); implication_.implied_template = new DCA__3GPP__Location__Estimate__Type_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Location_Estimate_Type."); } } DCA__3GPP__Location__Estimate__Type_template::DCA__3GPP__Location__Estimate__Type_template() { } DCA__3GPP__Location__Estimate__Type_template::DCA__3GPP__Location__Estimate__Type_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } DCA__3GPP__Location__Estimate__Type_template::DCA__3GPP__Location__Estimate__Type_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!DCA__3GPP__Location__Estimate__Type::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.DCA_3GPP_Location_Estimate_Type with unknown numeric value %d.", other_value); single_value = (DCA__3GPP__Location__Estimate__Type::enum_type)other_value; } DCA__3GPP__Location__Estimate__Type_template::DCA__3GPP__Location__Estimate__Type_template(DCA__3GPP__Location__Estimate__Type::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } DCA__3GPP__Location__Estimate__Type_template::DCA__3GPP__Location__Estimate__Type_template(const DCA__3GPP__Location__Estimate__Type& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == DCA__3GPP__Location__Estimate__Type::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Location_Estimate_Type."); single_value = other_value.enum_value; } DCA__3GPP__Location__Estimate__Type_template::DCA__3GPP__Location__Estimate__Type_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Location__Estimate__Type::enum_type)(const DCA__3GPP__Location__Estimate__Type&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.DCA_3GPP_Location_Estimate_Type from an unbound optional field."); } } DCA__3GPP__Location__Estimate__Type_template::DCA__3GPP__Location__Estimate__Type_template(DCA__3GPP__Location__Estimate__Type_template* p_precondition, DCA__3GPP__Location__Estimate__Type_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } DCA__3GPP__Location__Estimate__Type_template::DCA__3GPP__Location__Estimate__Type_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; } DCA__3GPP__Location__Estimate__Type_template::DCA__3GPP__Location__Estimate__Type_template(const DCA__3GPP__Location__Estimate__Type_template& other_value) : Base_Template() { copy_template(other_value); } DCA__3GPP__Location__Estimate__Type_template::~DCA__3GPP__Location__Estimate__Type_template() { clean_up(); } boolean DCA__3GPP__Location__Estimate__Type_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean DCA__3GPP__Location__Estimate__Type_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != DCA__3GPP__Location__Estimate__Type::UNBOUND_VALUE; } void DCA__3GPP__Location__Estimate__Type_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } DCA__3GPP__Location__Estimate__Type_template& DCA__3GPP__Location__Estimate__Type_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } DCA__3GPP__Location__Estimate__Type_template& DCA__3GPP__Location__Estimate__Type_template::operator=(int other_value) { if (!DCA__3GPP__Location__Estimate__Type::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.DCA_3GPP_Location_Estimate_Type.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Location__Estimate__Type::enum_type)other_value; return *this; } DCA__3GPP__Location__Estimate__Type_template& DCA__3GPP__Location__Estimate__Type_template::operator=(DCA__3GPP__Location__Estimate__Type::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } DCA__3GPP__Location__Estimate__Type_template& DCA__3GPP__Location__Estimate__Type_template::operator=(const DCA__3GPP__Location__Estimate__Type& other_value) { if (other_value.enum_value == DCA__3GPP__Location__Estimate__Type::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Location_Estimate_Type to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } DCA__3GPP__Location__Estimate__Type_template& DCA__3GPP__Location__Estimate__Type_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Location__Estimate__Type::enum_type)(const DCA__3GPP__Location__Estimate__Type&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.DCA_3GPP_Location_Estimate_Type."); } return *this; } DCA__3GPP__Location__Estimate__Type_template& DCA__3GPP__Location__Estimate__Type_template::operator=(const DCA__3GPP__Location__Estimate__Type_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean DCA__3GPP__Location__Estimate__Type_template::match(DCA__3GPP__Location__Estimate__Type::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Location_Estimate_Type."); } return FALSE; } boolean DCA__3GPP__Location__Estimate__Type_template::match(const DCA__3GPP__Location__Estimate__Type& other_value, boolean) const { if (other_value.enum_value == DCA__3GPP__Location__Estimate__Type::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.DCA_3GPP_Location_Estimate_Type with an unbound value."); return match(other_value.enum_value); } DCA__3GPP__Location__Estimate__Type::enum_type DCA__3GPP__Location__Estimate__Type_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.DCA_3GPP_Location_Estimate_Type."); return single_value; } void DCA__3GPP__Location__Estimate__Type_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Location_Estimate_Type."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new DCA__3GPP__Location__Estimate__Type_template[list_length]; } DCA__3GPP__Location__Estimate__Type_template& DCA__3GPP__Location__Estimate__Type_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.DCA_3GPP_Location_Estimate_Type."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.DCA_3GPP_Location_Estimate_Type."); return value_list.list_value[list_index]; } void DCA__3GPP__Location__Estimate__Type_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(DCA__3GPP__Location__Estimate__Type::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void DCA__3GPP__Location__Estimate__Type_template::log_match(const DCA__3GPP__Location__Estimate__Type& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void DCA__3GPP__Location__Estimate__Type_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Location_Estimate_Type."); } } void DCA__3GPP__Location__Estimate__Type_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (DCA__3GPP__Location__Estimate__Type::enum_type)text_buf.pull_int().get_val(); if (!DCA__3GPP__Location__Estimate__Type::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Location_Estimate_Type.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new DCA__3GPP__Location__Estimate__Type_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Location_Estimate_Type."); } } boolean DCA__3GPP__Location__Estimate__Type_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean DCA__3GPP__Location__Estimate__Type_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { DCA__3GPP__Location__Estimate__Type_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { DCA__3GPP__Location__Estimate__Type::enum_type enum_val = DCA__3GPP__Location__Estimate__Type::str_to_enum(m_p->get_enumerated()); if (!DCA__3GPP__Location__Estimate__Type::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_Location_Estimate_Type."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { DCA__3GPP__Location__Estimate__Type_template* precondition = new DCA__3GPP__Location__Estimate__Type_template; precondition->set_param(*m_p->get_elem(0)); DCA__3GPP__Location__Estimate__Type_template* implied_template = new DCA__3GPP__Location__Estimate__Type_template; implied_template->set_param(*m_p->get_elem(1)); *this = DCA__3GPP__Location__Estimate__Type_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.DCA_3GPP_Location_Estimate_Type"); } is_ifpresent = param.get_ifpresent(); } void DCA__3GPP__Location__Estimate__Type_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.DCA_3GPP_Location_Estimate_Type"); } DCA__3GPP__Addressee__Type::DCA__3GPP__Addressee__Type() { enum_value = UNBOUND_VALUE; } DCA__3GPP__Addressee__Type::DCA__3GPP__Addressee__Type(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Addressee_Type with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } DCA__3GPP__Addressee__Type::DCA__3GPP__Addressee__Type(enum_type other_value) { enum_value = other_value; } DCA__3GPP__Addressee__Type::DCA__3GPP__Addressee__Type(const DCA__3GPP__Addressee__Type& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Addressee_Type."); enum_value = other_value.enum_value; } DCA__3GPP__Addressee__Type& DCA__3GPP__Addressee__Type::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Addressee_Type.", other_value); enum_value = (enum_type)other_value; return *this; } DCA__3GPP__Addressee__Type& DCA__3GPP__Addressee__Type::operator=(enum_type other_value) { enum_value = other_value; return *this; } DCA__3GPP__Addressee__Type& DCA__3GPP__Addressee__Type::operator=(const DCA__3GPP__Addressee__Type& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Addressee_Type."); enum_value = other_value.enum_value; return *this; } boolean DCA__3GPP__Addressee__Type::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Addressee_Type."); return enum_value == other_value; } boolean DCA__3GPP__Addressee__Type::operator==(const DCA__3GPP__Addressee__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Addressee_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Addressee_Type."); return enum_value == other_value.enum_value; } boolean DCA__3GPP__Addressee__Type::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Addressee_Type."); return enum_value < other_value; } boolean DCA__3GPP__Addressee__Type::operator<(const DCA__3GPP__Addressee__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Addressee_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Addressee_Type."); return enum_value < other_value.enum_value; } boolean DCA__3GPP__Addressee__Type::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Addressee_Type."); return enum_value > other_value; } boolean DCA__3GPP__Addressee__Type::operator>(const DCA__3GPP__Addressee__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Addressee_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Addressee_Type."); return enum_value > other_value.enum_value; } const char *DCA__3GPP__Addressee__Type::enum_to_str(enum_type enum_par) { switch (enum_par) { case TO: return "TO"; case CC: return "CC"; case BCC: return "BCC"; default: return ""; } } DCA__3GPP__Addressee__Type::enum_type DCA__3GPP__Addressee__Type::str_to_enum(const char *str_par) { if (!strcmp(str_par, "TO")) return TO; else if (!strcmp(str_par, "CC")) return CC; else if (!strcmp(str_par, "BCC")) return BCC; else return UNKNOWN_VALUE; } boolean DCA__3GPP__Addressee__Type::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: case 2: return TRUE; default: return FALSE; } } int DCA__3GPP__Addressee__Type::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_Addressee_Type.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int DCA__3GPP__Addressee__Type::enum2int(const DCA__3GPP__Addressee__Type& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_Addressee_Type.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void DCA__3GPP__Addressee__Type::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Addressee_Type.", int_val); enum_value = (enum_type)int_val; } DCA__3GPP__Addressee__Type::operator DCA__3GPP__Addressee__Type::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.DCA_3GPP_Addressee_Type."); return enum_value; } void DCA__3GPP__Addressee__Type::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void DCA__3GPP__Addressee__Type::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.DCA_3GPP_Addressee_Type"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_Addressee_Type."); } } void DCA__3GPP__Addressee__Type::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Addressee_Type."); text_buf.push_int(enum_value); } void DCA__3GPP__Addressee__Type::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.DCA_3GPP_Addressee_Type.", enum_value); } void DCA__3GPP__Addressee__Type::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void DCA__3GPP__Addressee__Type::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int DCA__3GPP__Addressee__Type::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int DCA__3GPP__Addressee__Type::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void DCA__3GPP__Addressee__Type_template::copy_template(const DCA__3GPP__Addressee__Type_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new DCA__3GPP__Addressee__Type_template[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 DCA__3GPP__Addressee__Type_template(*other_value.implication_.precondition); implication_.implied_template = new DCA__3GPP__Addressee__Type_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Addressee_Type."); } } DCA__3GPP__Addressee__Type_template::DCA__3GPP__Addressee__Type_template() { } DCA__3GPP__Addressee__Type_template::DCA__3GPP__Addressee__Type_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } DCA__3GPP__Addressee__Type_template::DCA__3GPP__Addressee__Type_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!DCA__3GPP__Addressee__Type::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.DCA_3GPP_Addressee_Type with unknown numeric value %d.", other_value); single_value = (DCA__3GPP__Addressee__Type::enum_type)other_value; } DCA__3GPP__Addressee__Type_template::DCA__3GPP__Addressee__Type_template(DCA__3GPP__Addressee__Type::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } DCA__3GPP__Addressee__Type_template::DCA__3GPP__Addressee__Type_template(const DCA__3GPP__Addressee__Type& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == DCA__3GPP__Addressee__Type::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Addressee_Type."); single_value = other_value.enum_value; } DCA__3GPP__Addressee__Type_template::DCA__3GPP__Addressee__Type_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Addressee__Type::enum_type)(const DCA__3GPP__Addressee__Type&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.DCA_3GPP_Addressee_Type from an unbound optional field."); } } DCA__3GPP__Addressee__Type_template::DCA__3GPP__Addressee__Type_template(DCA__3GPP__Addressee__Type_template* p_precondition, DCA__3GPP__Addressee__Type_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } DCA__3GPP__Addressee__Type_template::DCA__3GPP__Addressee__Type_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; } DCA__3GPP__Addressee__Type_template::DCA__3GPP__Addressee__Type_template(const DCA__3GPP__Addressee__Type_template& other_value) : Base_Template() { copy_template(other_value); } DCA__3GPP__Addressee__Type_template::~DCA__3GPP__Addressee__Type_template() { clean_up(); } boolean DCA__3GPP__Addressee__Type_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean DCA__3GPP__Addressee__Type_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != DCA__3GPP__Addressee__Type::UNBOUND_VALUE; } void DCA__3GPP__Addressee__Type_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } DCA__3GPP__Addressee__Type_template& DCA__3GPP__Addressee__Type_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } DCA__3GPP__Addressee__Type_template& DCA__3GPP__Addressee__Type_template::operator=(int other_value) { if (!DCA__3GPP__Addressee__Type::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.DCA_3GPP_Addressee_Type.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Addressee__Type::enum_type)other_value; return *this; } DCA__3GPP__Addressee__Type_template& DCA__3GPP__Addressee__Type_template::operator=(DCA__3GPP__Addressee__Type::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } DCA__3GPP__Addressee__Type_template& DCA__3GPP__Addressee__Type_template::operator=(const DCA__3GPP__Addressee__Type& other_value) { if (other_value.enum_value == DCA__3GPP__Addressee__Type::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Addressee_Type to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } DCA__3GPP__Addressee__Type_template& DCA__3GPP__Addressee__Type_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Addressee__Type::enum_type)(const DCA__3GPP__Addressee__Type&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.DCA_3GPP_Addressee_Type."); } return *this; } DCA__3GPP__Addressee__Type_template& DCA__3GPP__Addressee__Type_template::operator=(const DCA__3GPP__Addressee__Type_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean DCA__3GPP__Addressee__Type_template::match(DCA__3GPP__Addressee__Type::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Addressee_Type."); } return FALSE; } boolean DCA__3GPP__Addressee__Type_template::match(const DCA__3GPP__Addressee__Type& other_value, boolean) const { if (other_value.enum_value == DCA__3GPP__Addressee__Type::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.DCA_3GPP_Addressee_Type with an unbound value."); return match(other_value.enum_value); } DCA__3GPP__Addressee__Type::enum_type DCA__3GPP__Addressee__Type_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.DCA_3GPP_Addressee_Type."); return single_value; } void DCA__3GPP__Addressee__Type_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Addressee_Type."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new DCA__3GPP__Addressee__Type_template[list_length]; } DCA__3GPP__Addressee__Type_template& DCA__3GPP__Addressee__Type_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.DCA_3GPP_Addressee_Type."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.DCA_3GPP_Addressee_Type."); return value_list.list_value[list_index]; } void DCA__3GPP__Addressee__Type_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(DCA__3GPP__Addressee__Type::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void DCA__3GPP__Addressee__Type_template::log_match(const DCA__3GPP__Addressee__Type& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void DCA__3GPP__Addressee__Type_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Addressee_Type."); } } void DCA__3GPP__Addressee__Type_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (DCA__3GPP__Addressee__Type::enum_type)text_buf.pull_int().get_val(); if (!DCA__3GPP__Addressee__Type::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Addressee_Type.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new DCA__3GPP__Addressee__Type_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Addressee_Type."); } } boolean DCA__3GPP__Addressee__Type_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean DCA__3GPP__Addressee__Type_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { DCA__3GPP__Addressee__Type_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { DCA__3GPP__Addressee__Type::enum_type enum_val = DCA__3GPP__Addressee__Type::str_to_enum(m_p->get_enumerated()); if (!DCA__3GPP__Addressee__Type::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_Addressee_Type."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { DCA__3GPP__Addressee__Type_template* precondition = new DCA__3GPP__Addressee__Type_template; precondition->set_param(*m_p->get_elem(0)); DCA__3GPP__Addressee__Type_template* implied_template = new DCA__3GPP__Addressee__Type_template; implied_template->set_param(*m_p->get_elem(1)); *this = DCA__3GPP__Addressee__Type_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.DCA_3GPP_Addressee_Type"); } is_ifpresent = param.get_ifpresent(); } void DCA__3GPP__Addressee__Type_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.DCA_3GPP_Addressee_Type"); } DCA__3GPP__Participant__Access__Priority::DCA__3GPP__Participant__Access__Priority() { enum_value = UNBOUND_VALUE; } DCA__3GPP__Participant__Access__Priority::DCA__3GPP__Participant__Access__Priority(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Participant_Access_Priority with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } DCA__3GPP__Participant__Access__Priority::DCA__3GPP__Participant__Access__Priority(enum_type other_value) { enum_value = other_value; } DCA__3GPP__Participant__Access__Priority::DCA__3GPP__Participant__Access__Priority(const DCA__3GPP__Participant__Access__Priority& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Participant_Access_Priority."); enum_value = other_value.enum_value; } DCA__3GPP__Participant__Access__Priority& DCA__3GPP__Participant__Access__Priority::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Participant_Access_Priority.", other_value); enum_value = (enum_type)other_value; return *this; } DCA__3GPP__Participant__Access__Priority& DCA__3GPP__Participant__Access__Priority::operator=(enum_type other_value) { enum_value = other_value; return *this; } DCA__3GPP__Participant__Access__Priority& DCA__3GPP__Participant__Access__Priority::operator=(const DCA__3GPP__Participant__Access__Priority& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Participant_Access_Priority."); enum_value = other_value.enum_value; return *this; } boolean DCA__3GPP__Participant__Access__Priority::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Participant_Access_Priority."); return enum_value == other_value; } boolean DCA__3GPP__Participant__Access__Priority::operator==(const DCA__3GPP__Participant__Access__Priority& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Participant_Access_Priority."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Participant_Access_Priority."); return enum_value == other_value.enum_value; } boolean DCA__3GPP__Participant__Access__Priority::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Participant_Access_Priority."); return enum_value < other_value; } boolean DCA__3GPP__Participant__Access__Priority::operator<(const DCA__3GPP__Participant__Access__Priority& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Participant_Access_Priority."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Participant_Access_Priority."); return enum_value < other_value.enum_value; } boolean DCA__3GPP__Participant__Access__Priority::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Participant_Access_Priority."); return enum_value > other_value; } boolean DCA__3GPP__Participant__Access__Priority::operator>(const DCA__3GPP__Participant__Access__Priority& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Participant_Access_Priority."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Participant_Access_Priority."); return enum_value > other_value.enum_value; } const char *DCA__3GPP__Participant__Access__Priority::enum_to_str(enum_type enum_par) { switch (enum_par) { case PRE__EMPTIVE__PRIORITY: return "PRE_EMPTIVE_PRIORITY"; case HIGH__PRIORITY: return "HIGH_PRIORITY"; case NORMAL__PRIORITY: return "NORMAL_PRIORITY"; case LOW__PRIORITY: return "LOW_PRIORITY"; default: return ""; } } DCA__3GPP__Participant__Access__Priority::enum_type DCA__3GPP__Participant__Access__Priority::str_to_enum(const char *str_par) { if (!strcmp(str_par, "PRE_EMPTIVE_PRIORITY")) return PRE__EMPTIVE__PRIORITY; else if (!strcmp(str_par, "HIGH_PRIORITY")) return HIGH__PRIORITY; else if (!strcmp(str_par, "NORMAL_PRIORITY")) return NORMAL__PRIORITY; else if (!strcmp(str_par, "LOW_PRIORITY")) return LOW__PRIORITY; else return UNKNOWN_VALUE; } boolean DCA__3GPP__Participant__Access__Priority::is_valid_enum(int int_par) { switch (int_par) { case 1: case 2: case 3: case 4: return TRUE; default: return FALSE; } } int DCA__3GPP__Participant__Access__Priority::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_Participant_Access_Priority.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int DCA__3GPP__Participant__Access__Priority::enum2int(const DCA__3GPP__Participant__Access__Priority& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_Participant_Access_Priority.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void DCA__3GPP__Participant__Access__Priority::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Participant_Access_Priority.", int_val); enum_value = (enum_type)int_val; } DCA__3GPP__Participant__Access__Priority::operator DCA__3GPP__Participant__Access__Priority::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.DCA_3GPP_Participant_Access_Priority."); return enum_value; } void DCA__3GPP__Participant__Access__Priority::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void DCA__3GPP__Participant__Access__Priority::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.DCA_3GPP_Participant_Access_Priority"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_Participant_Access_Priority."); } } void DCA__3GPP__Participant__Access__Priority::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Participant_Access_Priority."); text_buf.push_int(enum_value); } void DCA__3GPP__Participant__Access__Priority::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.DCA_3GPP_Participant_Access_Priority.", enum_value); } void DCA__3GPP__Participant__Access__Priority::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void DCA__3GPP__Participant__Access__Priority::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int DCA__3GPP__Participant__Access__Priority::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 3, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int DCA__3GPP__Participant__Access__Priority::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 3); } void DCA__3GPP__Participant__Access__Priority_template::copy_template(const DCA__3GPP__Participant__Access__Priority_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new DCA__3GPP__Participant__Access__Priority_template[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 DCA__3GPP__Participant__Access__Priority_template(*other_value.implication_.precondition); implication_.implied_template = new DCA__3GPP__Participant__Access__Priority_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Participant_Access_Priority."); } } DCA__3GPP__Participant__Access__Priority_template::DCA__3GPP__Participant__Access__Priority_template() { } DCA__3GPP__Participant__Access__Priority_template::DCA__3GPP__Participant__Access__Priority_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } DCA__3GPP__Participant__Access__Priority_template::DCA__3GPP__Participant__Access__Priority_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!DCA__3GPP__Participant__Access__Priority::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.DCA_3GPP_Participant_Access_Priority with unknown numeric value %d.", other_value); single_value = (DCA__3GPP__Participant__Access__Priority::enum_type)other_value; } DCA__3GPP__Participant__Access__Priority_template::DCA__3GPP__Participant__Access__Priority_template(DCA__3GPP__Participant__Access__Priority::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } DCA__3GPP__Participant__Access__Priority_template::DCA__3GPP__Participant__Access__Priority_template(const DCA__3GPP__Participant__Access__Priority& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == DCA__3GPP__Participant__Access__Priority::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Participant_Access_Priority."); single_value = other_value.enum_value; } DCA__3GPP__Participant__Access__Priority_template::DCA__3GPP__Participant__Access__Priority_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Participant__Access__Priority::enum_type)(const DCA__3GPP__Participant__Access__Priority&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.DCA_3GPP_Participant_Access_Priority from an unbound optional field."); } } DCA__3GPP__Participant__Access__Priority_template::DCA__3GPP__Participant__Access__Priority_template(DCA__3GPP__Participant__Access__Priority_template* p_precondition, DCA__3GPP__Participant__Access__Priority_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } DCA__3GPP__Participant__Access__Priority_template::DCA__3GPP__Participant__Access__Priority_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; } DCA__3GPP__Participant__Access__Priority_template::DCA__3GPP__Participant__Access__Priority_template(const DCA__3GPP__Participant__Access__Priority_template& other_value) : Base_Template() { copy_template(other_value); } DCA__3GPP__Participant__Access__Priority_template::~DCA__3GPP__Participant__Access__Priority_template() { clean_up(); } boolean DCA__3GPP__Participant__Access__Priority_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean DCA__3GPP__Participant__Access__Priority_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != DCA__3GPP__Participant__Access__Priority::UNBOUND_VALUE; } void DCA__3GPP__Participant__Access__Priority_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } DCA__3GPP__Participant__Access__Priority_template& DCA__3GPP__Participant__Access__Priority_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } DCA__3GPP__Participant__Access__Priority_template& DCA__3GPP__Participant__Access__Priority_template::operator=(int other_value) { if (!DCA__3GPP__Participant__Access__Priority::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.DCA_3GPP_Participant_Access_Priority.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Participant__Access__Priority::enum_type)other_value; return *this; } DCA__3GPP__Participant__Access__Priority_template& DCA__3GPP__Participant__Access__Priority_template::operator=(DCA__3GPP__Participant__Access__Priority::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } DCA__3GPP__Participant__Access__Priority_template& DCA__3GPP__Participant__Access__Priority_template::operator=(const DCA__3GPP__Participant__Access__Priority& other_value) { if (other_value.enum_value == DCA__3GPP__Participant__Access__Priority::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Participant_Access_Priority to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } DCA__3GPP__Participant__Access__Priority_template& DCA__3GPP__Participant__Access__Priority_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Participant__Access__Priority::enum_type)(const DCA__3GPP__Participant__Access__Priority&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.DCA_3GPP_Participant_Access_Priority."); } return *this; } DCA__3GPP__Participant__Access__Priority_template& DCA__3GPP__Participant__Access__Priority_template::operator=(const DCA__3GPP__Participant__Access__Priority_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean DCA__3GPP__Participant__Access__Priority_template::match(DCA__3GPP__Participant__Access__Priority::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Participant_Access_Priority."); } return FALSE; } boolean DCA__3GPP__Participant__Access__Priority_template::match(const DCA__3GPP__Participant__Access__Priority& other_value, boolean) const { if (other_value.enum_value == DCA__3GPP__Participant__Access__Priority::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.DCA_3GPP_Participant_Access_Priority with an unbound value."); return match(other_value.enum_value); } DCA__3GPP__Participant__Access__Priority::enum_type DCA__3GPP__Participant__Access__Priority_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.DCA_3GPP_Participant_Access_Priority."); return single_value; } void DCA__3GPP__Participant__Access__Priority_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Participant_Access_Priority."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new DCA__3GPP__Participant__Access__Priority_template[list_length]; } DCA__3GPP__Participant__Access__Priority_template& DCA__3GPP__Participant__Access__Priority_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.DCA_3GPP_Participant_Access_Priority."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.DCA_3GPP_Participant_Access_Priority."); return value_list.list_value[list_index]; } void DCA__3GPP__Participant__Access__Priority_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(DCA__3GPP__Participant__Access__Priority::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void DCA__3GPP__Participant__Access__Priority_template::log_match(const DCA__3GPP__Participant__Access__Priority& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void DCA__3GPP__Participant__Access__Priority_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Participant_Access_Priority."); } } void DCA__3GPP__Participant__Access__Priority_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (DCA__3GPP__Participant__Access__Priority::enum_type)text_buf.pull_int().get_val(); if (!DCA__3GPP__Participant__Access__Priority::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Participant_Access_Priority.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new DCA__3GPP__Participant__Access__Priority_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Participant_Access_Priority."); } } boolean DCA__3GPP__Participant__Access__Priority_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean DCA__3GPP__Participant__Access__Priority_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { DCA__3GPP__Participant__Access__Priority_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { DCA__3GPP__Participant__Access__Priority::enum_type enum_val = DCA__3GPP__Participant__Access__Priority::str_to_enum(m_p->get_enumerated()); if (!DCA__3GPP__Participant__Access__Priority::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_Participant_Access_Priority."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { DCA__3GPP__Participant__Access__Priority_template* precondition = new DCA__3GPP__Participant__Access__Priority_template; precondition->set_param(*m_p->get_elem(0)); DCA__3GPP__Participant__Access__Priority_template* implied_template = new DCA__3GPP__Participant__Access__Priority_template; implied_template->set_param(*m_p->get_elem(1)); *this = DCA__3GPP__Participant__Access__Priority_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.DCA_3GPP_Participant_Access_Priority"); } is_ifpresent = param.get_ifpresent(); } void DCA__3GPP__Participant__Access__Priority_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.DCA_3GPP_Participant_Access_Priority"); } MIPv4__NONE__MIP__Algorithm__Type::MIPv4__NONE__MIP__Algorithm__Type() { enum_value = UNBOUND_VALUE; } MIPv4__NONE__MIP__Algorithm__Type::MIPv4__NONE__MIP__Algorithm__Type(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Algorithm_Type with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } MIPv4__NONE__MIP__Algorithm__Type::MIPv4__NONE__MIP__Algorithm__Type(enum_type other_value) { enum_value = other_value; } MIPv4__NONE__MIP__Algorithm__Type::MIPv4__NONE__MIP__Algorithm__Type(const MIPv4__NONE__MIP__Algorithm__Type& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Algorithm_Type."); enum_value = other_value.enum_value; } MIPv4__NONE__MIP__Algorithm__Type& MIPv4__NONE__MIP__Algorithm__Type::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Algorithm_Type.", other_value); enum_value = (enum_type)other_value; return *this; } MIPv4__NONE__MIP__Algorithm__Type& MIPv4__NONE__MIP__Algorithm__Type::operator=(enum_type other_value) { enum_value = other_value; return *this; } MIPv4__NONE__MIP__Algorithm__Type& MIPv4__NONE__MIP__Algorithm__Type::operator=(const MIPv4__NONE__MIP__Algorithm__Type& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Algorithm_Type."); enum_value = other_value.enum_value; return *this; } boolean MIPv4__NONE__MIP__Algorithm__Type::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Algorithm_Type."); return enum_value == other_value; } boolean MIPv4__NONE__MIP__Algorithm__Type::operator==(const MIPv4__NONE__MIP__Algorithm__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Algorithm_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Algorithm_Type."); return enum_value == other_value.enum_value; } boolean MIPv4__NONE__MIP__Algorithm__Type::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Algorithm_Type."); return enum_value < other_value; } boolean MIPv4__NONE__MIP__Algorithm__Type::operator<(const MIPv4__NONE__MIP__Algorithm__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Algorithm_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Algorithm_Type."); return enum_value < other_value.enum_value; } boolean MIPv4__NONE__MIP__Algorithm__Type::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Algorithm_Type."); return enum_value > other_value; } boolean MIPv4__NONE__MIP__Algorithm__Type::operator>(const MIPv4__NONE__MIP__Algorithm__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Algorithm_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Algorithm_Type."); return enum_value > other_value.enum_value; } const char *MIPv4__NONE__MIP__Algorithm__Type::enum_to_str(enum_type enum_par) { switch (enum_par) { case HMAC__SHA__1: return "HMAC_SHA_1"; default: return ""; } } MIPv4__NONE__MIP__Algorithm__Type::enum_type MIPv4__NONE__MIP__Algorithm__Type::str_to_enum(const char *str_par) { if (!strcmp(str_par, "HMAC_SHA_1")) return HMAC__SHA__1; else return UNKNOWN_VALUE; } boolean MIPv4__NONE__MIP__Algorithm__Type::is_valid_enum(int int_par) { switch (int_par) { case 2: return TRUE; default: return FALSE; } } int MIPv4__NONE__MIP__Algorithm__Type::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Algorithm_Type.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int MIPv4__NONE__MIP__Algorithm__Type::enum2int(const MIPv4__NONE__MIP__Algorithm__Type& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Algorithm_Type.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void MIPv4__NONE__MIP__Algorithm__Type::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Algorithm_Type.", int_val); enum_value = (enum_type)int_val; } MIPv4__NONE__MIP__Algorithm__Type::operator MIPv4__NONE__MIP__Algorithm__Type::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Algorithm_Type."); return enum_value; } void MIPv4__NONE__MIP__Algorithm__Type::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void MIPv4__NONE__MIP__Algorithm__Type::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.MIPv4_NONE_MIP_Algorithm_Type"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.MIPv4_NONE_MIP_Algorithm_Type."); } } void MIPv4__NONE__MIP__Algorithm__Type::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Algorithm_Type."); text_buf.push_int(enum_value); } void MIPv4__NONE__MIP__Algorithm__Type::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Algorithm_Type.", enum_value); } void MIPv4__NONE__MIP__Algorithm__Type::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void MIPv4__NONE__MIP__Algorithm__Type::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int MIPv4__NONE__MIP__Algorithm__Type::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int MIPv4__NONE__MIP__Algorithm__Type::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void MIPv4__NONE__MIP__Algorithm__Type_template::copy_template(const MIPv4__NONE__MIP__Algorithm__Type_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new MIPv4__NONE__MIP__Algorithm__Type_template[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 MIPv4__NONE__MIP__Algorithm__Type_template(*other_value.implication_.precondition); implication_.implied_template = new MIPv4__NONE__MIP__Algorithm__Type_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Algorithm_Type."); } } MIPv4__NONE__MIP__Algorithm__Type_template::MIPv4__NONE__MIP__Algorithm__Type_template() { } MIPv4__NONE__MIP__Algorithm__Type_template::MIPv4__NONE__MIP__Algorithm__Type_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } MIPv4__NONE__MIP__Algorithm__Type_template::MIPv4__NONE__MIP__Algorithm__Type_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!MIPv4__NONE__MIP__Algorithm__Type::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Algorithm_Type with unknown numeric value %d.", other_value); single_value = (MIPv4__NONE__MIP__Algorithm__Type::enum_type)other_value; } MIPv4__NONE__MIP__Algorithm__Type_template::MIPv4__NONE__MIP__Algorithm__Type_template(MIPv4__NONE__MIP__Algorithm__Type::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } MIPv4__NONE__MIP__Algorithm__Type_template::MIPv4__NONE__MIP__Algorithm__Type_template(const MIPv4__NONE__MIP__Algorithm__Type& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == MIPv4__NONE__MIP__Algorithm__Type::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Algorithm_Type."); single_value = other_value.enum_value; } MIPv4__NONE__MIP__Algorithm__Type_template::MIPv4__NONE__MIP__Algorithm__Type_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (MIPv4__NONE__MIP__Algorithm__Type::enum_type)(const MIPv4__NONE__MIP__Algorithm__Type&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Algorithm_Type from an unbound optional field."); } } MIPv4__NONE__MIP__Algorithm__Type_template::MIPv4__NONE__MIP__Algorithm__Type_template(MIPv4__NONE__MIP__Algorithm__Type_template* p_precondition, MIPv4__NONE__MIP__Algorithm__Type_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } MIPv4__NONE__MIP__Algorithm__Type_template::MIPv4__NONE__MIP__Algorithm__Type_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; } MIPv4__NONE__MIP__Algorithm__Type_template::MIPv4__NONE__MIP__Algorithm__Type_template(const MIPv4__NONE__MIP__Algorithm__Type_template& other_value) : Base_Template() { copy_template(other_value); } MIPv4__NONE__MIP__Algorithm__Type_template::~MIPv4__NONE__MIP__Algorithm__Type_template() { clean_up(); } boolean MIPv4__NONE__MIP__Algorithm__Type_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean MIPv4__NONE__MIP__Algorithm__Type_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != MIPv4__NONE__MIP__Algorithm__Type::UNBOUND_VALUE; } void MIPv4__NONE__MIP__Algorithm__Type_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } MIPv4__NONE__MIP__Algorithm__Type_template& MIPv4__NONE__MIP__Algorithm__Type_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } MIPv4__NONE__MIP__Algorithm__Type_template& MIPv4__NONE__MIP__Algorithm__Type_template::operator=(int other_value) { if (!MIPv4__NONE__MIP__Algorithm__Type::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Algorithm_Type.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (MIPv4__NONE__MIP__Algorithm__Type::enum_type)other_value; return *this; } MIPv4__NONE__MIP__Algorithm__Type_template& MIPv4__NONE__MIP__Algorithm__Type_template::operator=(MIPv4__NONE__MIP__Algorithm__Type::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } MIPv4__NONE__MIP__Algorithm__Type_template& MIPv4__NONE__MIP__Algorithm__Type_template::operator=(const MIPv4__NONE__MIP__Algorithm__Type& other_value) { if (other_value.enum_value == MIPv4__NONE__MIP__Algorithm__Type::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Algorithm_Type to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } MIPv4__NONE__MIP__Algorithm__Type_template& MIPv4__NONE__MIP__Algorithm__Type_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (MIPv4__NONE__MIP__Algorithm__Type::enum_type)(const MIPv4__NONE__MIP__Algorithm__Type&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Algorithm_Type."); } return *this; } MIPv4__NONE__MIP__Algorithm__Type_template& MIPv4__NONE__MIP__Algorithm__Type_template::operator=(const MIPv4__NONE__MIP__Algorithm__Type_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean MIPv4__NONE__MIP__Algorithm__Type_template::match(MIPv4__NONE__MIP__Algorithm__Type::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Algorithm_Type."); } return FALSE; } boolean MIPv4__NONE__MIP__Algorithm__Type_template::match(const MIPv4__NONE__MIP__Algorithm__Type& other_value, boolean) const { if (other_value.enum_value == MIPv4__NONE__MIP__Algorithm__Type::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Algorithm_Type with an unbound value."); return match(other_value.enum_value); } MIPv4__NONE__MIP__Algorithm__Type::enum_type MIPv4__NONE__MIP__Algorithm__Type_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Algorithm_Type."); return single_value; } void MIPv4__NONE__MIP__Algorithm__Type_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Algorithm_Type."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new MIPv4__NONE__MIP__Algorithm__Type_template[list_length]; } MIPv4__NONE__MIP__Algorithm__Type_template& MIPv4__NONE__MIP__Algorithm__Type_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Algorithm_Type."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Algorithm_Type."); return value_list.list_value[list_index]; } void MIPv4__NONE__MIP__Algorithm__Type_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(MIPv4__NONE__MIP__Algorithm__Type::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void MIPv4__NONE__MIP__Algorithm__Type_template::log_match(const MIPv4__NONE__MIP__Algorithm__Type& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void MIPv4__NONE__MIP__Algorithm__Type_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Algorithm_Type."); } } void MIPv4__NONE__MIP__Algorithm__Type_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (MIPv4__NONE__MIP__Algorithm__Type::enum_type)text_buf.pull_int().get_val(); if (!MIPv4__NONE__MIP__Algorithm__Type::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Algorithm_Type.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new MIPv4__NONE__MIP__Algorithm__Type_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.MIPv4_NONE_MIP_Algorithm_Type."); } } boolean MIPv4__NONE__MIP__Algorithm__Type_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean MIPv4__NONE__MIP__Algorithm__Type_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { MIPv4__NONE__MIP__Algorithm__Type_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { MIPv4__NONE__MIP__Algorithm__Type::enum_type enum_val = MIPv4__NONE__MIP__Algorithm__Type::str_to_enum(m_p->get_enumerated()); if (!MIPv4__NONE__MIP__Algorithm__Type::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.MIPv4_NONE_MIP_Algorithm_Type."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { MIPv4__NONE__MIP__Algorithm__Type_template* precondition = new MIPv4__NONE__MIP__Algorithm__Type_template; precondition->set_param(*m_p->get_elem(0)); MIPv4__NONE__MIP__Algorithm__Type_template* implied_template = new MIPv4__NONE__MIP__Algorithm__Type_template; implied_template->set_param(*m_p->get_elem(1)); *this = MIPv4__NONE__MIP__Algorithm__Type_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.MIPv4_NONE_MIP_Algorithm_Type"); } is_ifpresent = param.get_ifpresent(); } void MIPv4__NONE__MIP__Algorithm__Type_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.MIPv4_NONE_MIP_Algorithm_Type"); } PCC__3GPP__Event__Trigger::PCC__3GPP__Event__Trigger() { enum_value = UNBOUND_VALUE; } PCC__3GPP__Event__Trigger::PCC__3GPP__Event__Trigger(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.PCC_3GPP_Event_Trigger with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } PCC__3GPP__Event__Trigger::PCC__3GPP__Event__Trigger(enum_type other_value) { enum_value = other_value; } PCC__3GPP__Event__Trigger::PCC__3GPP__Event__Trigger(const PCC__3GPP__Event__Trigger& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Event_Trigger."); enum_value = other_value.enum_value; } PCC__3GPP__Event__Trigger& PCC__3GPP__Event__Trigger::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.PCC_3GPP_Event_Trigger.", other_value); enum_value = (enum_type)other_value; return *this; } PCC__3GPP__Event__Trigger& PCC__3GPP__Event__Trigger::operator=(enum_type other_value) { enum_value = other_value; return *this; } PCC__3GPP__Event__Trigger& PCC__3GPP__Event__Trigger::operator=(const PCC__3GPP__Event__Trigger& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Event_Trigger."); enum_value = other_value.enum_value; return *this; } boolean PCC__3GPP__Event__Trigger::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Event_Trigger."); return enum_value == other_value; } boolean PCC__3GPP__Event__Trigger::operator==(const PCC__3GPP__Event__Trigger& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Event_Trigger."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Event_Trigger."); return enum_value == other_value.enum_value; } boolean PCC__3GPP__Event__Trigger::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Event_Trigger."); return enum_value < other_value; } boolean PCC__3GPP__Event__Trigger::operator<(const PCC__3GPP__Event__Trigger& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Event_Trigger."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Event_Trigger."); return enum_value < other_value.enum_value; } boolean PCC__3GPP__Event__Trigger::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Event_Trigger."); return enum_value > other_value; } boolean PCC__3GPP__Event__Trigger::operator>(const PCC__3GPP__Event__Trigger& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Event_Trigger."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Event_Trigger."); return enum_value > other_value.enum_value; } const char *PCC__3GPP__Event__Trigger::enum_to_str(enum_type enum_par) { switch (enum_par) { case SGSN__CHANGE: return "SGSN_CHANGE"; case QOS__CHANGE: return "QOS_CHANGE"; case RAT__CHANGE: return "RAT_CHANGE"; case TFT__CHANGE: return "TFT_CHANGE"; case PLMN__CHANGE: return "PLMN_CHANGE"; case LOSS__OF__BEARER: return "LOSS_OF_BEARER"; case RECOVERY__OF__BEARER: return "RECOVERY_OF_BEARER"; case IP__CAN__CHANGE: return "IP_CAN_CHANGE"; case QOS__CHANGE__EXCEEDING__AUTHORIZATION: return "QOS_CHANGE_EXCEEDING_AUTHORIZATION"; case RAI__CHANGE: return "RAI_CHANGE"; case USER__LOCATION__CHANGE: return "USER_LOCATION_CHANGE"; case NO__EVENT__TRIGGERS: return "NO_EVENT_TRIGGERS"; case OUT__OF__CREDIT: return "OUT_OF_CREDIT"; case REALLOCATION__OF__CREDIT: return "REALLOCATION_OF_CREDIT"; case REVALIDATION__TIMEOUT: return "REVALIDATION_TIMEOUT"; case UE__IP__ADDRESS__ALLOCATE: return "UE_IP_ADDRESS_ALLOCATE"; case UE__IP__ADDRESS__RELEASE: return "UE_IP_ADDRESS_RELEASE"; case DEFAULT__EPS__BEARER__QOS__CHANGE: return "DEFAULT_EPS_BEARER_QOS_CHANGE"; case AN__GW__CHANGE: return "AN_GW_CHANGE"; case SUCCESSFUL__RESOURCE__ALLOCATION: return "SUCCESSFUL_RESOURCE_ALLOCATION"; case RESOURCE__MODIFICATION__REQUEST: return "RESOURCE_MODIFICATION_REQUEST"; case PGW__TRACE__CONTROL: return "PGW_TRACE_CONTROL"; case UE__TIME__ZONE__CHANGE: return "UE_TIME_ZONE_CHANGE"; case TAI__CHANGE: return "TAI_CHANGE"; case ECGI__CHANGE: return "ECGI_CHANGE"; case CHARGING__CORRELATION__EXCHANGE: return "CHARGING_CORRELATION_EXCHANGE"; case APN__AMBR__MODIFICATION__FAILURE: return "APN_AMBR_MODIFICATION_FAILURE"; case USER__CSG__INFORMATION__CHANGE: return "USER_CSG_INFORMATION_CHANGE"; case USAGE__REPORT: return "USAGE_REPORT"; case DEFAULT__EPS__BEARER__QOS__MODIFICATION__FAILURE: return "DEFAULT_EPS_BEARER_QOS_MODIFICATION_FAILURE"; case USER__CSG__HYBRID__SUBSCRIBED__INFORMATION__CHANGE: return "USER_CSG_HYBRID_SUBSCRIBED_INFORMATION_CHANGE"; case USER__CSG__HYBRID__UNSUBSCRIBED__INFORMATION__CHANGE: return "USER_CSG_HYBRID_UNSUBSCRIBED_INFORMATION_CHANGE"; case ROUTING__RULE__CHANGE: return "ROUTING_RULE_CHANGE"; case APPLICATION__START: return "APPLICATION_START"; case APPLICATION__STOP: return "APPLICATION_STOP"; case CS__TO__PS__HANDOVER: return "CS_TO_PS_HANDOVER"; case UE__LOCAL__IP__ADDRESS__CHANGE: return "UE_LOCAL_IP_ADDRESS_CHANGE"; case HENB__LOCAL__IP__ADDRESS__CHANGE: return "HENB_LOCAL_IP_ADDRESS_CHANGE"; case ACCESS__NETWORK__INFO__REPORT: return "ACCESS_NETWORK_INFO_REPORT"; case CREDIT__MANAGEMENT__SESSION__FAILURE: return "CREDIT_MANAGEMENT_SESSION_FAILURE"; case DEFAULT__QOS__CHANGE: return "DEFAULT_QOS_CHANGE"; case CHANGE__OF__UE__PRESENCE__IN__PRESENCE__REPORTING__AREA__REPORT: return "CHANGE_OF_UE_PRESENCE_IN_PRESENCE_REPORTING_AREA_REPORT"; case ADDITION__OF__ACCESS: return "ADDITION_OF_ACCESS"; case REMOVAL__OF__ACCESS: return "REMOVAL_OF_ACCESS"; case UNAVAILABLITY__OF__ACCESS: return "UNAVAILABLITY_OF_ACCESS"; case AVAILABLITY__OF__ACCESS: return "AVAILABLITY_OF_ACCESS"; case RESOURCE__RELEASE: return "RESOURCE_RELEASE"; case ENODEB__CHANGE: return "ENODEB_CHANGE"; case THREEGPP__PS__DATA__OFF__CHANGE: return "THREEGPP_PS_DATA_OFF_CHANGE"; default: return ""; } } PCC__3GPP__Event__Trigger::enum_type PCC__3GPP__Event__Trigger::str_to_enum(const char *str_par) { if (!strcmp(str_par, "SGSN_CHANGE")) return SGSN__CHANGE; else if (!strcmp(str_par, "QOS_CHANGE")) return QOS__CHANGE; else if (!strcmp(str_par, "RAT_CHANGE")) return RAT__CHANGE; else if (!strcmp(str_par, "TFT_CHANGE")) return TFT__CHANGE; else if (!strcmp(str_par, "PLMN_CHANGE")) return PLMN__CHANGE; else if (!strcmp(str_par, "LOSS_OF_BEARER")) return LOSS__OF__BEARER; else if (!strcmp(str_par, "RECOVERY_OF_BEARER")) return RECOVERY__OF__BEARER; else if (!strcmp(str_par, "IP_CAN_CHANGE")) return IP__CAN__CHANGE; else if (!strcmp(str_par, "QOS_CHANGE_EXCEEDING_AUTHORIZATION")) return QOS__CHANGE__EXCEEDING__AUTHORIZATION; else if (!strcmp(str_par, "RAI_CHANGE")) return RAI__CHANGE; else if (!strcmp(str_par, "USER_LOCATION_CHANGE")) return USER__LOCATION__CHANGE; else if (!strcmp(str_par, "NO_EVENT_TRIGGERS")) return NO__EVENT__TRIGGERS; else if (!strcmp(str_par, "OUT_OF_CREDIT")) return OUT__OF__CREDIT; else if (!strcmp(str_par, "REALLOCATION_OF_CREDIT")) return REALLOCATION__OF__CREDIT; else if (!strcmp(str_par, "REVALIDATION_TIMEOUT")) return REVALIDATION__TIMEOUT; else if (!strcmp(str_par, "UE_IP_ADDRESS_ALLOCATE")) return UE__IP__ADDRESS__ALLOCATE; else if (!strcmp(str_par, "UE_IP_ADDRESS_RELEASE")) return UE__IP__ADDRESS__RELEASE; else if (!strcmp(str_par, "DEFAULT_EPS_BEARER_QOS_CHANGE")) return DEFAULT__EPS__BEARER__QOS__CHANGE; else if (!strcmp(str_par, "AN_GW_CHANGE")) return AN__GW__CHANGE; else if (!strcmp(str_par, "SUCCESSFUL_RESOURCE_ALLOCATION")) return SUCCESSFUL__RESOURCE__ALLOCATION; else if (!strcmp(str_par, "RESOURCE_MODIFICATION_REQUEST")) return RESOURCE__MODIFICATION__REQUEST; else if (!strcmp(str_par, "PGW_TRACE_CONTROL")) return PGW__TRACE__CONTROL; else if (!strcmp(str_par, "UE_TIME_ZONE_CHANGE")) return UE__TIME__ZONE__CHANGE; else if (!strcmp(str_par, "TAI_CHANGE")) return TAI__CHANGE; else if (!strcmp(str_par, "ECGI_CHANGE")) return ECGI__CHANGE; else if (!strcmp(str_par, "CHARGING_CORRELATION_EXCHANGE")) return CHARGING__CORRELATION__EXCHANGE; else if (!strcmp(str_par, "APN_AMBR_MODIFICATION_FAILURE")) return APN__AMBR__MODIFICATION__FAILURE; else if (!strcmp(str_par, "USER_CSG_INFORMATION_CHANGE")) return USER__CSG__INFORMATION__CHANGE; else if (!strcmp(str_par, "USAGE_REPORT")) return USAGE__REPORT; else if (!strcmp(str_par, "DEFAULT_EPS_BEARER_QOS_MODIFICATION_FAILURE")) return DEFAULT__EPS__BEARER__QOS__MODIFICATION__FAILURE; else if (!strcmp(str_par, "USER_CSG_HYBRID_SUBSCRIBED_INFORMATION_CHANGE")) return USER__CSG__HYBRID__SUBSCRIBED__INFORMATION__CHANGE; else if (!strcmp(str_par, "USER_CSG_HYBRID_UNSUBSCRIBED_INFORMATION_CHANGE")) return USER__CSG__HYBRID__UNSUBSCRIBED__INFORMATION__CHANGE; else if (!strcmp(str_par, "ROUTING_RULE_CHANGE")) return ROUTING__RULE__CHANGE; else if (!strcmp(str_par, "APPLICATION_START")) return APPLICATION__START; else if (!strcmp(str_par, "APPLICATION_STOP")) return APPLICATION__STOP; else if (!strcmp(str_par, "CS_TO_PS_HANDOVER")) return CS__TO__PS__HANDOVER; else if (!strcmp(str_par, "UE_LOCAL_IP_ADDRESS_CHANGE")) return UE__LOCAL__IP__ADDRESS__CHANGE; else if (!strcmp(str_par, "HENB_LOCAL_IP_ADDRESS_CHANGE")) return HENB__LOCAL__IP__ADDRESS__CHANGE; else if (!strcmp(str_par, "ACCESS_NETWORK_INFO_REPORT")) return ACCESS__NETWORK__INFO__REPORT; else if (!strcmp(str_par, "CREDIT_MANAGEMENT_SESSION_FAILURE")) return CREDIT__MANAGEMENT__SESSION__FAILURE; else if (!strcmp(str_par, "DEFAULT_QOS_CHANGE")) return DEFAULT__QOS__CHANGE; else if (!strcmp(str_par, "CHANGE_OF_UE_PRESENCE_IN_PRESENCE_REPORTING_AREA_REPORT")) return CHANGE__OF__UE__PRESENCE__IN__PRESENCE__REPORTING__AREA__REPORT; else if (!strcmp(str_par, "ADDITION_OF_ACCESS")) return ADDITION__OF__ACCESS; else if (!strcmp(str_par, "REMOVAL_OF_ACCESS")) return REMOVAL__OF__ACCESS; else if (!strcmp(str_par, "UNAVAILABLITY_OF_ACCESS")) return UNAVAILABLITY__OF__ACCESS; else if (!strcmp(str_par, "AVAILABLITY_OF_ACCESS")) return AVAILABLITY__OF__ACCESS; else if (!strcmp(str_par, "RESOURCE_RELEASE")) return RESOURCE__RELEASE; else if (!strcmp(str_par, "ENODEB_CHANGE")) return ENODEB__CHANGE; else if (!strcmp(str_par, "THREEGPP_PS_DATA_OFF_CHANGE")) return THREEGPP__PS__DATA__OFF__CHANGE; else return UNKNOWN_VALUE; } boolean PCC__3GPP__Event__Trigger::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 11: case 12: case 13: case 14: case 15: case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23: case 24: case 25: case 26: case 27: case 28: case 29: case 30: case 33: case 34: case 35: case 36: case 37: case 39: case 40: case 42: case 43: case 44: case 45: case 46: case 47: case 48: case 49: case 50: case 51: case 52: case 53: case 54: case 55: return TRUE; default: return FALSE; } } int PCC__3GPP__Event__Trigger::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.PCC_3GPP_Event_Trigger.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int PCC__3GPP__Event__Trigger::enum2int(const PCC__3GPP__Event__Trigger& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.PCC_3GPP_Event_Trigger.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void PCC__3GPP__Event__Trigger::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.PCC_3GPP_Event_Trigger.", int_val); enum_value = (enum_type)int_val; } PCC__3GPP__Event__Trigger::operator PCC__3GPP__Event__Trigger::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.PCC_3GPP_Event_Trigger."); return enum_value; } void PCC__3GPP__Event__Trigger::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void PCC__3GPP__Event__Trigger::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.PCC_3GPP_Event_Trigger"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.PCC_3GPP_Event_Trigger."); } } void PCC__3GPP__Event__Trigger::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Event_Trigger."); text_buf.push_int(enum_value); } void PCC__3GPP__Event__Trigger::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.PCC_3GPP_Event_Trigger.", enum_value); } void PCC__3GPP__Event__Trigger::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void PCC__3GPP__Event__Trigger::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int PCC__3GPP__Event__Trigger::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 6, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int PCC__3GPP__Event__Trigger::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 6); } void PCC__3GPP__Event__Trigger_template::copy_template(const PCC__3GPP__Event__Trigger_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new PCC__3GPP__Event__Trigger_template[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 PCC__3GPP__Event__Trigger_template(*other_value.implication_.precondition); implication_.implied_template = new PCC__3GPP__Event__Trigger_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.PCC_3GPP_Event_Trigger."); } } PCC__3GPP__Event__Trigger_template::PCC__3GPP__Event__Trigger_template() { } PCC__3GPP__Event__Trigger_template::PCC__3GPP__Event__Trigger_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } PCC__3GPP__Event__Trigger_template::PCC__3GPP__Event__Trigger_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!PCC__3GPP__Event__Trigger::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.PCC_3GPP_Event_Trigger with unknown numeric value %d.", other_value); single_value = (PCC__3GPP__Event__Trigger::enum_type)other_value; } PCC__3GPP__Event__Trigger_template::PCC__3GPP__Event__Trigger_template(PCC__3GPP__Event__Trigger::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } PCC__3GPP__Event__Trigger_template::PCC__3GPP__Event__Trigger_template(const PCC__3GPP__Event__Trigger& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == PCC__3GPP__Event__Trigger::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Event_Trigger."); single_value = other_value.enum_value; } PCC__3GPP__Event__Trigger_template::PCC__3GPP__Event__Trigger_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (PCC__3GPP__Event__Trigger::enum_type)(const PCC__3GPP__Event__Trigger&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.PCC_3GPP_Event_Trigger from an unbound optional field."); } } PCC__3GPP__Event__Trigger_template::PCC__3GPP__Event__Trigger_template(PCC__3GPP__Event__Trigger_template* p_precondition, PCC__3GPP__Event__Trigger_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } PCC__3GPP__Event__Trigger_template::PCC__3GPP__Event__Trigger_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; } PCC__3GPP__Event__Trigger_template::PCC__3GPP__Event__Trigger_template(const PCC__3GPP__Event__Trigger_template& other_value) : Base_Template() { copy_template(other_value); } PCC__3GPP__Event__Trigger_template::~PCC__3GPP__Event__Trigger_template() { clean_up(); } boolean PCC__3GPP__Event__Trigger_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean PCC__3GPP__Event__Trigger_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != PCC__3GPP__Event__Trigger::UNBOUND_VALUE; } void PCC__3GPP__Event__Trigger_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } PCC__3GPP__Event__Trigger_template& PCC__3GPP__Event__Trigger_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } PCC__3GPP__Event__Trigger_template& PCC__3GPP__Event__Trigger_template::operator=(int other_value) { if (!PCC__3GPP__Event__Trigger::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.PCC_3GPP_Event_Trigger.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (PCC__3GPP__Event__Trigger::enum_type)other_value; return *this; } PCC__3GPP__Event__Trigger_template& PCC__3GPP__Event__Trigger_template::operator=(PCC__3GPP__Event__Trigger::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } PCC__3GPP__Event__Trigger_template& PCC__3GPP__Event__Trigger_template::operator=(const PCC__3GPP__Event__Trigger& other_value) { if (other_value.enum_value == PCC__3GPP__Event__Trigger::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Event_Trigger to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } PCC__3GPP__Event__Trigger_template& PCC__3GPP__Event__Trigger_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (PCC__3GPP__Event__Trigger::enum_type)(const PCC__3GPP__Event__Trigger&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.PCC_3GPP_Event_Trigger."); } return *this; } PCC__3GPP__Event__Trigger_template& PCC__3GPP__Event__Trigger_template::operator=(const PCC__3GPP__Event__Trigger_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean PCC__3GPP__Event__Trigger_template::match(PCC__3GPP__Event__Trigger::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.PCC_3GPP_Event_Trigger."); } return FALSE; } boolean PCC__3GPP__Event__Trigger_template::match(const PCC__3GPP__Event__Trigger& other_value, boolean) const { if (other_value.enum_value == PCC__3GPP__Event__Trigger::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.PCC_3GPP_Event_Trigger with an unbound value."); return match(other_value.enum_value); } PCC__3GPP__Event__Trigger::enum_type PCC__3GPP__Event__Trigger_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.PCC_3GPP_Event_Trigger."); return single_value; } void PCC__3GPP__Event__Trigger_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.PCC_3GPP_Event_Trigger."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new PCC__3GPP__Event__Trigger_template[list_length]; } PCC__3GPP__Event__Trigger_template& PCC__3GPP__Event__Trigger_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.PCC_3GPP_Event_Trigger."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.PCC_3GPP_Event_Trigger."); return value_list.list_value[list_index]; } void PCC__3GPP__Event__Trigger_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(PCC__3GPP__Event__Trigger::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void PCC__3GPP__Event__Trigger_template::log_match(const PCC__3GPP__Event__Trigger& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void PCC__3GPP__Event__Trigger_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.PCC_3GPP_Event_Trigger."); } } void PCC__3GPP__Event__Trigger_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (PCC__3GPP__Event__Trigger::enum_type)text_buf.pull_int().get_val(); if (!PCC__3GPP__Event__Trigger::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.PCC_3GPP_Event_Trigger.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new PCC__3GPP__Event__Trigger_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.PCC_3GPP_Event_Trigger."); } } boolean PCC__3GPP__Event__Trigger_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean PCC__3GPP__Event__Trigger_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { PCC__3GPP__Event__Trigger_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { PCC__3GPP__Event__Trigger::enum_type enum_val = PCC__3GPP__Event__Trigger::str_to_enum(m_p->get_enumerated()); if (!PCC__3GPP__Event__Trigger::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.PCC_3GPP_Event_Trigger."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { PCC__3GPP__Event__Trigger_template* precondition = new PCC__3GPP__Event__Trigger_template; precondition->set_param(*m_p->get_elem(0)); PCC__3GPP__Event__Trigger_template* implied_template = new PCC__3GPP__Event__Trigger_template; implied_template->set_param(*m_p->get_elem(1)); *this = PCC__3GPP__Event__Trigger_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.PCC_3GPP_Event_Trigger"); } is_ifpresent = param.get_ifpresent(); } void PCC__3GPP__Event__Trigger_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.PCC_3GPP_Event_Trigger"); } AAA__3GPP__Non__IP__PDN__Type__Indicator::AAA__3GPP__Non__IP__PDN__Type__Indicator() { enum_value = UNBOUND_VALUE; } AAA__3GPP__Non__IP__PDN__Type__Indicator::AAA__3GPP__Non__IP__PDN__Type__Indicator(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.AAA_3GPP_Non_IP_PDN_Type_Indicator with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } AAA__3GPP__Non__IP__PDN__Type__Indicator::AAA__3GPP__Non__IP__PDN__Type__Indicator(enum_type other_value) { enum_value = other_value; } AAA__3GPP__Non__IP__PDN__Type__Indicator::AAA__3GPP__Non__IP__PDN__Type__Indicator(const AAA__3GPP__Non__IP__PDN__Type__Indicator& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Non_IP_PDN_Type_Indicator."); enum_value = other_value.enum_value; } AAA__3GPP__Non__IP__PDN__Type__Indicator& AAA__3GPP__Non__IP__PDN__Type__Indicator::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.AAA_3GPP_Non_IP_PDN_Type_Indicator.", other_value); enum_value = (enum_type)other_value; return *this; } AAA__3GPP__Non__IP__PDN__Type__Indicator& AAA__3GPP__Non__IP__PDN__Type__Indicator::operator=(enum_type other_value) { enum_value = other_value; return *this; } AAA__3GPP__Non__IP__PDN__Type__Indicator& AAA__3GPP__Non__IP__PDN__Type__Indicator::operator=(const AAA__3GPP__Non__IP__PDN__Type__Indicator& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Non_IP_PDN_Type_Indicator."); enum_value = other_value.enum_value; return *this; } boolean AAA__3GPP__Non__IP__PDN__Type__Indicator::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Non_IP_PDN_Type_Indicator."); return enum_value == other_value; } boolean AAA__3GPP__Non__IP__PDN__Type__Indicator::operator==(const AAA__3GPP__Non__IP__PDN__Type__Indicator& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Non_IP_PDN_Type_Indicator."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Non_IP_PDN_Type_Indicator."); return enum_value == other_value.enum_value; } boolean AAA__3GPP__Non__IP__PDN__Type__Indicator::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Non_IP_PDN_Type_Indicator."); return enum_value < other_value; } boolean AAA__3GPP__Non__IP__PDN__Type__Indicator::operator<(const AAA__3GPP__Non__IP__PDN__Type__Indicator& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Non_IP_PDN_Type_Indicator."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Non_IP_PDN_Type_Indicator."); return enum_value < other_value.enum_value; } boolean AAA__3GPP__Non__IP__PDN__Type__Indicator::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Non_IP_PDN_Type_Indicator."); return enum_value > other_value; } boolean AAA__3GPP__Non__IP__PDN__Type__Indicator::operator>(const AAA__3GPP__Non__IP__PDN__Type__Indicator& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Non_IP_PDN_Type_Indicator."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Non_IP_PDN_Type_Indicator."); return enum_value > other_value.enum_value; } const char *AAA__3GPP__Non__IP__PDN__Type__Indicator::enum_to_str(enum_type enum_par) { switch (enum_par) { case FALSE__VALUE: return "FALSE_VALUE"; case TRUE__VALUE: return "TRUE_VALUE"; default: return ""; } } AAA__3GPP__Non__IP__PDN__Type__Indicator::enum_type AAA__3GPP__Non__IP__PDN__Type__Indicator::str_to_enum(const char *str_par) { if (!strcmp(str_par, "FALSE_VALUE")) return FALSE__VALUE; else if (!strcmp(str_par, "TRUE_VALUE")) return TRUE__VALUE; else return UNKNOWN_VALUE; } boolean AAA__3GPP__Non__IP__PDN__Type__Indicator::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: return TRUE; default: return FALSE; } } int AAA__3GPP__Non__IP__PDN__Type__Indicator::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.AAA_3GPP_Non_IP_PDN_Type_Indicator.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int AAA__3GPP__Non__IP__PDN__Type__Indicator::enum2int(const AAA__3GPP__Non__IP__PDN__Type__Indicator& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.AAA_3GPP_Non_IP_PDN_Type_Indicator.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void AAA__3GPP__Non__IP__PDN__Type__Indicator::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.AAA_3GPP_Non_IP_PDN_Type_Indicator.", int_val); enum_value = (enum_type)int_val; } AAA__3GPP__Non__IP__PDN__Type__Indicator::operator AAA__3GPP__Non__IP__PDN__Type__Indicator::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.AAA_3GPP_Non_IP_PDN_Type_Indicator."); return enum_value; } void AAA__3GPP__Non__IP__PDN__Type__Indicator::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void AAA__3GPP__Non__IP__PDN__Type__Indicator::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.AAA_3GPP_Non_IP_PDN_Type_Indicator"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.AAA_3GPP_Non_IP_PDN_Type_Indicator."); } } void AAA__3GPP__Non__IP__PDN__Type__Indicator::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Non_IP_PDN_Type_Indicator."); text_buf.push_int(enum_value); } void AAA__3GPP__Non__IP__PDN__Type__Indicator::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.AAA_3GPP_Non_IP_PDN_Type_Indicator.", enum_value); } void AAA__3GPP__Non__IP__PDN__Type__Indicator::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void AAA__3GPP__Non__IP__PDN__Type__Indicator::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int AAA__3GPP__Non__IP__PDN__Type__Indicator::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int AAA__3GPP__Non__IP__PDN__Type__Indicator::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void AAA__3GPP__Non__IP__PDN__Type__Indicator_template::copy_template(const AAA__3GPP__Non__IP__PDN__Type__Indicator_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new AAA__3GPP__Non__IP__PDN__Type__Indicator_template[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 AAA__3GPP__Non__IP__PDN__Type__Indicator_template(*other_value.implication_.precondition); implication_.implied_template = new AAA__3GPP__Non__IP__PDN__Type__Indicator_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_Non_IP_PDN_Type_Indicator."); } } AAA__3GPP__Non__IP__PDN__Type__Indicator_template::AAA__3GPP__Non__IP__PDN__Type__Indicator_template() { } AAA__3GPP__Non__IP__PDN__Type__Indicator_template::AAA__3GPP__Non__IP__PDN__Type__Indicator_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } AAA__3GPP__Non__IP__PDN__Type__Indicator_template::AAA__3GPP__Non__IP__PDN__Type__Indicator_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!AAA__3GPP__Non__IP__PDN__Type__Indicator::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.AAA_3GPP_Non_IP_PDN_Type_Indicator with unknown numeric value %d.", other_value); single_value = (AAA__3GPP__Non__IP__PDN__Type__Indicator::enum_type)other_value; } AAA__3GPP__Non__IP__PDN__Type__Indicator_template::AAA__3GPP__Non__IP__PDN__Type__Indicator_template(AAA__3GPP__Non__IP__PDN__Type__Indicator::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } AAA__3GPP__Non__IP__PDN__Type__Indicator_template::AAA__3GPP__Non__IP__PDN__Type__Indicator_template(const AAA__3GPP__Non__IP__PDN__Type__Indicator& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == AAA__3GPP__Non__IP__PDN__Type__Indicator::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Non_IP_PDN_Type_Indicator."); single_value = other_value.enum_value; } AAA__3GPP__Non__IP__PDN__Type__Indicator_template::AAA__3GPP__Non__IP__PDN__Type__Indicator_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__Non__IP__PDN__Type__Indicator::enum_type)(const AAA__3GPP__Non__IP__PDN__Type__Indicator&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.AAA_3GPP_Non_IP_PDN_Type_Indicator from an unbound optional field."); } } AAA__3GPP__Non__IP__PDN__Type__Indicator_template::AAA__3GPP__Non__IP__PDN__Type__Indicator_template(AAA__3GPP__Non__IP__PDN__Type__Indicator_template* p_precondition, AAA__3GPP__Non__IP__PDN__Type__Indicator_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } AAA__3GPP__Non__IP__PDN__Type__Indicator_template::AAA__3GPP__Non__IP__PDN__Type__Indicator_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; } AAA__3GPP__Non__IP__PDN__Type__Indicator_template::AAA__3GPP__Non__IP__PDN__Type__Indicator_template(const AAA__3GPP__Non__IP__PDN__Type__Indicator_template& other_value) : Base_Template() { copy_template(other_value); } AAA__3GPP__Non__IP__PDN__Type__Indicator_template::~AAA__3GPP__Non__IP__PDN__Type__Indicator_template() { clean_up(); } boolean AAA__3GPP__Non__IP__PDN__Type__Indicator_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean AAA__3GPP__Non__IP__PDN__Type__Indicator_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != AAA__3GPP__Non__IP__PDN__Type__Indicator::UNBOUND_VALUE; } void AAA__3GPP__Non__IP__PDN__Type__Indicator_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } AAA__3GPP__Non__IP__PDN__Type__Indicator_template& AAA__3GPP__Non__IP__PDN__Type__Indicator_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } AAA__3GPP__Non__IP__PDN__Type__Indicator_template& AAA__3GPP__Non__IP__PDN__Type__Indicator_template::operator=(int other_value) { if (!AAA__3GPP__Non__IP__PDN__Type__Indicator::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.AAA_3GPP_Non_IP_PDN_Type_Indicator.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__Non__IP__PDN__Type__Indicator::enum_type)other_value; return *this; } AAA__3GPP__Non__IP__PDN__Type__Indicator_template& AAA__3GPP__Non__IP__PDN__Type__Indicator_template::operator=(AAA__3GPP__Non__IP__PDN__Type__Indicator::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } AAA__3GPP__Non__IP__PDN__Type__Indicator_template& AAA__3GPP__Non__IP__PDN__Type__Indicator_template::operator=(const AAA__3GPP__Non__IP__PDN__Type__Indicator& other_value) { if (other_value.enum_value == AAA__3GPP__Non__IP__PDN__Type__Indicator::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Non_IP_PDN_Type_Indicator to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } AAA__3GPP__Non__IP__PDN__Type__Indicator_template& AAA__3GPP__Non__IP__PDN__Type__Indicator_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__Non__IP__PDN__Type__Indicator::enum_type)(const AAA__3GPP__Non__IP__PDN__Type__Indicator&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.AAA_3GPP_Non_IP_PDN_Type_Indicator."); } return *this; } AAA__3GPP__Non__IP__PDN__Type__Indicator_template& AAA__3GPP__Non__IP__PDN__Type__Indicator_template::operator=(const AAA__3GPP__Non__IP__PDN__Type__Indicator_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean AAA__3GPP__Non__IP__PDN__Type__Indicator_template::match(AAA__3GPP__Non__IP__PDN__Type__Indicator::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_Non_IP_PDN_Type_Indicator."); } return FALSE; } boolean AAA__3GPP__Non__IP__PDN__Type__Indicator_template::match(const AAA__3GPP__Non__IP__PDN__Type__Indicator& other_value, boolean) const { if (other_value.enum_value == AAA__3GPP__Non__IP__PDN__Type__Indicator::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.AAA_3GPP_Non_IP_PDN_Type_Indicator with an unbound value."); return match(other_value.enum_value); } AAA__3GPP__Non__IP__PDN__Type__Indicator::enum_type AAA__3GPP__Non__IP__PDN__Type__Indicator_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.AAA_3GPP_Non_IP_PDN_Type_Indicator."); return single_value; } void AAA__3GPP__Non__IP__PDN__Type__Indicator_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.AAA_3GPP_Non_IP_PDN_Type_Indicator."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new AAA__3GPP__Non__IP__PDN__Type__Indicator_template[list_length]; } AAA__3GPP__Non__IP__PDN__Type__Indicator_template& AAA__3GPP__Non__IP__PDN__Type__Indicator_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.AAA_3GPP_Non_IP_PDN_Type_Indicator."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.AAA_3GPP_Non_IP_PDN_Type_Indicator."); return value_list.list_value[list_index]; } void AAA__3GPP__Non__IP__PDN__Type__Indicator_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(AAA__3GPP__Non__IP__PDN__Type__Indicator::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void AAA__3GPP__Non__IP__PDN__Type__Indicator_template::log_match(const AAA__3GPP__Non__IP__PDN__Type__Indicator& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void AAA__3GPP__Non__IP__PDN__Type__Indicator_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_Non_IP_PDN_Type_Indicator."); } } void AAA__3GPP__Non__IP__PDN__Type__Indicator_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (AAA__3GPP__Non__IP__PDN__Type__Indicator::enum_type)text_buf.pull_int().get_val(); if (!AAA__3GPP__Non__IP__PDN__Type__Indicator::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.AAA_3GPP_Non_IP_PDN_Type_Indicator.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new AAA__3GPP__Non__IP__PDN__Type__Indicator_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.AAA_3GPP_Non_IP_PDN_Type_Indicator."); } } boolean AAA__3GPP__Non__IP__PDN__Type__Indicator_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean AAA__3GPP__Non__IP__PDN__Type__Indicator_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { AAA__3GPP__Non__IP__PDN__Type__Indicator_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { AAA__3GPP__Non__IP__PDN__Type__Indicator::enum_type enum_val = AAA__3GPP__Non__IP__PDN__Type__Indicator::str_to_enum(m_p->get_enumerated()); if (!AAA__3GPP__Non__IP__PDN__Type__Indicator::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.AAA_3GPP_Non_IP_PDN_Type_Indicator."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { AAA__3GPP__Non__IP__PDN__Type__Indicator_template* precondition = new AAA__3GPP__Non__IP__PDN__Type__Indicator_template; precondition->set_param(*m_p->get_elem(0)); AAA__3GPP__Non__IP__PDN__Type__Indicator_template* implied_template = new AAA__3GPP__Non__IP__PDN__Type__Indicator_template; implied_template->set_param(*m_p->get_elem(1)); *this = AAA__3GPP__Non__IP__PDN__Type__Indicator_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.AAA_3GPP_Non_IP_PDN_Type_Indicator"); } is_ifpresent = param.get_ifpresent(); } void AAA__3GPP__Non__IP__PDN__Type__Indicator_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.AAA_3GPP_Non_IP_PDN_Type_Indicator"); } DCA__3GPP__Dynamic__Address__Flag::DCA__3GPP__Dynamic__Address__Flag() { enum_value = UNBOUND_VALUE; } DCA__3GPP__Dynamic__Address__Flag::DCA__3GPP__Dynamic__Address__Flag(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } DCA__3GPP__Dynamic__Address__Flag::DCA__3GPP__Dynamic__Address__Flag(enum_type other_value) { enum_value = other_value; } DCA__3GPP__Dynamic__Address__Flag::DCA__3GPP__Dynamic__Address__Flag(const DCA__3GPP__Dynamic__Address__Flag& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag."); enum_value = other_value.enum_value; } DCA__3GPP__Dynamic__Address__Flag& DCA__3GPP__Dynamic__Address__Flag::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag.", other_value); enum_value = (enum_type)other_value; return *this; } DCA__3GPP__Dynamic__Address__Flag& DCA__3GPP__Dynamic__Address__Flag::operator=(enum_type other_value) { enum_value = other_value; return *this; } DCA__3GPP__Dynamic__Address__Flag& DCA__3GPP__Dynamic__Address__Flag::operator=(const DCA__3GPP__Dynamic__Address__Flag& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag."); enum_value = other_value.enum_value; return *this; } boolean DCA__3GPP__Dynamic__Address__Flag::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag."); return enum_value == other_value; } boolean DCA__3GPP__Dynamic__Address__Flag::operator==(const DCA__3GPP__Dynamic__Address__Flag& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag."); return enum_value == other_value.enum_value; } boolean DCA__3GPP__Dynamic__Address__Flag::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag."); return enum_value < other_value; } boolean DCA__3GPP__Dynamic__Address__Flag::operator<(const DCA__3GPP__Dynamic__Address__Flag& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag."); return enum_value < other_value.enum_value; } boolean DCA__3GPP__Dynamic__Address__Flag::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag."); return enum_value > other_value; } boolean DCA__3GPP__Dynamic__Address__Flag::operator>(const DCA__3GPP__Dynamic__Address__Flag& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag."); return enum_value > other_value.enum_value; } const char *DCA__3GPP__Dynamic__Address__Flag::enum_to_str(enum_type enum_par) { switch (enum_par) { case STATIC: return "STATIC"; case DYNAMIC: return "DYNAMIC"; default: return ""; } } DCA__3GPP__Dynamic__Address__Flag::enum_type DCA__3GPP__Dynamic__Address__Flag::str_to_enum(const char *str_par) { if (!strcmp(str_par, "STATIC")) return STATIC; else if (!strcmp(str_par, "DYNAMIC")) return DYNAMIC; else return UNKNOWN_VALUE; } boolean DCA__3GPP__Dynamic__Address__Flag::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: return TRUE; default: return FALSE; } } int DCA__3GPP__Dynamic__Address__Flag::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int DCA__3GPP__Dynamic__Address__Flag::enum2int(const DCA__3GPP__Dynamic__Address__Flag& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void DCA__3GPP__Dynamic__Address__Flag::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag.", int_val); enum_value = (enum_type)int_val; } DCA__3GPP__Dynamic__Address__Flag::operator DCA__3GPP__Dynamic__Address__Flag::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag."); return enum_value; } void DCA__3GPP__Dynamic__Address__Flag::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void DCA__3GPP__Dynamic__Address__Flag::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag."); } } void DCA__3GPP__Dynamic__Address__Flag::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag."); text_buf.push_int(enum_value); } void DCA__3GPP__Dynamic__Address__Flag::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag.", enum_value); } void DCA__3GPP__Dynamic__Address__Flag::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void DCA__3GPP__Dynamic__Address__Flag::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int DCA__3GPP__Dynamic__Address__Flag::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int DCA__3GPP__Dynamic__Address__Flag::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void DCA__3GPP__Dynamic__Address__Flag_template::copy_template(const DCA__3GPP__Dynamic__Address__Flag_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new DCA__3GPP__Dynamic__Address__Flag_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].copy_template(other_value.value_list.list_value[list_count]); break; case IMPLICATION_MATCH: implication_.precondition = new DCA__3GPP__Dynamic__Address__Flag_template(*other_value.implication_.precondition); implication_.implied_template = new DCA__3GPP__Dynamic__Address__Flag_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag."); } } DCA__3GPP__Dynamic__Address__Flag_template::DCA__3GPP__Dynamic__Address__Flag_template() { } DCA__3GPP__Dynamic__Address__Flag_template::DCA__3GPP__Dynamic__Address__Flag_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } DCA__3GPP__Dynamic__Address__Flag_template::DCA__3GPP__Dynamic__Address__Flag_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!DCA__3GPP__Dynamic__Address__Flag::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag with unknown numeric value %d.", other_value); single_value = (DCA__3GPP__Dynamic__Address__Flag::enum_type)other_value; } DCA__3GPP__Dynamic__Address__Flag_template::DCA__3GPP__Dynamic__Address__Flag_template(DCA__3GPP__Dynamic__Address__Flag::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } DCA__3GPP__Dynamic__Address__Flag_template::DCA__3GPP__Dynamic__Address__Flag_template(const DCA__3GPP__Dynamic__Address__Flag& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == DCA__3GPP__Dynamic__Address__Flag::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag."); single_value = other_value.enum_value; } DCA__3GPP__Dynamic__Address__Flag_template::DCA__3GPP__Dynamic__Address__Flag_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Dynamic__Address__Flag::enum_type)(const DCA__3GPP__Dynamic__Address__Flag&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag from an unbound optional field."); } } DCA__3GPP__Dynamic__Address__Flag_template::DCA__3GPP__Dynamic__Address__Flag_template(DCA__3GPP__Dynamic__Address__Flag_template* p_precondition, DCA__3GPP__Dynamic__Address__Flag_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } DCA__3GPP__Dynamic__Address__Flag_template::DCA__3GPP__Dynamic__Address__Flag_template(Dynamic_Match_Interface* p_dyn_match) : Base_Template(DYNAMIC_MATCH) { dyn_match = new dynmatch_struct; dyn_match->ptr = p_dyn_match; dyn_match->ref_count = 1; } DCA__3GPP__Dynamic__Address__Flag_template::DCA__3GPP__Dynamic__Address__Flag_template(const DCA__3GPP__Dynamic__Address__Flag_template& other_value) : Base_Template() { copy_template(other_value); } DCA__3GPP__Dynamic__Address__Flag_template::~DCA__3GPP__Dynamic__Address__Flag_template() { clean_up(); } boolean DCA__3GPP__Dynamic__Address__Flag_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean DCA__3GPP__Dynamic__Address__Flag_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != DCA__3GPP__Dynamic__Address__Flag::UNBOUND_VALUE; } void DCA__3GPP__Dynamic__Address__Flag_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } DCA__3GPP__Dynamic__Address__Flag_template& DCA__3GPP__Dynamic__Address__Flag_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } DCA__3GPP__Dynamic__Address__Flag_template& DCA__3GPP__Dynamic__Address__Flag_template::operator=(int other_value) { if (!DCA__3GPP__Dynamic__Address__Flag::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Dynamic__Address__Flag::enum_type)other_value; return *this; } DCA__3GPP__Dynamic__Address__Flag_template& DCA__3GPP__Dynamic__Address__Flag_template::operator=(DCA__3GPP__Dynamic__Address__Flag::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } DCA__3GPP__Dynamic__Address__Flag_template& DCA__3GPP__Dynamic__Address__Flag_template::operator=(const DCA__3GPP__Dynamic__Address__Flag& other_value) { if (other_value.enum_value == DCA__3GPP__Dynamic__Address__Flag::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } DCA__3GPP__Dynamic__Address__Flag_template& DCA__3GPP__Dynamic__Address__Flag_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Dynamic__Address__Flag::enum_type)(const DCA__3GPP__Dynamic__Address__Flag&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag."); } return *this; } DCA__3GPP__Dynamic__Address__Flag_template& DCA__3GPP__Dynamic__Address__Flag_template::operator=(const DCA__3GPP__Dynamic__Address__Flag_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean DCA__3GPP__Dynamic__Address__Flag_template::match(DCA__3GPP__Dynamic__Address__Flag::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag."); } return FALSE; } boolean DCA__3GPP__Dynamic__Address__Flag_template::match(const DCA__3GPP__Dynamic__Address__Flag& other_value, boolean) const { if (other_value.enum_value == DCA__3GPP__Dynamic__Address__Flag::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag with an unbound value."); return match(other_value.enum_value); } DCA__3GPP__Dynamic__Address__Flag::enum_type DCA__3GPP__Dynamic__Address__Flag_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag."); return single_value; } void DCA__3GPP__Dynamic__Address__Flag_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new DCA__3GPP__Dynamic__Address__Flag_template[list_length]; } DCA__3GPP__Dynamic__Address__Flag_template& DCA__3GPP__Dynamic__Address__Flag_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag."); return value_list.list_value[list_index]; } void DCA__3GPP__Dynamic__Address__Flag_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(DCA__3GPP__Dynamic__Address__Flag::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void DCA__3GPP__Dynamic__Address__Flag_template::log_match(const DCA__3GPP__Dynamic__Address__Flag& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void DCA__3GPP__Dynamic__Address__Flag_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag."); } } void DCA__3GPP__Dynamic__Address__Flag_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (DCA__3GPP__Dynamic__Address__Flag::enum_type)text_buf.pull_int().get_val(); if (!DCA__3GPP__Dynamic__Address__Flag::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new DCA__3GPP__Dynamic__Address__Flag_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag."); } } boolean DCA__3GPP__Dynamic__Address__Flag_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean DCA__3GPP__Dynamic__Address__Flag_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { DCA__3GPP__Dynamic__Address__Flag_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { DCA__3GPP__Dynamic__Address__Flag::enum_type enum_val = DCA__3GPP__Dynamic__Address__Flag::str_to_enum(m_p->get_enumerated()); if (!DCA__3GPP__Dynamic__Address__Flag::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { DCA__3GPP__Dynamic__Address__Flag_template* precondition = new DCA__3GPP__Dynamic__Address__Flag_template; precondition->set_param(*m_p->get_elem(0)); DCA__3GPP__Dynamic__Address__Flag_template* implied_template = new DCA__3GPP__Dynamic__Address__Flag_template; implied_template->set_param(*m_p->get_elem(1)); *this = DCA__3GPP__Dynamic__Address__Flag_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag"); } is_ifpresent = param.get_ifpresent(); } void DCA__3GPP__Dynamic__Address__Flag_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.DCA_3GPP_Dynamic_Address_Flag"); } DCA__3GPP__Transcoder__Inserted__Indication::DCA__3GPP__Transcoder__Inserted__Indication() { enum_value = UNBOUND_VALUE; } DCA__3GPP__Transcoder__Inserted__Indication::DCA__3GPP__Transcoder__Inserted__Indication(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Transcoder_Inserted_Indication with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } DCA__3GPP__Transcoder__Inserted__Indication::DCA__3GPP__Transcoder__Inserted__Indication(enum_type other_value) { enum_value = other_value; } DCA__3GPP__Transcoder__Inserted__Indication::DCA__3GPP__Transcoder__Inserted__Indication(const DCA__3GPP__Transcoder__Inserted__Indication& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Transcoder_Inserted_Indication."); enum_value = other_value.enum_value; } DCA__3GPP__Transcoder__Inserted__Indication& DCA__3GPP__Transcoder__Inserted__Indication::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Transcoder_Inserted_Indication.", other_value); enum_value = (enum_type)other_value; return *this; } DCA__3GPP__Transcoder__Inserted__Indication& DCA__3GPP__Transcoder__Inserted__Indication::operator=(enum_type other_value) { enum_value = other_value; return *this; } DCA__3GPP__Transcoder__Inserted__Indication& DCA__3GPP__Transcoder__Inserted__Indication::operator=(const DCA__3GPP__Transcoder__Inserted__Indication& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Transcoder_Inserted_Indication."); enum_value = other_value.enum_value; return *this; } boolean DCA__3GPP__Transcoder__Inserted__Indication::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Transcoder_Inserted_Indication."); return enum_value == other_value; } boolean DCA__3GPP__Transcoder__Inserted__Indication::operator==(const DCA__3GPP__Transcoder__Inserted__Indication& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Transcoder_Inserted_Indication."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Transcoder_Inserted_Indication."); return enum_value == other_value.enum_value; } boolean DCA__3GPP__Transcoder__Inserted__Indication::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Transcoder_Inserted_Indication."); return enum_value < other_value; } boolean DCA__3GPP__Transcoder__Inserted__Indication::operator<(const DCA__3GPP__Transcoder__Inserted__Indication& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Transcoder_Inserted_Indication."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Transcoder_Inserted_Indication."); return enum_value < other_value.enum_value; } boolean DCA__3GPP__Transcoder__Inserted__Indication::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Transcoder_Inserted_Indication."); return enum_value > other_value; } boolean DCA__3GPP__Transcoder__Inserted__Indication::operator>(const DCA__3GPP__Transcoder__Inserted__Indication& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Transcoder_Inserted_Indication."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Transcoder_Inserted_Indication."); return enum_value > other_value.enum_value; } const char *DCA__3GPP__Transcoder__Inserted__Indication::enum_to_str(enum_type enum_par) { switch (enum_par) { case TRANSCODER__NOT__INSERTED: return "TRANSCODER_NOT_INSERTED"; case TRANSCODER__INSERTED: return "TRANSCODER_INSERTED"; default: return ""; } } DCA__3GPP__Transcoder__Inserted__Indication::enum_type DCA__3GPP__Transcoder__Inserted__Indication::str_to_enum(const char *str_par) { if (!strcmp(str_par, "TRANSCODER_NOT_INSERTED")) return TRANSCODER__NOT__INSERTED; else if (!strcmp(str_par, "TRANSCODER_INSERTED")) return TRANSCODER__INSERTED; else return UNKNOWN_VALUE; } boolean DCA__3GPP__Transcoder__Inserted__Indication::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: return TRUE; default: return FALSE; } } int DCA__3GPP__Transcoder__Inserted__Indication::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_Transcoder_Inserted_Indication.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int DCA__3GPP__Transcoder__Inserted__Indication::enum2int(const DCA__3GPP__Transcoder__Inserted__Indication& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_Transcoder_Inserted_Indication.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void DCA__3GPP__Transcoder__Inserted__Indication::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Transcoder_Inserted_Indication.", int_val); enum_value = (enum_type)int_val; } DCA__3GPP__Transcoder__Inserted__Indication::operator DCA__3GPP__Transcoder__Inserted__Indication::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.DCA_3GPP_Transcoder_Inserted_Indication."); return enum_value; } void DCA__3GPP__Transcoder__Inserted__Indication::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void DCA__3GPP__Transcoder__Inserted__Indication::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.DCA_3GPP_Transcoder_Inserted_Indication"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_Transcoder_Inserted_Indication."); } } void DCA__3GPP__Transcoder__Inserted__Indication::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Transcoder_Inserted_Indication."); text_buf.push_int(enum_value); } void DCA__3GPP__Transcoder__Inserted__Indication::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.DCA_3GPP_Transcoder_Inserted_Indication.", enum_value); } void DCA__3GPP__Transcoder__Inserted__Indication::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void DCA__3GPP__Transcoder__Inserted__Indication::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int DCA__3GPP__Transcoder__Inserted__Indication::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int DCA__3GPP__Transcoder__Inserted__Indication::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void DCA__3GPP__Transcoder__Inserted__Indication_template::copy_template(const DCA__3GPP__Transcoder__Inserted__Indication_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new DCA__3GPP__Transcoder__Inserted__Indication_template[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 DCA__3GPP__Transcoder__Inserted__Indication_template(*other_value.implication_.precondition); implication_.implied_template = new DCA__3GPP__Transcoder__Inserted__Indication_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Transcoder_Inserted_Indication."); } } DCA__3GPP__Transcoder__Inserted__Indication_template::DCA__3GPP__Transcoder__Inserted__Indication_template() { } DCA__3GPP__Transcoder__Inserted__Indication_template::DCA__3GPP__Transcoder__Inserted__Indication_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } DCA__3GPP__Transcoder__Inserted__Indication_template::DCA__3GPP__Transcoder__Inserted__Indication_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!DCA__3GPP__Transcoder__Inserted__Indication::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.DCA_3GPP_Transcoder_Inserted_Indication with unknown numeric value %d.", other_value); single_value = (DCA__3GPP__Transcoder__Inserted__Indication::enum_type)other_value; } DCA__3GPP__Transcoder__Inserted__Indication_template::DCA__3GPP__Transcoder__Inserted__Indication_template(DCA__3GPP__Transcoder__Inserted__Indication::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } DCA__3GPP__Transcoder__Inserted__Indication_template::DCA__3GPP__Transcoder__Inserted__Indication_template(const DCA__3GPP__Transcoder__Inserted__Indication& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == DCA__3GPP__Transcoder__Inserted__Indication::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Transcoder_Inserted_Indication."); single_value = other_value.enum_value; } DCA__3GPP__Transcoder__Inserted__Indication_template::DCA__3GPP__Transcoder__Inserted__Indication_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Transcoder__Inserted__Indication::enum_type)(const DCA__3GPP__Transcoder__Inserted__Indication&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.DCA_3GPP_Transcoder_Inserted_Indication from an unbound optional field."); } } DCA__3GPP__Transcoder__Inserted__Indication_template::DCA__3GPP__Transcoder__Inserted__Indication_template(DCA__3GPP__Transcoder__Inserted__Indication_template* p_precondition, DCA__3GPP__Transcoder__Inserted__Indication_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } DCA__3GPP__Transcoder__Inserted__Indication_template::DCA__3GPP__Transcoder__Inserted__Indication_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; } DCA__3GPP__Transcoder__Inserted__Indication_template::DCA__3GPP__Transcoder__Inserted__Indication_template(const DCA__3GPP__Transcoder__Inserted__Indication_template& other_value) : Base_Template() { copy_template(other_value); } DCA__3GPP__Transcoder__Inserted__Indication_template::~DCA__3GPP__Transcoder__Inserted__Indication_template() { clean_up(); } boolean DCA__3GPP__Transcoder__Inserted__Indication_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean DCA__3GPP__Transcoder__Inserted__Indication_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != DCA__3GPP__Transcoder__Inserted__Indication::UNBOUND_VALUE; } void DCA__3GPP__Transcoder__Inserted__Indication_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } DCA__3GPP__Transcoder__Inserted__Indication_template& DCA__3GPP__Transcoder__Inserted__Indication_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } DCA__3GPP__Transcoder__Inserted__Indication_template& DCA__3GPP__Transcoder__Inserted__Indication_template::operator=(int other_value) { if (!DCA__3GPP__Transcoder__Inserted__Indication::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.DCA_3GPP_Transcoder_Inserted_Indication.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Transcoder__Inserted__Indication::enum_type)other_value; return *this; } DCA__3GPP__Transcoder__Inserted__Indication_template& DCA__3GPP__Transcoder__Inserted__Indication_template::operator=(DCA__3GPP__Transcoder__Inserted__Indication::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } DCA__3GPP__Transcoder__Inserted__Indication_template& DCA__3GPP__Transcoder__Inserted__Indication_template::operator=(const DCA__3GPP__Transcoder__Inserted__Indication& other_value) { if (other_value.enum_value == DCA__3GPP__Transcoder__Inserted__Indication::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Transcoder_Inserted_Indication to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } DCA__3GPP__Transcoder__Inserted__Indication_template& DCA__3GPP__Transcoder__Inserted__Indication_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Transcoder__Inserted__Indication::enum_type)(const DCA__3GPP__Transcoder__Inserted__Indication&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.DCA_3GPP_Transcoder_Inserted_Indication."); } return *this; } DCA__3GPP__Transcoder__Inserted__Indication_template& DCA__3GPP__Transcoder__Inserted__Indication_template::operator=(const DCA__3GPP__Transcoder__Inserted__Indication_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean DCA__3GPP__Transcoder__Inserted__Indication_template::match(DCA__3GPP__Transcoder__Inserted__Indication::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Transcoder_Inserted_Indication."); } return FALSE; } boolean DCA__3GPP__Transcoder__Inserted__Indication_template::match(const DCA__3GPP__Transcoder__Inserted__Indication& other_value, boolean) const { if (other_value.enum_value == DCA__3GPP__Transcoder__Inserted__Indication::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.DCA_3GPP_Transcoder_Inserted_Indication with an unbound value."); return match(other_value.enum_value); } DCA__3GPP__Transcoder__Inserted__Indication::enum_type DCA__3GPP__Transcoder__Inserted__Indication_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.DCA_3GPP_Transcoder_Inserted_Indication."); return single_value; } void DCA__3GPP__Transcoder__Inserted__Indication_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Transcoder_Inserted_Indication."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new DCA__3GPP__Transcoder__Inserted__Indication_template[list_length]; } DCA__3GPP__Transcoder__Inserted__Indication_template& DCA__3GPP__Transcoder__Inserted__Indication_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.DCA_3GPP_Transcoder_Inserted_Indication."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.DCA_3GPP_Transcoder_Inserted_Indication."); return value_list.list_value[list_index]; } void DCA__3GPP__Transcoder__Inserted__Indication_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(DCA__3GPP__Transcoder__Inserted__Indication::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void DCA__3GPP__Transcoder__Inserted__Indication_template::log_match(const DCA__3GPP__Transcoder__Inserted__Indication& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void DCA__3GPP__Transcoder__Inserted__Indication_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Transcoder_Inserted_Indication."); } } void DCA__3GPP__Transcoder__Inserted__Indication_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (DCA__3GPP__Transcoder__Inserted__Indication::enum_type)text_buf.pull_int().get_val(); if (!DCA__3GPP__Transcoder__Inserted__Indication::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Transcoder_Inserted_Indication.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new DCA__3GPP__Transcoder__Inserted__Indication_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Transcoder_Inserted_Indication."); } } boolean DCA__3GPP__Transcoder__Inserted__Indication_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean DCA__3GPP__Transcoder__Inserted__Indication_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { DCA__3GPP__Transcoder__Inserted__Indication_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { DCA__3GPP__Transcoder__Inserted__Indication::enum_type enum_val = DCA__3GPP__Transcoder__Inserted__Indication::str_to_enum(m_p->get_enumerated()); if (!DCA__3GPP__Transcoder__Inserted__Indication::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_Transcoder_Inserted_Indication."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { DCA__3GPP__Transcoder__Inserted__Indication_template* precondition = new DCA__3GPP__Transcoder__Inserted__Indication_template; precondition->set_param(*m_p->get_elem(0)); DCA__3GPP__Transcoder__Inserted__Indication_template* implied_template = new DCA__3GPP__Transcoder__Inserted__Indication_template; implied_template->set_param(*m_p->get_elem(1)); *this = DCA__3GPP__Transcoder__Inserted__Indication_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.DCA_3GPP_Transcoder_Inserted_Indication"); } is_ifpresent = param.get_ifpresent(); } void DCA__3GPP__Transcoder__Inserted__Indication_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.DCA_3GPP_Transcoder_Inserted_Indication"); } DCA__3GPP__SMS__Node::DCA__3GPP__SMS__Node() { enum_value = UNBOUND_VALUE; } DCA__3GPP__SMS__Node::DCA__3GPP__SMS__Node(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.DCA_3GPP_SMS_Node with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } DCA__3GPP__SMS__Node::DCA__3GPP__SMS__Node(enum_type other_value) { enum_value = other_value; } DCA__3GPP__SMS__Node::DCA__3GPP__SMS__Node(const DCA__3GPP__SMS__Node& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_SMS_Node."); enum_value = other_value.enum_value; } DCA__3GPP__SMS__Node& DCA__3GPP__SMS__Node::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_SMS_Node.", other_value); enum_value = (enum_type)other_value; return *this; } DCA__3GPP__SMS__Node& DCA__3GPP__SMS__Node::operator=(enum_type other_value) { enum_value = other_value; return *this; } DCA__3GPP__SMS__Node& DCA__3GPP__SMS__Node::operator=(const DCA__3GPP__SMS__Node& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_SMS_Node."); enum_value = other_value.enum_value; return *this; } boolean DCA__3GPP__SMS__Node::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_SMS_Node."); return enum_value == other_value; } boolean DCA__3GPP__SMS__Node::operator==(const DCA__3GPP__SMS__Node& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_SMS_Node."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_SMS_Node."); return enum_value == other_value.enum_value; } boolean DCA__3GPP__SMS__Node::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_SMS_Node."); return enum_value < other_value; } boolean DCA__3GPP__SMS__Node::operator<(const DCA__3GPP__SMS__Node& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_SMS_Node."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_SMS_Node."); return enum_value < other_value.enum_value; } boolean DCA__3GPP__SMS__Node::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_SMS_Node."); return enum_value > other_value; } boolean DCA__3GPP__SMS__Node::operator>(const DCA__3GPP__SMS__Node& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_SMS_Node."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_SMS_Node."); return enum_value > other_value.enum_value; } const char *DCA__3GPP__SMS__Node::enum_to_str(enum_type enum_par) { switch (enum_par) { case SMS__ROUTER: return "SMS_ROUTER"; case IP__SM__GW: return "IP_SM_GW"; case SMS__ROUTER__AND__IP__SM__GW: return "SMS_ROUTER_AND_IP_SM_GW"; case SMS__SC: return "SMS_SC"; default: return ""; } } DCA__3GPP__SMS__Node::enum_type DCA__3GPP__SMS__Node::str_to_enum(const char *str_par) { if (!strcmp(str_par, "SMS_ROUTER")) return SMS__ROUTER; else if (!strcmp(str_par, "IP_SM_GW")) return IP__SM__GW; else if (!strcmp(str_par, "SMS_ROUTER_AND_IP_SM_GW")) return SMS__ROUTER__AND__IP__SM__GW; else if (!strcmp(str_par, "SMS_SC")) return SMS__SC; else return UNKNOWN_VALUE; } boolean DCA__3GPP__SMS__Node::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: case 2: case 3: return TRUE; default: return FALSE; } } int DCA__3GPP__SMS__Node::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_SMS_Node.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int DCA__3GPP__SMS__Node::enum2int(const DCA__3GPP__SMS__Node& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_SMS_Node.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void DCA__3GPP__SMS__Node::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_SMS_Node.", int_val); enum_value = (enum_type)int_val; } DCA__3GPP__SMS__Node::operator DCA__3GPP__SMS__Node::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.DCA_3GPP_SMS_Node."); return enum_value; } void DCA__3GPP__SMS__Node::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void DCA__3GPP__SMS__Node::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.DCA_3GPP_SMS_Node"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_SMS_Node."); } } void DCA__3GPP__SMS__Node::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_SMS_Node."); text_buf.push_int(enum_value); } void DCA__3GPP__SMS__Node::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.DCA_3GPP_SMS_Node.", enum_value); } void DCA__3GPP__SMS__Node::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void DCA__3GPP__SMS__Node::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int DCA__3GPP__SMS__Node::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 3, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int DCA__3GPP__SMS__Node::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 3); } void DCA__3GPP__SMS__Node_template::copy_template(const DCA__3GPP__SMS__Node_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new DCA__3GPP__SMS__Node_template[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 DCA__3GPP__SMS__Node_template(*other_value.implication_.precondition); implication_.implied_template = new DCA__3GPP__SMS__Node_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_SMS_Node."); } } DCA__3GPP__SMS__Node_template::DCA__3GPP__SMS__Node_template() { } DCA__3GPP__SMS__Node_template::DCA__3GPP__SMS__Node_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } DCA__3GPP__SMS__Node_template::DCA__3GPP__SMS__Node_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!DCA__3GPP__SMS__Node::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.DCA_3GPP_SMS_Node with unknown numeric value %d.", other_value); single_value = (DCA__3GPP__SMS__Node::enum_type)other_value; } DCA__3GPP__SMS__Node_template::DCA__3GPP__SMS__Node_template(DCA__3GPP__SMS__Node::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } DCA__3GPP__SMS__Node_template::DCA__3GPP__SMS__Node_template(const DCA__3GPP__SMS__Node& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == DCA__3GPP__SMS__Node::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_SMS_Node."); single_value = other_value.enum_value; } DCA__3GPP__SMS__Node_template::DCA__3GPP__SMS__Node_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__SMS__Node::enum_type)(const DCA__3GPP__SMS__Node&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.DCA_3GPP_SMS_Node from an unbound optional field."); } } DCA__3GPP__SMS__Node_template::DCA__3GPP__SMS__Node_template(DCA__3GPP__SMS__Node_template* p_precondition, DCA__3GPP__SMS__Node_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } DCA__3GPP__SMS__Node_template::DCA__3GPP__SMS__Node_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; } DCA__3GPP__SMS__Node_template::DCA__3GPP__SMS__Node_template(const DCA__3GPP__SMS__Node_template& other_value) : Base_Template() { copy_template(other_value); } DCA__3GPP__SMS__Node_template::~DCA__3GPP__SMS__Node_template() { clean_up(); } boolean DCA__3GPP__SMS__Node_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean DCA__3GPP__SMS__Node_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != DCA__3GPP__SMS__Node::UNBOUND_VALUE; } void DCA__3GPP__SMS__Node_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } DCA__3GPP__SMS__Node_template& DCA__3GPP__SMS__Node_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } DCA__3GPP__SMS__Node_template& DCA__3GPP__SMS__Node_template::operator=(int other_value) { if (!DCA__3GPP__SMS__Node::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.DCA_3GPP_SMS_Node.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__SMS__Node::enum_type)other_value; return *this; } DCA__3GPP__SMS__Node_template& DCA__3GPP__SMS__Node_template::operator=(DCA__3GPP__SMS__Node::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } DCA__3GPP__SMS__Node_template& DCA__3GPP__SMS__Node_template::operator=(const DCA__3GPP__SMS__Node& other_value) { if (other_value.enum_value == DCA__3GPP__SMS__Node::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_SMS_Node to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } DCA__3GPP__SMS__Node_template& DCA__3GPP__SMS__Node_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__SMS__Node::enum_type)(const DCA__3GPP__SMS__Node&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.DCA_3GPP_SMS_Node."); } return *this; } DCA__3GPP__SMS__Node_template& DCA__3GPP__SMS__Node_template::operator=(const DCA__3GPP__SMS__Node_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean DCA__3GPP__SMS__Node_template::match(DCA__3GPP__SMS__Node::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_SMS_Node."); } return FALSE; } boolean DCA__3GPP__SMS__Node_template::match(const DCA__3GPP__SMS__Node& other_value, boolean) const { if (other_value.enum_value == DCA__3GPP__SMS__Node::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.DCA_3GPP_SMS_Node with an unbound value."); return match(other_value.enum_value); } DCA__3GPP__SMS__Node::enum_type DCA__3GPP__SMS__Node_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.DCA_3GPP_SMS_Node."); return single_value; } void DCA__3GPP__SMS__Node_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.DCA_3GPP_SMS_Node."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new DCA__3GPP__SMS__Node_template[list_length]; } DCA__3GPP__SMS__Node_template& DCA__3GPP__SMS__Node_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.DCA_3GPP_SMS_Node."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.DCA_3GPP_SMS_Node."); return value_list.list_value[list_index]; } void DCA__3GPP__SMS__Node_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(DCA__3GPP__SMS__Node::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void DCA__3GPP__SMS__Node_template::log_match(const DCA__3GPP__SMS__Node& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void DCA__3GPP__SMS__Node_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_SMS_Node."); } } void DCA__3GPP__SMS__Node_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (DCA__3GPP__SMS__Node::enum_type)text_buf.pull_int().get_val(); if (!DCA__3GPP__SMS__Node::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_SMS_Node.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new DCA__3GPP__SMS__Node_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_SMS_Node."); } } boolean DCA__3GPP__SMS__Node_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean DCA__3GPP__SMS__Node_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { DCA__3GPP__SMS__Node_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { DCA__3GPP__SMS__Node::enum_type enum_val = DCA__3GPP__SMS__Node::str_to_enum(m_p->get_enumerated()); if (!DCA__3GPP__SMS__Node::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_SMS_Node."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { DCA__3GPP__SMS__Node_template* precondition = new DCA__3GPP__SMS__Node_template; precondition->set_param(*m_p->get_elem(0)); DCA__3GPP__SMS__Node_template* implied_template = new DCA__3GPP__SMS__Node_template; implied_template->set_param(*m_p->get_elem(1)); *this = DCA__3GPP__SMS__Node_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.DCA_3GPP_SMS_Node"); } is_ifpresent = param.get_ifpresent(); } void DCA__3GPP__SMS__Node_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.DCA_3GPP_SMS_Node"); } DNAS__NONE__CHAP__Algorithm::DNAS__NONE__CHAP__Algorithm() { enum_value = UNBOUND_VALUE; } DNAS__NONE__CHAP__Algorithm::DNAS__NONE__CHAP__Algorithm(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.DNAS_NONE_CHAP_Algorithm with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } DNAS__NONE__CHAP__Algorithm::DNAS__NONE__CHAP__Algorithm(enum_type other_value) { enum_value = other_value; } DNAS__NONE__CHAP__Algorithm::DNAS__NONE__CHAP__Algorithm(const DNAS__NONE__CHAP__Algorithm& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_CHAP_Algorithm."); enum_value = other_value.enum_value; } DNAS__NONE__CHAP__Algorithm& DNAS__NONE__CHAP__Algorithm::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.DNAS_NONE_CHAP_Algorithm.", other_value); enum_value = (enum_type)other_value; return *this; } DNAS__NONE__CHAP__Algorithm& DNAS__NONE__CHAP__Algorithm::operator=(enum_type other_value) { enum_value = other_value; return *this; } DNAS__NONE__CHAP__Algorithm& DNAS__NONE__CHAP__Algorithm::operator=(const DNAS__NONE__CHAP__Algorithm& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_CHAP_Algorithm."); enum_value = other_value.enum_value; return *this; } boolean DNAS__NONE__CHAP__Algorithm::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_CHAP_Algorithm."); return enum_value == other_value; } boolean DNAS__NONE__CHAP__Algorithm::operator==(const DNAS__NONE__CHAP__Algorithm& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_CHAP_Algorithm."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_CHAP_Algorithm."); return enum_value == other_value.enum_value; } boolean DNAS__NONE__CHAP__Algorithm::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_CHAP_Algorithm."); return enum_value < other_value; } boolean DNAS__NONE__CHAP__Algorithm::operator<(const DNAS__NONE__CHAP__Algorithm& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_CHAP_Algorithm."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_CHAP_Algorithm."); return enum_value < other_value.enum_value; } boolean DNAS__NONE__CHAP__Algorithm::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_CHAP_Algorithm."); return enum_value > other_value; } boolean DNAS__NONE__CHAP__Algorithm::operator>(const DNAS__NONE__CHAP__Algorithm& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_CHAP_Algorithm."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_CHAP_Algorithm."); return enum_value > other_value.enum_value; } const char *DNAS__NONE__CHAP__Algorithm::enum_to_str(enum_type enum_par) { switch (enum_par) { case CHAP__with__MD5: return "CHAP_with_MD5"; default: return ""; } } DNAS__NONE__CHAP__Algorithm::enum_type DNAS__NONE__CHAP__Algorithm::str_to_enum(const char *str_par) { if (!strcmp(str_par, "CHAP_with_MD5")) return CHAP__with__MD5; else return UNKNOWN_VALUE; } boolean DNAS__NONE__CHAP__Algorithm::is_valid_enum(int int_par) { switch (int_par) { case 5: return TRUE; default: return FALSE; } } int DNAS__NONE__CHAP__Algorithm::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DNAS_NONE_CHAP_Algorithm.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int DNAS__NONE__CHAP__Algorithm::enum2int(const DNAS__NONE__CHAP__Algorithm& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DNAS_NONE_CHAP_Algorithm.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void DNAS__NONE__CHAP__Algorithm::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.DNAS_NONE_CHAP_Algorithm.", int_val); enum_value = (enum_type)int_val; } DNAS__NONE__CHAP__Algorithm::operator DNAS__NONE__CHAP__Algorithm::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.DNAS_NONE_CHAP_Algorithm."); return enum_value; } void DNAS__NONE__CHAP__Algorithm::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void DNAS__NONE__CHAP__Algorithm::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.DNAS_NONE_CHAP_Algorithm"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DNAS_NONE_CHAP_Algorithm."); } } void DNAS__NONE__CHAP__Algorithm::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_CHAP_Algorithm."); text_buf.push_int(enum_value); } void DNAS__NONE__CHAP__Algorithm::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.DNAS_NONE_CHAP_Algorithm.", enum_value); } void DNAS__NONE__CHAP__Algorithm::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void DNAS__NONE__CHAP__Algorithm::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int DNAS__NONE__CHAP__Algorithm::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 3, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int DNAS__NONE__CHAP__Algorithm::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 3); } void DNAS__NONE__CHAP__Algorithm_template::copy_template(const DNAS__NONE__CHAP__Algorithm_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new DNAS__NONE__CHAP__Algorithm_template[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 DNAS__NONE__CHAP__Algorithm_template(*other_value.implication_.precondition); implication_.implied_template = new DNAS__NONE__CHAP__Algorithm_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DNAS_NONE_CHAP_Algorithm."); } } DNAS__NONE__CHAP__Algorithm_template::DNAS__NONE__CHAP__Algorithm_template() { } DNAS__NONE__CHAP__Algorithm_template::DNAS__NONE__CHAP__Algorithm_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } DNAS__NONE__CHAP__Algorithm_template::DNAS__NONE__CHAP__Algorithm_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!DNAS__NONE__CHAP__Algorithm::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.DNAS_NONE_CHAP_Algorithm with unknown numeric value %d.", other_value); single_value = (DNAS__NONE__CHAP__Algorithm::enum_type)other_value; } DNAS__NONE__CHAP__Algorithm_template::DNAS__NONE__CHAP__Algorithm_template(DNAS__NONE__CHAP__Algorithm::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } DNAS__NONE__CHAP__Algorithm_template::DNAS__NONE__CHAP__Algorithm_template(const DNAS__NONE__CHAP__Algorithm& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == DNAS__NONE__CHAP__Algorithm::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_CHAP_Algorithm."); single_value = other_value.enum_value; } DNAS__NONE__CHAP__Algorithm_template::DNAS__NONE__CHAP__Algorithm_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DNAS__NONE__CHAP__Algorithm::enum_type)(const DNAS__NONE__CHAP__Algorithm&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.DNAS_NONE_CHAP_Algorithm from an unbound optional field."); } } DNAS__NONE__CHAP__Algorithm_template::DNAS__NONE__CHAP__Algorithm_template(DNAS__NONE__CHAP__Algorithm_template* p_precondition, DNAS__NONE__CHAP__Algorithm_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } DNAS__NONE__CHAP__Algorithm_template::DNAS__NONE__CHAP__Algorithm_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; } DNAS__NONE__CHAP__Algorithm_template::DNAS__NONE__CHAP__Algorithm_template(const DNAS__NONE__CHAP__Algorithm_template& other_value) : Base_Template() { copy_template(other_value); } DNAS__NONE__CHAP__Algorithm_template::~DNAS__NONE__CHAP__Algorithm_template() { clean_up(); } boolean DNAS__NONE__CHAP__Algorithm_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean DNAS__NONE__CHAP__Algorithm_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != DNAS__NONE__CHAP__Algorithm::UNBOUND_VALUE; } void DNAS__NONE__CHAP__Algorithm_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } DNAS__NONE__CHAP__Algorithm_template& DNAS__NONE__CHAP__Algorithm_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } DNAS__NONE__CHAP__Algorithm_template& DNAS__NONE__CHAP__Algorithm_template::operator=(int other_value) { if (!DNAS__NONE__CHAP__Algorithm::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.DNAS_NONE_CHAP_Algorithm.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (DNAS__NONE__CHAP__Algorithm::enum_type)other_value; return *this; } DNAS__NONE__CHAP__Algorithm_template& DNAS__NONE__CHAP__Algorithm_template::operator=(DNAS__NONE__CHAP__Algorithm::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } DNAS__NONE__CHAP__Algorithm_template& DNAS__NONE__CHAP__Algorithm_template::operator=(const DNAS__NONE__CHAP__Algorithm& other_value) { if (other_value.enum_value == DNAS__NONE__CHAP__Algorithm::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_CHAP_Algorithm to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } DNAS__NONE__CHAP__Algorithm_template& DNAS__NONE__CHAP__Algorithm_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DNAS__NONE__CHAP__Algorithm::enum_type)(const DNAS__NONE__CHAP__Algorithm&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.DNAS_NONE_CHAP_Algorithm."); } return *this; } DNAS__NONE__CHAP__Algorithm_template& DNAS__NONE__CHAP__Algorithm_template::operator=(const DNAS__NONE__CHAP__Algorithm_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean DNAS__NONE__CHAP__Algorithm_template::match(DNAS__NONE__CHAP__Algorithm::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DNAS_NONE_CHAP_Algorithm."); } return FALSE; } boolean DNAS__NONE__CHAP__Algorithm_template::match(const DNAS__NONE__CHAP__Algorithm& other_value, boolean) const { if (other_value.enum_value == DNAS__NONE__CHAP__Algorithm::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.DNAS_NONE_CHAP_Algorithm with an unbound value."); return match(other_value.enum_value); } DNAS__NONE__CHAP__Algorithm::enum_type DNAS__NONE__CHAP__Algorithm_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.DNAS_NONE_CHAP_Algorithm."); return single_value; } void DNAS__NONE__CHAP__Algorithm_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.DNAS_NONE_CHAP_Algorithm."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new DNAS__NONE__CHAP__Algorithm_template[list_length]; } DNAS__NONE__CHAP__Algorithm_template& DNAS__NONE__CHAP__Algorithm_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.DNAS_NONE_CHAP_Algorithm."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.DNAS_NONE_CHAP_Algorithm."); return value_list.list_value[list_index]; } void DNAS__NONE__CHAP__Algorithm_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(DNAS__NONE__CHAP__Algorithm::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void DNAS__NONE__CHAP__Algorithm_template::log_match(const DNAS__NONE__CHAP__Algorithm& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void DNAS__NONE__CHAP__Algorithm_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DNAS_NONE_CHAP_Algorithm."); } } void DNAS__NONE__CHAP__Algorithm_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (DNAS__NONE__CHAP__Algorithm::enum_type)text_buf.pull_int().get_val(); if (!DNAS__NONE__CHAP__Algorithm::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.DNAS_NONE_CHAP_Algorithm.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new DNAS__NONE__CHAP__Algorithm_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.DNAS_NONE_CHAP_Algorithm."); } } boolean DNAS__NONE__CHAP__Algorithm_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean DNAS__NONE__CHAP__Algorithm_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { DNAS__NONE__CHAP__Algorithm_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { DNAS__NONE__CHAP__Algorithm::enum_type enum_val = DNAS__NONE__CHAP__Algorithm::str_to_enum(m_p->get_enumerated()); if (!DNAS__NONE__CHAP__Algorithm::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DNAS_NONE_CHAP_Algorithm."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { DNAS__NONE__CHAP__Algorithm_template* precondition = new DNAS__NONE__CHAP__Algorithm_template; precondition->set_param(*m_p->get_elem(0)); DNAS__NONE__CHAP__Algorithm_template* implied_template = new DNAS__NONE__CHAP__Algorithm_template; implied_template->set_param(*m_p->get_elem(1)); *this = DNAS__NONE__CHAP__Algorithm_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.DNAS_NONE_CHAP_Algorithm"); } is_ifpresent = param.get_ifpresent(); } void DNAS__NONE__CHAP__Algorithm_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.DNAS_NONE_CHAP_Algorithm"); } DCA__3GPP__Message__Type::DCA__3GPP__Message__Type() { enum_value = UNBOUND_VALUE; } DCA__3GPP__Message__Type::DCA__3GPP__Message__Type(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Message_Type with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } DCA__3GPP__Message__Type::DCA__3GPP__Message__Type(enum_type other_value) { enum_value = other_value; } DCA__3GPP__Message__Type::DCA__3GPP__Message__Type(const DCA__3GPP__Message__Type& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Message_Type."); enum_value = other_value.enum_value; } DCA__3GPP__Message__Type& DCA__3GPP__Message__Type::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Message_Type.", other_value); enum_value = (enum_type)other_value; return *this; } DCA__3GPP__Message__Type& DCA__3GPP__Message__Type::operator=(enum_type other_value) { enum_value = other_value; return *this; } DCA__3GPP__Message__Type& DCA__3GPP__Message__Type::operator=(const DCA__3GPP__Message__Type& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Message_Type."); enum_value = other_value.enum_value; return *this; } boolean DCA__3GPP__Message__Type::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Message_Type."); return enum_value == other_value; } boolean DCA__3GPP__Message__Type::operator==(const DCA__3GPP__Message__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Message_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Message_Type."); return enum_value == other_value.enum_value; } boolean DCA__3GPP__Message__Type::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Message_Type."); return enum_value < other_value; } boolean DCA__3GPP__Message__Type::operator<(const DCA__3GPP__Message__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Message_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Message_Type."); return enum_value < other_value.enum_value; } boolean DCA__3GPP__Message__Type::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Message_Type."); return enum_value > other_value; } boolean DCA__3GPP__Message__Type::operator>(const DCA__3GPP__Message__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Message_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Message_Type."); return enum_value > other_value.enum_value; } const char *DCA__3GPP__Message__Type::enum_to_str(enum_type enum_par) { switch (enum_par) { case M__SEMD__REQ: return "M_SEMD_REQ"; case M__SEMD__CONF: return "M_SEMD_CONF"; case M__NOTIFICATION__IND: return "M_NOTIFICATION_IND"; case M__NOTIFYRESP__IND: return "M_NOTIFYRESP_IND"; case M__RETRIEVE__CONF: return "M_RETRIEVE_CONF"; case M__ACKNOWLEDGE__IND: return "M_ACKNOWLEDGE_IND"; case M__DELIVERY__IND: return "M_DELIVERY_IND"; case M__READ__REC__IND: return "M_READ_REC_IND"; case M__READ__ORIG__IND: return "M_READ_ORIG_IND"; case M__FORWARD__REQ: return "M_FORWARD_REQ"; case M__FORWARD__CONF: return "M_FORWARD_CONF"; case M__MBOX__STORE__CONF: return "M_MBOX_STORE_CONF"; case M__MBOX__VIEW__CONF: return "M_MBOX_VIEW_CONF"; case M__MBOX__UPLOAD__CONF: return "M_MBOX_UPLOAD_CONF"; case M__MBOX__DELETE__CONF: return "M_MBOX_DELETE_CONF"; default: return ""; } } DCA__3GPP__Message__Type::enum_type DCA__3GPP__Message__Type::str_to_enum(const char *str_par) { if (!strcmp(str_par, "M_SEMD_REQ")) return M__SEMD__REQ; else if (!strcmp(str_par, "M_SEMD_CONF")) return M__SEMD__CONF; else if (!strcmp(str_par, "M_NOTIFICATION_IND")) return M__NOTIFICATION__IND; else if (!strcmp(str_par, "M_NOTIFYRESP_IND")) return M__NOTIFYRESP__IND; else if (!strcmp(str_par, "M_RETRIEVE_CONF")) return M__RETRIEVE__CONF; else if (!strcmp(str_par, "M_ACKNOWLEDGE_IND")) return M__ACKNOWLEDGE__IND; else if (!strcmp(str_par, "M_DELIVERY_IND")) return M__DELIVERY__IND; else if (!strcmp(str_par, "M_READ_REC_IND")) return M__READ__REC__IND; else if (!strcmp(str_par, "M_READ_ORIG_IND")) return M__READ__ORIG__IND; else if (!strcmp(str_par, "M_FORWARD_REQ")) return M__FORWARD__REQ; else if (!strcmp(str_par, "M_FORWARD_CONF")) return M__FORWARD__CONF; else if (!strcmp(str_par, "M_MBOX_STORE_CONF")) return M__MBOX__STORE__CONF; else if (!strcmp(str_par, "M_MBOX_VIEW_CONF")) return M__MBOX__VIEW__CONF; else if (!strcmp(str_par, "M_MBOX_UPLOAD_CONF")) return M__MBOX__UPLOAD__CONF; else if (!strcmp(str_par, "M_MBOX_DELETE_CONF")) return M__MBOX__DELETE__CONF; else return UNKNOWN_VALUE; } boolean DCA__3GPP__Message__Type::is_valid_enum(int int_par) { switch (int_par) { case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: return TRUE; default: return FALSE; } } int DCA__3GPP__Message__Type::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_Message_Type.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int DCA__3GPP__Message__Type::enum2int(const DCA__3GPP__Message__Type& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_Message_Type.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void DCA__3GPP__Message__Type::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Message_Type.", int_val); enum_value = (enum_type)int_val; } DCA__3GPP__Message__Type::operator DCA__3GPP__Message__Type::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.DCA_3GPP_Message_Type."); return enum_value; } void DCA__3GPP__Message__Type::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void DCA__3GPP__Message__Type::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.DCA_3GPP_Message_Type"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_Message_Type."); } } void DCA__3GPP__Message__Type::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Message_Type."); text_buf.push_int(enum_value); } void DCA__3GPP__Message__Type::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.DCA_3GPP_Message_Type.", enum_value); } void DCA__3GPP__Message__Type::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void DCA__3GPP__Message__Type::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int DCA__3GPP__Message__Type::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 4, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int DCA__3GPP__Message__Type::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 4); } void DCA__3GPP__Message__Type_template::copy_template(const DCA__3GPP__Message__Type_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new DCA__3GPP__Message__Type_template[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 DCA__3GPP__Message__Type_template(*other_value.implication_.precondition); implication_.implied_template = new DCA__3GPP__Message__Type_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Message_Type."); } } DCA__3GPP__Message__Type_template::DCA__3GPP__Message__Type_template() { } DCA__3GPP__Message__Type_template::DCA__3GPP__Message__Type_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } DCA__3GPP__Message__Type_template::DCA__3GPP__Message__Type_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!DCA__3GPP__Message__Type::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.DCA_3GPP_Message_Type with unknown numeric value %d.", other_value); single_value = (DCA__3GPP__Message__Type::enum_type)other_value; } DCA__3GPP__Message__Type_template::DCA__3GPP__Message__Type_template(DCA__3GPP__Message__Type::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } DCA__3GPP__Message__Type_template::DCA__3GPP__Message__Type_template(const DCA__3GPP__Message__Type& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == DCA__3GPP__Message__Type::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Message_Type."); single_value = other_value.enum_value; } DCA__3GPP__Message__Type_template::DCA__3GPP__Message__Type_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Message__Type::enum_type)(const DCA__3GPP__Message__Type&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.DCA_3GPP_Message_Type from an unbound optional field."); } } DCA__3GPP__Message__Type_template::DCA__3GPP__Message__Type_template(DCA__3GPP__Message__Type_template* p_precondition, DCA__3GPP__Message__Type_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } DCA__3GPP__Message__Type_template::DCA__3GPP__Message__Type_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; } DCA__3GPP__Message__Type_template::DCA__3GPP__Message__Type_template(const DCA__3GPP__Message__Type_template& other_value) : Base_Template() { copy_template(other_value); } DCA__3GPP__Message__Type_template::~DCA__3GPP__Message__Type_template() { clean_up(); } boolean DCA__3GPP__Message__Type_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean DCA__3GPP__Message__Type_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != DCA__3GPP__Message__Type::UNBOUND_VALUE; } void DCA__3GPP__Message__Type_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } DCA__3GPP__Message__Type_template& DCA__3GPP__Message__Type_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } DCA__3GPP__Message__Type_template& DCA__3GPP__Message__Type_template::operator=(int other_value) { if (!DCA__3GPP__Message__Type::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.DCA_3GPP_Message_Type.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Message__Type::enum_type)other_value; return *this; } DCA__3GPP__Message__Type_template& DCA__3GPP__Message__Type_template::operator=(DCA__3GPP__Message__Type::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } DCA__3GPP__Message__Type_template& DCA__3GPP__Message__Type_template::operator=(const DCA__3GPP__Message__Type& other_value) { if (other_value.enum_value == DCA__3GPP__Message__Type::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Message_Type to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } DCA__3GPP__Message__Type_template& DCA__3GPP__Message__Type_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Message__Type::enum_type)(const DCA__3GPP__Message__Type&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.DCA_3GPP_Message_Type."); } return *this; } DCA__3GPP__Message__Type_template& DCA__3GPP__Message__Type_template::operator=(const DCA__3GPP__Message__Type_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean DCA__3GPP__Message__Type_template::match(DCA__3GPP__Message__Type::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Message_Type."); } return FALSE; } boolean DCA__3GPP__Message__Type_template::match(const DCA__3GPP__Message__Type& other_value, boolean) const { if (other_value.enum_value == DCA__3GPP__Message__Type::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.DCA_3GPP_Message_Type with an unbound value."); return match(other_value.enum_value); } DCA__3GPP__Message__Type::enum_type DCA__3GPP__Message__Type_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.DCA_3GPP_Message_Type."); return single_value; } void DCA__3GPP__Message__Type_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Message_Type."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new DCA__3GPP__Message__Type_template[list_length]; } DCA__3GPP__Message__Type_template& DCA__3GPP__Message__Type_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.DCA_3GPP_Message_Type."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.DCA_3GPP_Message_Type."); return value_list.list_value[list_index]; } void DCA__3GPP__Message__Type_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(DCA__3GPP__Message__Type::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void DCA__3GPP__Message__Type_template::log_match(const DCA__3GPP__Message__Type& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void DCA__3GPP__Message__Type_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Message_Type."); } } void DCA__3GPP__Message__Type_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (DCA__3GPP__Message__Type::enum_type)text_buf.pull_int().get_val(); if (!DCA__3GPP__Message__Type::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Message_Type.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new DCA__3GPP__Message__Type_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Message_Type."); } } boolean DCA__3GPP__Message__Type_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean DCA__3GPP__Message__Type_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { DCA__3GPP__Message__Type_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { DCA__3GPP__Message__Type::enum_type enum_val = DCA__3GPP__Message__Type::str_to_enum(m_p->get_enumerated()); if (!DCA__3GPP__Message__Type::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_Message_Type."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { DCA__3GPP__Message__Type_template* precondition = new DCA__3GPP__Message__Type_template; precondition->set_param(*m_p->get_elem(0)); DCA__3GPP__Message__Type_template* implied_template = new DCA__3GPP__Message__Type_template; implied_template->set_param(*m_p->get_elem(1)); *this = DCA__3GPP__Message__Type_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.DCA_3GPP_Message_Type"); } is_ifpresent = param.get_ifpresent(); } void DCA__3GPP__Message__Type_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.DCA_3GPP_Message_Type"); } DCA__3GPP__PDP__Context__Type::DCA__3GPP__PDP__Context__Type() { enum_value = UNBOUND_VALUE; } DCA__3GPP__PDP__Context__Type::DCA__3GPP__PDP__Context__Type(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.DCA_3GPP_PDP_Context_Type with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } DCA__3GPP__PDP__Context__Type::DCA__3GPP__PDP__Context__Type(enum_type other_value) { enum_value = other_value; } DCA__3GPP__PDP__Context__Type::DCA__3GPP__PDP__Context__Type(const DCA__3GPP__PDP__Context__Type& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_PDP_Context_Type."); enum_value = other_value.enum_value; } DCA__3GPP__PDP__Context__Type& DCA__3GPP__PDP__Context__Type::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_PDP_Context_Type.", other_value); enum_value = (enum_type)other_value; return *this; } DCA__3GPP__PDP__Context__Type& DCA__3GPP__PDP__Context__Type::operator=(enum_type other_value) { enum_value = other_value; return *this; } DCA__3GPP__PDP__Context__Type& DCA__3GPP__PDP__Context__Type::operator=(const DCA__3GPP__PDP__Context__Type& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_PDP_Context_Type."); enum_value = other_value.enum_value; return *this; } boolean DCA__3GPP__PDP__Context__Type::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_PDP_Context_Type."); return enum_value == other_value; } boolean DCA__3GPP__PDP__Context__Type::operator==(const DCA__3GPP__PDP__Context__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_PDP_Context_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_PDP_Context_Type."); return enum_value == other_value.enum_value; } boolean DCA__3GPP__PDP__Context__Type::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_PDP_Context_Type."); return enum_value < other_value; } boolean DCA__3GPP__PDP__Context__Type::operator<(const DCA__3GPP__PDP__Context__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_PDP_Context_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_PDP_Context_Type."); return enum_value < other_value.enum_value; } boolean DCA__3GPP__PDP__Context__Type::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_PDP_Context_Type."); return enum_value > other_value; } boolean DCA__3GPP__PDP__Context__Type::operator>(const DCA__3GPP__PDP__Context__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_PDP_Context_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_PDP_Context_Type."); return enum_value > other_value.enum_value; } const char *DCA__3GPP__PDP__Context__Type::enum_to_str(enum_type enum_par) { switch (enum_par) { case PRIMARY: return "PRIMARY"; case SECONDARY: return "SECONDARY"; default: return ""; } } DCA__3GPP__PDP__Context__Type::enum_type DCA__3GPP__PDP__Context__Type::str_to_enum(const char *str_par) { if (!strcmp(str_par, "PRIMARY")) return PRIMARY; else if (!strcmp(str_par, "SECONDARY")) return SECONDARY; else return UNKNOWN_VALUE; } boolean DCA__3GPP__PDP__Context__Type::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: return TRUE; default: return FALSE; } } int DCA__3GPP__PDP__Context__Type::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_PDP_Context_Type.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int DCA__3GPP__PDP__Context__Type::enum2int(const DCA__3GPP__PDP__Context__Type& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_PDP_Context_Type.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void DCA__3GPP__PDP__Context__Type::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_PDP_Context_Type.", int_val); enum_value = (enum_type)int_val; } DCA__3GPP__PDP__Context__Type::operator DCA__3GPP__PDP__Context__Type::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.DCA_3GPP_PDP_Context_Type."); return enum_value; } void DCA__3GPP__PDP__Context__Type::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void DCA__3GPP__PDP__Context__Type::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.DCA_3GPP_PDP_Context_Type"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_PDP_Context_Type."); } } void DCA__3GPP__PDP__Context__Type::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_PDP_Context_Type."); text_buf.push_int(enum_value); } void DCA__3GPP__PDP__Context__Type::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.DCA_3GPP_PDP_Context_Type.", enum_value); } void DCA__3GPP__PDP__Context__Type::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void DCA__3GPP__PDP__Context__Type::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int DCA__3GPP__PDP__Context__Type::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int DCA__3GPP__PDP__Context__Type::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void DCA__3GPP__PDP__Context__Type_template::copy_template(const DCA__3GPP__PDP__Context__Type_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new DCA__3GPP__PDP__Context__Type_template[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 DCA__3GPP__PDP__Context__Type_template(*other_value.implication_.precondition); implication_.implied_template = new DCA__3GPP__PDP__Context__Type_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_PDP_Context_Type."); } } DCA__3GPP__PDP__Context__Type_template::DCA__3GPP__PDP__Context__Type_template() { } DCA__3GPP__PDP__Context__Type_template::DCA__3GPP__PDP__Context__Type_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } DCA__3GPP__PDP__Context__Type_template::DCA__3GPP__PDP__Context__Type_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!DCA__3GPP__PDP__Context__Type::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.DCA_3GPP_PDP_Context_Type with unknown numeric value %d.", other_value); single_value = (DCA__3GPP__PDP__Context__Type::enum_type)other_value; } DCA__3GPP__PDP__Context__Type_template::DCA__3GPP__PDP__Context__Type_template(DCA__3GPP__PDP__Context__Type::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } DCA__3GPP__PDP__Context__Type_template::DCA__3GPP__PDP__Context__Type_template(const DCA__3GPP__PDP__Context__Type& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == DCA__3GPP__PDP__Context__Type::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_PDP_Context_Type."); single_value = other_value.enum_value; } DCA__3GPP__PDP__Context__Type_template::DCA__3GPP__PDP__Context__Type_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__PDP__Context__Type::enum_type)(const DCA__3GPP__PDP__Context__Type&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.DCA_3GPP_PDP_Context_Type from an unbound optional field."); } } DCA__3GPP__PDP__Context__Type_template::DCA__3GPP__PDP__Context__Type_template(DCA__3GPP__PDP__Context__Type_template* p_precondition, DCA__3GPP__PDP__Context__Type_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } DCA__3GPP__PDP__Context__Type_template::DCA__3GPP__PDP__Context__Type_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; } DCA__3GPP__PDP__Context__Type_template::DCA__3GPP__PDP__Context__Type_template(const DCA__3GPP__PDP__Context__Type_template& other_value) : Base_Template() { copy_template(other_value); } DCA__3GPP__PDP__Context__Type_template::~DCA__3GPP__PDP__Context__Type_template() { clean_up(); } boolean DCA__3GPP__PDP__Context__Type_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean DCA__3GPP__PDP__Context__Type_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != DCA__3GPP__PDP__Context__Type::UNBOUND_VALUE; } void DCA__3GPP__PDP__Context__Type_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } DCA__3GPP__PDP__Context__Type_template& DCA__3GPP__PDP__Context__Type_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } DCA__3GPP__PDP__Context__Type_template& DCA__3GPP__PDP__Context__Type_template::operator=(int other_value) { if (!DCA__3GPP__PDP__Context__Type::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.DCA_3GPP_PDP_Context_Type.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__PDP__Context__Type::enum_type)other_value; return *this; } DCA__3GPP__PDP__Context__Type_template& DCA__3GPP__PDP__Context__Type_template::operator=(DCA__3GPP__PDP__Context__Type::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } DCA__3GPP__PDP__Context__Type_template& DCA__3GPP__PDP__Context__Type_template::operator=(const DCA__3GPP__PDP__Context__Type& other_value) { if (other_value.enum_value == DCA__3GPP__PDP__Context__Type::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_PDP_Context_Type to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } DCA__3GPP__PDP__Context__Type_template& DCA__3GPP__PDP__Context__Type_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__PDP__Context__Type::enum_type)(const DCA__3GPP__PDP__Context__Type&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.DCA_3GPP_PDP_Context_Type."); } return *this; } DCA__3GPP__PDP__Context__Type_template& DCA__3GPP__PDP__Context__Type_template::operator=(const DCA__3GPP__PDP__Context__Type_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean DCA__3GPP__PDP__Context__Type_template::match(DCA__3GPP__PDP__Context__Type::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_PDP_Context_Type."); } return FALSE; } boolean DCA__3GPP__PDP__Context__Type_template::match(const DCA__3GPP__PDP__Context__Type& other_value, boolean) const { if (other_value.enum_value == DCA__3GPP__PDP__Context__Type::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.DCA_3GPP_PDP_Context_Type with an unbound value."); return match(other_value.enum_value); } DCA__3GPP__PDP__Context__Type::enum_type DCA__3GPP__PDP__Context__Type_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.DCA_3GPP_PDP_Context_Type."); return single_value; } void DCA__3GPP__PDP__Context__Type_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.DCA_3GPP_PDP_Context_Type."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new DCA__3GPP__PDP__Context__Type_template[list_length]; } DCA__3GPP__PDP__Context__Type_template& DCA__3GPP__PDP__Context__Type_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.DCA_3GPP_PDP_Context_Type."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.DCA_3GPP_PDP_Context_Type."); return value_list.list_value[list_index]; } void DCA__3GPP__PDP__Context__Type_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(DCA__3GPP__PDP__Context__Type::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void DCA__3GPP__PDP__Context__Type_template::log_match(const DCA__3GPP__PDP__Context__Type& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void DCA__3GPP__PDP__Context__Type_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_PDP_Context_Type."); } } void DCA__3GPP__PDP__Context__Type_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (DCA__3GPP__PDP__Context__Type::enum_type)text_buf.pull_int().get_val(); if (!DCA__3GPP__PDP__Context__Type::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_PDP_Context_Type.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new DCA__3GPP__PDP__Context__Type_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_PDP_Context_Type."); } } boolean DCA__3GPP__PDP__Context__Type_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean DCA__3GPP__PDP__Context__Type_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { DCA__3GPP__PDP__Context__Type_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { DCA__3GPP__PDP__Context__Type::enum_type enum_val = DCA__3GPP__PDP__Context__Type::str_to_enum(m_p->get_enumerated()); if (!DCA__3GPP__PDP__Context__Type::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_PDP_Context_Type."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { DCA__3GPP__PDP__Context__Type_template* precondition = new DCA__3GPP__PDP__Context__Type_template; precondition->set_param(*m_p->get_elem(0)); DCA__3GPP__PDP__Context__Type_template* implied_template = new DCA__3GPP__PDP__Context__Type_template; implied_template->set_param(*m_p->get_elem(1)); *this = DCA__3GPP__PDP__Context__Type_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.DCA_3GPP_PDP_Context_Type"); } is_ifpresent = param.get_ifpresent(); } void DCA__3GPP__PDP__Context__Type_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.DCA_3GPP_PDP_Context_Type"); } DCA__3GPP__Privacy__Indicator::DCA__3GPP__Privacy__Indicator() { enum_value = UNBOUND_VALUE; } DCA__3GPP__Privacy__Indicator::DCA__3GPP__Privacy__Indicator(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Privacy_Indicator with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } DCA__3GPP__Privacy__Indicator::DCA__3GPP__Privacy__Indicator(enum_type other_value) { enum_value = other_value; } DCA__3GPP__Privacy__Indicator::DCA__3GPP__Privacy__Indicator(const DCA__3GPP__Privacy__Indicator& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Privacy_Indicator."); enum_value = other_value.enum_value; } DCA__3GPP__Privacy__Indicator& DCA__3GPP__Privacy__Indicator::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Privacy_Indicator.", other_value); enum_value = (enum_type)other_value; return *this; } DCA__3GPP__Privacy__Indicator& DCA__3GPP__Privacy__Indicator::operator=(enum_type other_value) { enum_value = other_value; return *this; } DCA__3GPP__Privacy__Indicator& DCA__3GPP__Privacy__Indicator::operator=(const DCA__3GPP__Privacy__Indicator& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Privacy_Indicator."); enum_value = other_value.enum_value; return *this; } boolean DCA__3GPP__Privacy__Indicator::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Privacy_Indicator."); return enum_value == other_value; } boolean DCA__3GPP__Privacy__Indicator::operator==(const DCA__3GPP__Privacy__Indicator& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Privacy_Indicator."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Privacy_Indicator."); return enum_value == other_value.enum_value; } boolean DCA__3GPP__Privacy__Indicator::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Privacy_Indicator."); return enum_value < other_value; } boolean DCA__3GPP__Privacy__Indicator::operator<(const DCA__3GPP__Privacy__Indicator& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Privacy_Indicator."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Privacy_Indicator."); return enum_value < other_value.enum_value; } boolean DCA__3GPP__Privacy__Indicator::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Privacy_Indicator."); return enum_value > other_value; } boolean DCA__3GPP__Privacy__Indicator::operator>(const DCA__3GPP__Privacy__Indicator& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Privacy_Indicator."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Privacy_Indicator."); return enum_value > other_value.enum_value; } const char *DCA__3GPP__Privacy__Indicator::enum_to_str(enum_type enum_par) { switch (enum_par) { case NOT__PRIVATE: return "NOT_PRIVATE"; case PRIVATE: return "PRIVATE"; default: return ""; } } DCA__3GPP__Privacy__Indicator::enum_type DCA__3GPP__Privacy__Indicator::str_to_enum(const char *str_par) { if (!strcmp(str_par, "NOT_PRIVATE")) return NOT__PRIVATE; else if (!strcmp(str_par, "PRIVATE")) return PRIVATE; else return UNKNOWN_VALUE; } boolean DCA__3GPP__Privacy__Indicator::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: return TRUE; default: return FALSE; } } int DCA__3GPP__Privacy__Indicator::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_Privacy_Indicator.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int DCA__3GPP__Privacy__Indicator::enum2int(const DCA__3GPP__Privacy__Indicator& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_Privacy_Indicator.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void DCA__3GPP__Privacy__Indicator::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_Privacy_Indicator.", int_val); enum_value = (enum_type)int_val; } DCA__3GPP__Privacy__Indicator::operator DCA__3GPP__Privacy__Indicator::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.DCA_3GPP_Privacy_Indicator."); return enum_value; } void DCA__3GPP__Privacy__Indicator::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void DCA__3GPP__Privacy__Indicator::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.DCA_3GPP_Privacy_Indicator"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_Privacy_Indicator."); } } void DCA__3GPP__Privacy__Indicator::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Privacy_Indicator."); text_buf.push_int(enum_value); } void DCA__3GPP__Privacy__Indicator::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.DCA_3GPP_Privacy_Indicator.", enum_value); } void DCA__3GPP__Privacy__Indicator::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void DCA__3GPP__Privacy__Indicator::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int DCA__3GPP__Privacy__Indicator::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int DCA__3GPP__Privacy__Indicator::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void DCA__3GPP__Privacy__Indicator_template::copy_template(const DCA__3GPP__Privacy__Indicator_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new DCA__3GPP__Privacy__Indicator_template[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 DCA__3GPP__Privacy__Indicator_template(*other_value.implication_.precondition); implication_.implied_template = new DCA__3GPP__Privacy__Indicator_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Privacy_Indicator."); } } DCA__3GPP__Privacy__Indicator_template::DCA__3GPP__Privacy__Indicator_template() { } DCA__3GPP__Privacy__Indicator_template::DCA__3GPP__Privacy__Indicator_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } DCA__3GPP__Privacy__Indicator_template::DCA__3GPP__Privacy__Indicator_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!DCA__3GPP__Privacy__Indicator::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.DCA_3GPP_Privacy_Indicator with unknown numeric value %d.", other_value); single_value = (DCA__3GPP__Privacy__Indicator::enum_type)other_value; } DCA__3GPP__Privacy__Indicator_template::DCA__3GPP__Privacy__Indicator_template(DCA__3GPP__Privacy__Indicator::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } DCA__3GPP__Privacy__Indicator_template::DCA__3GPP__Privacy__Indicator_template(const DCA__3GPP__Privacy__Indicator& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == DCA__3GPP__Privacy__Indicator::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Privacy_Indicator."); single_value = other_value.enum_value; } DCA__3GPP__Privacy__Indicator_template::DCA__3GPP__Privacy__Indicator_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Privacy__Indicator::enum_type)(const DCA__3GPP__Privacy__Indicator&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.DCA_3GPP_Privacy_Indicator from an unbound optional field."); } } DCA__3GPP__Privacy__Indicator_template::DCA__3GPP__Privacy__Indicator_template(DCA__3GPP__Privacy__Indicator_template* p_precondition, DCA__3GPP__Privacy__Indicator_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } DCA__3GPP__Privacy__Indicator_template::DCA__3GPP__Privacy__Indicator_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; } DCA__3GPP__Privacy__Indicator_template::DCA__3GPP__Privacy__Indicator_template(const DCA__3GPP__Privacy__Indicator_template& other_value) : Base_Template() { copy_template(other_value); } DCA__3GPP__Privacy__Indicator_template::~DCA__3GPP__Privacy__Indicator_template() { clean_up(); } boolean DCA__3GPP__Privacy__Indicator_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean DCA__3GPP__Privacy__Indicator_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != DCA__3GPP__Privacy__Indicator::UNBOUND_VALUE; } void DCA__3GPP__Privacy__Indicator_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } DCA__3GPP__Privacy__Indicator_template& DCA__3GPP__Privacy__Indicator_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } DCA__3GPP__Privacy__Indicator_template& DCA__3GPP__Privacy__Indicator_template::operator=(int other_value) { if (!DCA__3GPP__Privacy__Indicator::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.DCA_3GPP_Privacy_Indicator.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Privacy__Indicator::enum_type)other_value; return *this; } DCA__3GPP__Privacy__Indicator_template& DCA__3GPP__Privacy__Indicator_template::operator=(DCA__3GPP__Privacy__Indicator::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } DCA__3GPP__Privacy__Indicator_template& DCA__3GPP__Privacy__Indicator_template::operator=(const DCA__3GPP__Privacy__Indicator& other_value) { if (other_value.enum_value == DCA__3GPP__Privacy__Indicator::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_Privacy_Indicator to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } DCA__3GPP__Privacy__Indicator_template& DCA__3GPP__Privacy__Indicator_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__Privacy__Indicator::enum_type)(const DCA__3GPP__Privacy__Indicator&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.DCA_3GPP_Privacy_Indicator."); } return *this; } DCA__3GPP__Privacy__Indicator_template& DCA__3GPP__Privacy__Indicator_template::operator=(const DCA__3GPP__Privacy__Indicator_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean DCA__3GPP__Privacy__Indicator_template::match(DCA__3GPP__Privacy__Indicator::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Privacy_Indicator."); } return FALSE; } boolean DCA__3GPP__Privacy__Indicator_template::match(const DCA__3GPP__Privacy__Indicator& other_value, boolean) const { if (other_value.enum_value == DCA__3GPP__Privacy__Indicator::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.DCA_3GPP_Privacy_Indicator with an unbound value."); return match(other_value.enum_value); } DCA__3GPP__Privacy__Indicator::enum_type DCA__3GPP__Privacy__Indicator_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.DCA_3GPP_Privacy_Indicator."); return single_value; } void DCA__3GPP__Privacy__Indicator_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Privacy_Indicator."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new DCA__3GPP__Privacy__Indicator_template[list_length]; } DCA__3GPP__Privacy__Indicator_template& DCA__3GPP__Privacy__Indicator_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.DCA_3GPP_Privacy_Indicator."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.DCA_3GPP_Privacy_Indicator."); return value_list.list_value[list_index]; } void DCA__3GPP__Privacy__Indicator_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(DCA__3GPP__Privacy__Indicator::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void DCA__3GPP__Privacy__Indicator_template::log_match(const DCA__3GPP__Privacy__Indicator& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void DCA__3GPP__Privacy__Indicator_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_Privacy_Indicator."); } } void DCA__3GPP__Privacy__Indicator_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (DCA__3GPP__Privacy__Indicator::enum_type)text_buf.pull_int().get_val(); if (!DCA__3GPP__Privacy__Indicator::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Privacy_Indicator.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new DCA__3GPP__Privacy__Indicator_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_Privacy_Indicator."); } } boolean DCA__3GPP__Privacy__Indicator_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean DCA__3GPP__Privacy__Indicator_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { DCA__3GPP__Privacy__Indicator_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { DCA__3GPP__Privacy__Indicator::enum_type enum_val = DCA__3GPP__Privacy__Indicator::str_to_enum(m_p->get_enumerated()); if (!DCA__3GPP__Privacy__Indicator::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_Privacy_Indicator."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { DCA__3GPP__Privacy__Indicator_template* precondition = new DCA__3GPP__Privacy__Indicator_template; precondition->set_param(*m_p->get_elem(0)); DCA__3GPP__Privacy__Indicator_template* implied_template = new DCA__3GPP__Privacy__Indicator_template; implied_template->set_param(*m_p->get_elem(1)); *this = DCA__3GPP__Privacy__Indicator_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.DCA_3GPP_Privacy_Indicator"); } is_ifpresent = param.get_ifpresent(); } void DCA__3GPP__Privacy__Indicator_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.DCA_3GPP_Privacy_Indicator"); } PCC__3GPP__Flow__Direction::PCC__3GPP__Flow__Direction() { enum_value = UNBOUND_VALUE; } PCC__3GPP__Flow__Direction::PCC__3GPP__Flow__Direction(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.PCC_3GPP_Flow_Direction with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } PCC__3GPP__Flow__Direction::PCC__3GPP__Flow__Direction(enum_type other_value) { enum_value = other_value; } PCC__3GPP__Flow__Direction::PCC__3GPP__Flow__Direction(const PCC__3GPP__Flow__Direction& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Flow_Direction."); enum_value = other_value.enum_value; } PCC__3GPP__Flow__Direction& PCC__3GPP__Flow__Direction::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.PCC_3GPP_Flow_Direction.", other_value); enum_value = (enum_type)other_value; return *this; } PCC__3GPP__Flow__Direction& PCC__3GPP__Flow__Direction::operator=(enum_type other_value) { enum_value = other_value; return *this; } PCC__3GPP__Flow__Direction& PCC__3GPP__Flow__Direction::operator=(const PCC__3GPP__Flow__Direction& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Flow_Direction."); enum_value = other_value.enum_value; return *this; } boolean PCC__3GPP__Flow__Direction::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Flow_Direction."); return enum_value == other_value; } boolean PCC__3GPP__Flow__Direction::operator==(const PCC__3GPP__Flow__Direction& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Flow_Direction."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Flow_Direction."); return enum_value == other_value.enum_value; } boolean PCC__3GPP__Flow__Direction::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Flow_Direction."); return enum_value < other_value; } boolean PCC__3GPP__Flow__Direction::operator<(const PCC__3GPP__Flow__Direction& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Flow_Direction."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Flow_Direction."); return enum_value < other_value.enum_value; } boolean PCC__3GPP__Flow__Direction::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Flow_Direction."); return enum_value > other_value; } boolean PCC__3GPP__Flow__Direction::operator>(const PCC__3GPP__Flow__Direction& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Flow_Direction."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Flow_Direction."); return enum_value > other_value.enum_value; } const char *PCC__3GPP__Flow__Direction::enum_to_str(enum_type enum_par) { switch (enum_par) { case UNSPECIFIED: return "UNSPECIFIED"; case DOWNLINK: return "DOWNLINK"; case UPLINK: return "UPLINK"; case BIDIRECTIONAL: return "BIDIRECTIONAL"; default: return ""; } } PCC__3GPP__Flow__Direction::enum_type PCC__3GPP__Flow__Direction::str_to_enum(const char *str_par) { if (!strcmp(str_par, "UNSPECIFIED")) return UNSPECIFIED; else if (!strcmp(str_par, "DOWNLINK")) return DOWNLINK; else if (!strcmp(str_par, "UPLINK")) return UPLINK; else if (!strcmp(str_par, "BIDIRECTIONAL")) return BIDIRECTIONAL; else return UNKNOWN_VALUE; } boolean PCC__3GPP__Flow__Direction::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: case 2: case 3: return TRUE; default: return FALSE; } } int PCC__3GPP__Flow__Direction::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.PCC_3GPP_Flow_Direction.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int PCC__3GPP__Flow__Direction::enum2int(const PCC__3GPP__Flow__Direction& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.PCC_3GPP_Flow_Direction.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void PCC__3GPP__Flow__Direction::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.PCC_3GPP_Flow_Direction.", int_val); enum_value = (enum_type)int_val; } PCC__3GPP__Flow__Direction::operator PCC__3GPP__Flow__Direction::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.PCC_3GPP_Flow_Direction."); return enum_value; } void PCC__3GPP__Flow__Direction::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void PCC__3GPP__Flow__Direction::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.PCC_3GPP_Flow_Direction"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.PCC_3GPP_Flow_Direction."); } } void PCC__3GPP__Flow__Direction::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Flow_Direction."); text_buf.push_int(enum_value); } void PCC__3GPP__Flow__Direction::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.PCC_3GPP_Flow_Direction.", enum_value); } void PCC__3GPP__Flow__Direction::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void PCC__3GPP__Flow__Direction::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int PCC__3GPP__Flow__Direction::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 3, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int PCC__3GPP__Flow__Direction::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 3); } void PCC__3GPP__Flow__Direction_template::copy_template(const PCC__3GPP__Flow__Direction_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new PCC__3GPP__Flow__Direction_template[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 PCC__3GPP__Flow__Direction_template(*other_value.implication_.precondition); implication_.implied_template = new PCC__3GPP__Flow__Direction_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.PCC_3GPP_Flow_Direction."); } } PCC__3GPP__Flow__Direction_template::PCC__3GPP__Flow__Direction_template() { } PCC__3GPP__Flow__Direction_template::PCC__3GPP__Flow__Direction_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } PCC__3GPP__Flow__Direction_template::PCC__3GPP__Flow__Direction_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!PCC__3GPP__Flow__Direction::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.PCC_3GPP_Flow_Direction with unknown numeric value %d.", other_value); single_value = (PCC__3GPP__Flow__Direction::enum_type)other_value; } PCC__3GPP__Flow__Direction_template::PCC__3GPP__Flow__Direction_template(PCC__3GPP__Flow__Direction::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } PCC__3GPP__Flow__Direction_template::PCC__3GPP__Flow__Direction_template(const PCC__3GPP__Flow__Direction& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == PCC__3GPP__Flow__Direction::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Flow_Direction."); single_value = other_value.enum_value; } PCC__3GPP__Flow__Direction_template::PCC__3GPP__Flow__Direction_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (PCC__3GPP__Flow__Direction::enum_type)(const PCC__3GPP__Flow__Direction&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.PCC_3GPP_Flow_Direction from an unbound optional field."); } } PCC__3GPP__Flow__Direction_template::PCC__3GPP__Flow__Direction_template(PCC__3GPP__Flow__Direction_template* p_precondition, PCC__3GPP__Flow__Direction_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } PCC__3GPP__Flow__Direction_template::PCC__3GPP__Flow__Direction_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; } PCC__3GPP__Flow__Direction_template::PCC__3GPP__Flow__Direction_template(const PCC__3GPP__Flow__Direction_template& other_value) : Base_Template() { copy_template(other_value); } PCC__3GPP__Flow__Direction_template::~PCC__3GPP__Flow__Direction_template() { clean_up(); } boolean PCC__3GPP__Flow__Direction_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean PCC__3GPP__Flow__Direction_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != PCC__3GPP__Flow__Direction::UNBOUND_VALUE; } void PCC__3GPP__Flow__Direction_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } PCC__3GPP__Flow__Direction_template& PCC__3GPP__Flow__Direction_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } PCC__3GPP__Flow__Direction_template& PCC__3GPP__Flow__Direction_template::operator=(int other_value) { if (!PCC__3GPP__Flow__Direction::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.PCC_3GPP_Flow_Direction.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (PCC__3GPP__Flow__Direction::enum_type)other_value; return *this; } PCC__3GPP__Flow__Direction_template& PCC__3GPP__Flow__Direction_template::operator=(PCC__3GPP__Flow__Direction::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } PCC__3GPP__Flow__Direction_template& PCC__3GPP__Flow__Direction_template::operator=(const PCC__3GPP__Flow__Direction& other_value) { if (other_value.enum_value == PCC__3GPP__Flow__Direction::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Flow_Direction to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } PCC__3GPP__Flow__Direction_template& PCC__3GPP__Flow__Direction_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (PCC__3GPP__Flow__Direction::enum_type)(const PCC__3GPP__Flow__Direction&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.PCC_3GPP_Flow_Direction."); } return *this; } PCC__3GPP__Flow__Direction_template& PCC__3GPP__Flow__Direction_template::operator=(const PCC__3GPP__Flow__Direction_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean PCC__3GPP__Flow__Direction_template::match(PCC__3GPP__Flow__Direction::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.PCC_3GPP_Flow_Direction."); } return FALSE; } boolean PCC__3GPP__Flow__Direction_template::match(const PCC__3GPP__Flow__Direction& other_value, boolean) const { if (other_value.enum_value == PCC__3GPP__Flow__Direction::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.PCC_3GPP_Flow_Direction with an unbound value."); return match(other_value.enum_value); } PCC__3GPP__Flow__Direction::enum_type PCC__3GPP__Flow__Direction_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.PCC_3GPP_Flow_Direction."); return single_value; } void PCC__3GPP__Flow__Direction_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.PCC_3GPP_Flow_Direction."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new PCC__3GPP__Flow__Direction_template[list_length]; } PCC__3GPP__Flow__Direction_template& PCC__3GPP__Flow__Direction_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.PCC_3GPP_Flow_Direction."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.PCC_3GPP_Flow_Direction."); return value_list.list_value[list_index]; } void PCC__3GPP__Flow__Direction_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(PCC__3GPP__Flow__Direction::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void PCC__3GPP__Flow__Direction_template::log_match(const PCC__3GPP__Flow__Direction& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void PCC__3GPP__Flow__Direction_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.PCC_3GPP_Flow_Direction."); } } void PCC__3GPP__Flow__Direction_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (PCC__3GPP__Flow__Direction::enum_type)text_buf.pull_int().get_val(); if (!PCC__3GPP__Flow__Direction::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.PCC_3GPP_Flow_Direction.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new PCC__3GPP__Flow__Direction_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.PCC_3GPP_Flow_Direction."); } } boolean PCC__3GPP__Flow__Direction_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean PCC__3GPP__Flow__Direction_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { PCC__3GPP__Flow__Direction_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { PCC__3GPP__Flow__Direction::enum_type enum_val = PCC__3GPP__Flow__Direction::str_to_enum(m_p->get_enumerated()); if (!PCC__3GPP__Flow__Direction::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.PCC_3GPP_Flow_Direction."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { PCC__3GPP__Flow__Direction_template* precondition = new PCC__3GPP__Flow__Direction_template; precondition->set_param(*m_p->get_elem(0)); PCC__3GPP__Flow__Direction_template* implied_template = new PCC__3GPP__Flow__Direction_template; implied_template->set_param(*m_p->get_elem(1)); *this = PCC__3GPP__Flow__Direction_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.PCC_3GPP_Flow_Direction"); } is_ifpresent = param.get_ifpresent(); } void PCC__3GPP__Flow__Direction_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.PCC_3GPP_Flow_Direction"); } DCA__3GPP__ProSe__Reason__For__Cancellation::DCA__3GPP__ProSe__Reason__For__Cancellation() { enum_value = UNBOUND_VALUE; } DCA__3GPP__ProSe__Reason__For__Cancellation::DCA__3GPP__ProSe__Reason__For__Cancellation(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Reason_For_Cancellation with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } DCA__3GPP__ProSe__Reason__For__Cancellation::DCA__3GPP__ProSe__Reason__For__Cancellation(enum_type other_value) { enum_value = other_value; } DCA__3GPP__ProSe__Reason__For__Cancellation::DCA__3GPP__ProSe__Reason__For__Cancellation(const DCA__3GPP__ProSe__Reason__For__Cancellation& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Reason_For_Cancellation."); enum_value = other_value.enum_value; } DCA__3GPP__ProSe__Reason__For__Cancellation& DCA__3GPP__ProSe__Reason__For__Cancellation::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Reason_For_Cancellation.", other_value); enum_value = (enum_type)other_value; return *this; } DCA__3GPP__ProSe__Reason__For__Cancellation& DCA__3GPP__ProSe__Reason__For__Cancellation::operator=(enum_type other_value) { enum_value = other_value; return *this; } DCA__3GPP__ProSe__Reason__For__Cancellation& DCA__3GPP__ProSe__Reason__For__Cancellation::operator=(const DCA__3GPP__ProSe__Reason__For__Cancellation& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Reason_For_Cancellation."); enum_value = other_value.enum_value; return *this; } boolean DCA__3GPP__ProSe__Reason__For__Cancellation::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Reason_For_Cancellation."); return enum_value == other_value; } boolean DCA__3GPP__ProSe__Reason__For__Cancellation::operator==(const DCA__3GPP__ProSe__Reason__For__Cancellation& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Reason_For_Cancellation."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Reason_For_Cancellation."); return enum_value == other_value.enum_value; } boolean DCA__3GPP__ProSe__Reason__For__Cancellation::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Reason_For_Cancellation."); return enum_value < other_value; } boolean DCA__3GPP__ProSe__Reason__For__Cancellation::operator<(const DCA__3GPP__ProSe__Reason__For__Cancellation& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Reason_For_Cancellation."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Reason_For_Cancellation."); return enum_value < other_value.enum_value; } boolean DCA__3GPP__ProSe__Reason__For__Cancellation::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Reason_For_Cancellation."); return enum_value > other_value; } boolean DCA__3GPP__ProSe__Reason__For__Cancellation::operator>(const DCA__3GPP__ProSe__Reason__For__Cancellation& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Reason_For_Cancellation."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Reason_For_Cancellation."); return enum_value > other_value.enum_value; } const char *DCA__3GPP__ProSe__Reason__For__Cancellation::enum_to_str(enum_type enum_par) { switch (enum_par) { case PROXIMITY__ALERT__SENT: return "PROXIMITY_ALERT_SENT"; case TIME__EXPIRED__WITH__NO__RENEWAL: return "TIME_EXPIRED_WITH_NO_RENEWAL"; case REQUESTOR__CANCELLATION: return "REQUESTOR_CANCELLATION"; default: return ""; } } DCA__3GPP__ProSe__Reason__For__Cancellation::enum_type DCA__3GPP__ProSe__Reason__For__Cancellation::str_to_enum(const char *str_par) { if (!strcmp(str_par, "PROXIMITY_ALERT_SENT")) return PROXIMITY__ALERT__SENT; else if (!strcmp(str_par, "TIME_EXPIRED_WITH_NO_RENEWAL")) return TIME__EXPIRED__WITH__NO__RENEWAL; else if (!strcmp(str_par, "REQUESTOR_CANCELLATION")) return REQUESTOR__CANCELLATION; else return UNKNOWN_VALUE; } boolean DCA__3GPP__ProSe__Reason__For__Cancellation::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: case 2: return TRUE; default: return FALSE; } } int DCA__3GPP__ProSe__Reason__For__Cancellation::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Reason_For_Cancellation.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int DCA__3GPP__ProSe__Reason__For__Cancellation::enum2int(const DCA__3GPP__ProSe__Reason__For__Cancellation& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Reason_For_Cancellation.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void DCA__3GPP__ProSe__Reason__For__Cancellation::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Reason_For_Cancellation.", int_val); enum_value = (enum_type)int_val; } DCA__3GPP__ProSe__Reason__For__Cancellation::operator DCA__3GPP__ProSe__Reason__For__Cancellation::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Reason_For_Cancellation."); return enum_value; } void DCA__3GPP__ProSe__Reason__For__Cancellation::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void DCA__3GPP__ProSe__Reason__For__Cancellation::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.DCA_3GPP_ProSe_Reason_For_Cancellation"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_ProSe_Reason_For_Cancellation."); } } void DCA__3GPP__ProSe__Reason__For__Cancellation::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Reason_For_Cancellation."); text_buf.push_int(enum_value); } void DCA__3GPP__ProSe__Reason__For__Cancellation::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Reason_For_Cancellation.", enum_value); } void DCA__3GPP__ProSe__Reason__For__Cancellation::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void DCA__3GPP__ProSe__Reason__For__Cancellation::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int DCA__3GPP__ProSe__Reason__For__Cancellation::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int DCA__3GPP__ProSe__Reason__For__Cancellation::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void DCA__3GPP__ProSe__Reason__For__Cancellation_template::copy_template(const DCA__3GPP__ProSe__Reason__For__Cancellation_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new DCA__3GPP__ProSe__Reason__For__Cancellation_template[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 DCA__3GPP__ProSe__Reason__For__Cancellation_template(*other_value.implication_.precondition); implication_.implied_template = new DCA__3GPP__ProSe__Reason__For__Cancellation_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Reason_For_Cancellation."); } } DCA__3GPP__ProSe__Reason__For__Cancellation_template::DCA__3GPP__ProSe__Reason__For__Cancellation_template() { } DCA__3GPP__ProSe__Reason__For__Cancellation_template::DCA__3GPP__ProSe__Reason__For__Cancellation_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } DCA__3GPP__ProSe__Reason__For__Cancellation_template::DCA__3GPP__ProSe__Reason__For__Cancellation_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!DCA__3GPP__ProSe__Reason__For__Cancellation::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Reason_For_Cancellation with unknown numeric value %d.", other_value); single_value = (DCA__3GPP__ProSe__Reason__For__Cancellation::enum_type)other_value; } DCA__3GPP__ProSe__Reason__For__Cancellation_template::DCA__3GPP__ProSe__Reason__For__Cancellation_template(DCA__3GPP__ProSe__Reason__For__Cancellation::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } DCA__3GPP__ProSe__Reason__For__Cancellation_template::DCA__3GPP__ProSe__Reason__For__Cancellation_template(const DCA__3GPP__ProSe__Reason__For__Cancellation& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == DCA__3GPP__ProSe__Reason__For__Cancellation::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Reason_For_Cancellation."); single_value = other_value.enum_value; } DCA__3GPP__ProSe__Reason__For__Cancellation_template::DCA__3GPP__ProSe__Reason__For__Cancellation_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__ProSe__Reason__For__Cancellation::enum_type)(const DCA__3GPP__ProSe__Reason__For__Cancellation&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Reason_For_Cancellation from an unbound optional field."); } } DCA__3GPP__ProSe__Reason__For__Cancellation_template::DCA__3GPP__ProSe__Reason__For__Cancellation_template(DCA__3GPP__ProSe__Reason__For__Cancellation_template* p_precondition, DCA__3GPP__ProSe__Reason__For__Cancellation_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } DCA__3GPP__ProSe__Reason__For__Cancellation_template::DCA__3GPP__ProSe__Reason__For__Cancellation_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; } DCA__3GPP__ProSe__Reason__For__Cancellation_template::DCA__3GPP__ProSe__Reason__For__Cancellation_template(const DCA__3GPP__ProSe__Reason__For__Cancellation_template& other_value) : Base_Template() { copy_template(other_value); } DCA__3GPP__ProSe__Reason__For__Cancellation_template::~DCA__3GPP__ProSe__Reason__For__Cancellation_template() { clean_up(); } boolean DCA__3GPP__ProSe__Reason__For__Cancellation_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean DCA__3GPP__ProSe__Reason__For__Cancellation_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != DCA__3GPP__ProSe__Reason__For__Cancellation::UNBOUND_VALUE; } void DCA__3GPP__ProSe__Reason__For__Cancellation_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } DCA__3GPP__ProSe__Reason__For__Cancellation_template& DCA__3GPP__ProSe__Reason__For__Cancellation_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } DCA__3GPP__ProSe__Reason__For__Cancellation_template& DCA__3GPP__ProSe__Reason__For__Cancellation_template::operator=(int other_value) { if (!DCA__3GPP__ProSe__Reason__For__Cancellation::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Reason_For_Cancellation.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__ProSe__Reason__For__Cancellation::enum_type)other_value; return *this; } DCA__3GPP__ProSe__Reason__For__Cancellation_template& DCA__3GPP__ProSe__Reason__For__Cancellation_template::operator=(DCA__3GPP__ProSe__Reason__For__Cancellation::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } DCA__3GPP__ProSe__Reason__For__Cancellation_template& DCA__3GPP__ProSe__Reason__For__Cancellation_template::operator=(const DCA__3GPP__ProSe__Reason__For__Cancellation& other_value) { if (other_value.enum_value == DCA__3GPP__ProSe__Reason__For__Cancellation::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Reason_For_Cancellation to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } DCA__3GPP__ProSe__Reason__For__Cancellation_template& DCA__3GPP__ProSe__Reason__For__Cancellation_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__ProSe__Reason__For__Cancellation::enum_type)(const DCA__3GPP__ProSe__Reason__For__Cancellation&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Reason_For_Cancellation."); } return *this; } DCA__3GPP__ProSe__Reason__For__Cancellation_template& DCA__3GPP__ProSe__Reason__For__Cancellation_template::operator=(const DCA__3GPP__ProSe__Reason__For__Cancellation_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean DCA__3GPP__ProSe__Reason__For__Cancellation_template::match(DCA__3GPP__ProSe__Reason__For__Cancellation::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Reason_For_Cancellation."); } return FALSE; } boolean DCA__3GPP__ProSe__Reason__For__Cancellation_template::match(const DCA__3GPP__ProSe__Reason__For__Cancellation& other_value, boolean) const { if (other_value.enum_value == DCA__3GPP__ProSe__Reason__For__Cancellation::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Reason_For_Cancellation with an unbound value."); return match(other_value.enum_value); } DCA__3GPP__ProSe__Reason__For__Cancellation::enum_type DCA__3GPP__ProSe__Reason__For__Cancellation_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Reason_For_Cancellation."); return single_value; } void DCA__3GPP__ProSe__Reason__For__Cancellation_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Reason_For_Cancellation."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new DCA__3GPP__ProSe__Reason__For__Cancellation_template[list_length]; } DCA__3GPP__ProSe__Reason__For__Cancellation_template& DCA__3GPP__ProSe__Reason__For__Cancellation_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Reason_For_Cancellation."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Reason_For_Cancellation."); return value_list.list_value[list_index]; } void DCA__3GPP__ProSe__Reason__For__Cancellation_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(DCA__3GPP__ProSe__Reason__For__Cancellation::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void DCA__3GPP__ProSe__Reason__For__Cancellation_template::log_match(const DCA__3GPP__ProSe__Reason__For__Cancellation& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void DCA__3GPP__ProSe__Reason__For__Cancellation_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Reason_For_Cancellation."); } } void DCA__3GPP__ProSe__Reason__For__Cancellation_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (DCA__3GPP__ProSe__Reason__For__Cancellation::enum_type)text_buf.pull_int().get_val(); if (!DCA__3GPP__ProSe__Reason__For__Cancellation::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Reason_For_Cancellation.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new DCA__3GPP__ProSe__Reason__For__Cancellation_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_ProSe_Reason_For_Cancellation."); } } boolean DCA__3GPP__ProSe__Reason__For__Cancellation_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean DCA__3GPP__ProSe__Reason__For__Cancellation_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { DCA__3GPP__ProSe__Reason__For__Cancellation_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { DCA__3GPP__ProSe__Reason__For__Cancellation::enum_type enum_val = DCA__3GPP__ProSe__Reason__For__Cancellation::str_to_enum(m_p->get_enumerated()); if (!DCA__3GPP__ProSe__Reason__For__Cancellation::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_ProSe_Reason_For_Cancellation."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { DCA__3GPP__ProSe__Reason__For__Cancellation_template* precondition = new DCA__3GPP__ProSe__Reason__For__Cancellation_template; precondition->set_param(*m_p->get_elem(0)); DCA__3GPP__ProSe__Reason__For__Cancellation_template* implied_template = new DCA__3GPP__ProSe__Reason__For__Cancellation_template; implied_template->set_param(*m_p->get_elem(1)); *this = DCA__3GPP__ProSe__Reason__For__Cancellation_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.DCA_3GPP_ProSe_Reason_For_Cancellation"); } is_ifpresent = param.get_ifpresent(); } void DCA__3GPP__ProSe__Reason__For__Cancellation_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.DCA_3GPP_ProSe_Reason_For_Cancellation"); } PCC__3GPP__Session__Release__Cause::PCC__3GPP__Session__Release__Cause() { enum_value = UNBOUND_VALUE; } PCC__3GPP__Session__Release__Cause::PCC__3GPP__Session__Release__Cause(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.PCC_3GPP_Session_Release_Cause with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } PCC__3GPP__Session__Release__Cause::PCC__3GPP__Session__Release__Cause(enum_type other_value) { enum_value = other_value; } PCC__3GPP__Session__Release__Cause::PCC__3GPP__Session__Release__Cause(const PCC__3GPP__Session__Release__Cause& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Session_Release_Cause."); enum_value = other_value.enum_value; } PCC__3GPP__Session__Release__Cause& PCC__3GPP__Session__Release__Cause::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.PCC_3GPP_Session_Release_Cause.", other_value); enum_value = (enum_type)other_value; return *this; } PCC__3GPP__Session__Release__Cause& PCC__3GPP__Session__Release__Cause::operator=(enum_type other_value) { enum_value = other_value; return *this; } PCC__3GPP__Session__Release__Cause& PCC__3GPP__Session__Release__Cause::operator=(const PCC__3GPP__Session__Release__Cause& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Session_Release_Cause."); enum_value = other_value.enum_value; return *this; } boolean PCC__3GPP__Session__Release__Cause::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Session_Release_Cause."); return enum_value == other_value; } boolean PCC__3GPP__Session__Release__Cause::operator==(const PCC__3GPP__Session__Release__Cause& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Session_Release_Cause."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Session_Release_Cause."); return enum_value == other_value.enum_value; } boolean PCC__3GPP__Session__Release__Cause::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Session_Release_Cause."); return enum_value < other_value; } boolean PCC__3GPP__Session__Release__Cause::operator<(const PCC__3GPP__Session__Release__Cause& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Session_Release_Cause."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Session_Release_Cause."); return enum_value < other_value.enum_value; } boolean PCC__3GPP__Session__Release__Cause::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Session_Release_Cause."); return enum_value > other_value; } boolean PCC__3GPP__Session__Release__Cause::operator>(const PCC__3GPP__Session__Release__Cause& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Session_Release_Cause."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Session_Release_Cause."); return enum_value > other_value.enum_value; } const char *PCC__3GPP__Session__Release__Cause::enum_to_str(enum_type enum_par) { switch (enum_par) { case UNSPECIFIED__REASON: return "UNSPECIFIED_REASON"; case UE__SUBSCRIPTION__REASON: return "UE_SUBSCRIPTION_REASON"; case INSUFFICIENT__SERVER__RESOURCES: return "INSUFFICIENT_SERVER_RESOURCES"; case IP__CAN__SESSION__TERMINATION: return "IP_CAN_SESSION_TERMINATION"; case UE__IP__ADDRESS__RELEASE: return "UE_IP_ADDRESS_RELEASE"; default: return ""; } } PCC__3GPP__Session__Release__Cause::enum_type PCC__3GPP__Session__Release__Cause::str_to_enum(const char *str_par) { if (!strcmp(str_par, "UNSPECIFIED_REASON")) return UNSPECIFIED__REASON; else if (!strcmp(str_par, "UE_SUBSCRIPTION_REASON")) return UE__SUBSCRIPTION__REASON; else if (!strcmp(str_par, "INSUFFICIENT_SERVER_RESOURCES")) return INSUFFICIENT__SERVER__RESOURCES; else if (!strcmp(str_par, "IP_CAN_SESSION_TERMINATION")) return IP__CAN__SESSION__TERMINATION; else if (!strcmp(str_par, "UE_IP_ADDRESS_RELEASE")) return UE__IP__ADDRESS__RELEASE; else return UNKNOWN_VALUE; } boolean PCC__3GPP__Session__Release__Cause::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: case 2: case 3: case 4: return TRUE; default: return FALSE; } } int PCC__3GPP__Session__Release__Cause::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.PCC_3GPP_Session_Release_Cause.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int PCC__3GPP__Session__Release__Cause::enum2int(const PCC__3GPP__Session__Release__Cause& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.PCC_3GPP_Session_Release_Cause.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void PCC__3GPP__Session__Release__Cause::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.PCC_3GPP_Session_Release_Cause.", int_val); enum_value = (enum_type)int_val; } PCC__3GPP__Session__Release__Cause::operator PCC__3GPP__Session__Release__Cause::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.PCC_3GPP_Session_Release_Cause."); return enum_value; } void PCC__3GPP__Session__Release__Cause::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void PCC__3GPP__Session__Release__Cause::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.PCC_3GPP_Session_Release_Cause"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.PCC_3GPP_Session_Release_Cause."); } } void PCC__3GPP__Session__Release__Cause::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Session_Release_Cause."); text_buf.push_int(enum_value); } void PCC__3GPP__Session__Release__Cause::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.PCC_3GPP_Session_Release_Cause.", enum_value); } void PCC__3GPP__Session__Release__Cause::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void PCC__3GPP__Session__Release__Cause::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int PCC__3GPP__Session__Release__Cause::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 3, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int PCC__3GPP__Session__Release__Cause::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 3); } void PCC__3GPP__Session__Release__Cause_template::copy_template(const PCC__3GPP__Session__Release__Cause_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new PCC__3GPP__Session__Release__Cause_template[value_list.n_values]; for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) value_list.list_value[list_count].copy_template(other_value.value_list.list_value[list_count]); break; case IMPLICATION_MATCH: implication_.precondition = new PCC__3GPP__Session__Release__Cause_template(*other_value.implication_.precondition); implication_.implied_template = new PCC__3GPP__Session__Release__Cause_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.PCC_3GPP_Session_Release_Cause."); } } PCC__3GPP__Session__Release__Cause_template::PCC__3GPP__Session__Release__Cause_template() { } PCC__3GPP__Session__Release__Cause_template::PCC__3GPP__Session__Release__Cause_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } PCC__3GPP__Session__Release__Cause_template::PCC__3GPP__Session__Release__Cause_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!PCC__3GPP__Session__Release__Cause::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.PCC_3GPP_Session_Release_Cause with unknown numeric value %d.", other_value); single_value = (PCC__3GPP__Session__Release__Cause::enum_type)other_value; } PCC__3GPP__Session__Release__Cause_template::PCC__3GPP__Session__Release__Cause_template(PCC__3GPP__Session__Release__Cause::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } PCC__3GPP__Session__Release__Cause_template::PCC__3GPP__Session__Release__Cause_template(const PCC__3GPP__Session__Release__Cause& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == PCC__3GPP__Session__Release__Cause::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Session_Release_Cause."); single_value = other_value.enum_value; } PCC__3GPP__Session__Release__Cause_template::PCC__3GPP__Session__Release__Cause_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (PCC__3GPP__Session__Release__Cause::enum_type)(const PCC__3GPP__Session__Release__Cause&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.PCC_3GPP_Session_Release_Cause from an unbound optional field."); } } PCC__3GPP__Session__Release__Cause_template::PCC__3GPP__Session__Release__Cause_template(PCC__3GPP__Session__Release__Cause_template* p_precondition, PCC__3GPP__Session__Release__Cause_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } PCC__3GPP__Session__Release__Cause_template::PCC__3GPP__Session__Release__Cause_template(Dynamic_Match_Interface* p_dyn_match) : Base_Template(DYNAMIC_MATCH) { dyn_match = new dynmatch_struct; dyn_match->ptr = p_dyn_match; dyn_match->ref_count = 1; } PCC__3GPP__Session__Release__Cause_template::PCC__3GPP__Session__Release__Cause_template(const PCC__3GPP__Session__Release__Cause_template& other_value) : Base_Template() { copy_template(other_value); } PCC__3GPP__Session__Release__Cause_template::~PCC__3GPP__Session__Release__Cause_template() { clean_up(); } boolean PCC__3GPP__Session__Release__Cause_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean PCC__3GPP__Session__Release__Cause_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != PCC__3GPP__Session__Release__Cause::UNBOUND_VALUE; } void PCC__3GPP__Session__Release__Cause_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } PCC__3GPP__Session__Release__Cause_template& PCC__3GPP__Session__Release__Cause_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } PCC__3GPP__Session__Release__Cause_template& PCC__3GPP__Session__Release__Cause_template::operator=(int other_value) { if (!PCC__3GPP__Session__Release__Cause::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.PCC_3GPP_Session_Release_Cause.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (PCC__3GPP__Session__Release__Cause::enum_type)other_value; return *this; } PCC__3GPP__Session__Release__Cause_template& PCC__3GPP__Session__Release__Cause_template::operator=(PCC__3GPP__Session__Release__Cause::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } PCC__3GPP__Session__Release__Cause_template& PCC__3GPP__Session__Release__Cause_template::operator=(const PCC__3GPP__Session__Release__Cause& other_value) { if (other_value.enum_value == PCC__3GPP__Session__Release__Cause::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Session_Release_Cause to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } PCC__3GPP__Session__Release__Cause_template& PCC__3GPP__Session__Release__Cause_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (PCC__3GPP__Session__Release__Cause::enum_type)(const PCC__3GPP__Session__Release__Cause&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.PCC_3GPP_Session_Release_Cause."); } return *this; } PCC__3GPP__Session__Release__Cause_template& PCC__3GPP__Session__Release__Cause_template::operator=(const PCC__3GPP__Session__Release__Cause_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean PCC__3GPP__Session__Release__Cause_template::match(PCC__3GPP__Session__Release__Cause::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.PCC_3GPP_Session_Release_Cause."); } return FALSE; } boolean PCC__3GPP__Session__Release__Cause_template::match(const PCC__3GPP__Session__Release__Cause& other_value, boolean) const { if (other_value.enum_value == PCC__3GPP__Session__Release__Cause::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.PCC_3GPP_Session_Release_Cause with an unbound value."); return match(other_value.enum_value); } PCC__3GPP__Session__Release__Cause::enum_type PCC__3GPP__Session__Release__Cause_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.PCC_3GPP_Session_Release_Cause."); return single_value; } void PCC__3GPP__Session__Release__Cause_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.PCC_3GPP_Session_Release_Cause."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new PCC__3GPP__Session__Release__Cause_template[list_length]; } PCC__3GPP__Session__Release__Cause_template& PCC__3GPP__Session__Release__Cause_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.PCC_3GPP_Session_Release_Cause."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.PCC_3GPP_Session_Release_Cause."); return value_list.list_value[list_index]; } void PCC__3GPP__Session__Release__Cause_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(PCC__3GPP__Session__Release__Cause::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void PCC__3GPP__Session__Release__Cause_template::log_match(const PCC__3GPP__Session__Release__Cause& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void PCC__3GPP__Session__Release__Cause_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.PCC_3GPP_Session_Release_Cause."); } } void PCC__3GPP__Session__Release__Cause_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (PCC__3GPP__Session__Release__Cause::enum_type)text_buf.pull_int().get_val(); if (!PCC__3GPP__Session__Release__Cause::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.PCC_3GPP_Session_Release_Cause.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new PCC__3GPP__Session__Release__Cause_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.PCC_3GPP_Session_Release_Cause."); } } boolean PCC__3GPP__Session__Release__Cause_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean PCC__3GPP__Session__Release__Cause_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { PCC__3GPP__Session__Release__Cause_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { PCC__3GPP__Session__Release__Cause::enum_type enum_val = PCC__3GPP__Session__Release__Cause::str_to_enum(m_p->get_enumerated()); if (!PCC__3GPP__Session__Release__Cause::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.PCC_3GPP_Session_Release_Cause."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { PCC__3GPP__Session__Release__Cause_template* precondition = new PCC__3GPP__Session__Release__Cause_template; precondition->set_param(*m_p->get_elem(0)); PCC__3GPP__Session__Release__Cause_template* implied_template = new PCC__3GPP__Session__Release__Cause_template; implied_template->set_param(*m_p->get_elem(1)); *this = PCC__3GPP__Session__Release__Cause_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.PCC_3GPP_Session_Release_Cause"); } is_ifpresent = param.get_ifpresent(); } void PCC__3GPP__Session__Release__Cause_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.PCC_3GPP_Session_Release_Cause"); } AAA__3GPP__MDT__User__Consent::AAA__3GPP__MDT__User__Consent() { enum_value = UNBOUND_VALUE; } AAA__3GPP__MDT__User__Consent::AAA__3GPP__MDT__User__Consent(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.AAA_3GPP_MDT_User_Consent with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } AAA__3GPP__MDT__User__Consent::AAA__3GPP__MDT__User__Consent(enum_type other_value) { enum_value = other_value; } AAA__3GPP__MDT__User__Consent::AAA__3GPP__MDT__User__Consent(const AAA__3GPP__MDT__User__Consent& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_MDT_User_Consent."); enum_value = other_value.enum_value; } AAA__3GPP__MDT__User__Consent& AAA__3GPP__MDT__User__Consent::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.AAA_3GPP_MDT_User_Consent.", other_value); enum_value = (enum_type)other_value; return *this; } AAA__3GPP__MDT__User__Consent& AAA__3GPP__MDT__User__Consent::operator=(enum_type other_value) { enum_value = other_value; return *this; } AAA__3GPP__MDT__User__Consent& AAA__3GPP__MDT__User__Consent::operator=(const AAA__3GPP__MDT__User__Consent& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_MDT_User_Consent."); enum_value = other_value.enum_value; return *this; } boolean AAA__3GPP__MDT__User__Consent::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_MDT_User_Consent."); return enum_value == other_value; } boolean AAA__3GPP__MDT__User__Consent::operator==(const AAA__3GPP__MDT__User__Consent& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_MDT_User_Consent."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_MDT_User_Consent."); return enum_value == other_value.enum_value; } boolean AAA__3GPP__MDT__User__Consent::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_MDT_User_Consent."); return enum_value < other_value; } boolean AAA__3GPP__MDT__User__Consent::operator<(const AAA__3GPP__MDT__User__Consent& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_MDT_User_Consent."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_MDT_User_Consent."); return enum_value < other_value.enum_value; } boolean AAA__3GPP__MDT__User__Consent::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_MDT_User_Consent."); return enum_value > other_value; } boolean AAA__3GPP__MDT__User__Consent::operator>(const AAA__3GPP__MDT__User__Consent& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_MDT_User_Consent."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_MDT_User_Consent."); return enum_value > other_value.enum_value; } const char *AAA__3GPP__MDT__User__Consent::enum_to_str(enum_type enum_par) { switch (enum_par) { case CONSENT__NOT__GIVEN: return "CONSENT_NOT_GIVEN"; case CONSENT__GIVEN: return "CONSENT_GIVEN"; default: return ""; } } AAA__3GPP__MDT__User__Consent::enum_type AAA__3GPP__MDT__User__Consent::str_to_enum(const char *str_par) { if (!strcmp(str_par, "CONSENT_NOT_GIVEN")) return CONSENT__NOT__GIVEN; else if (!strcmp(str_par, "CONSENT_GIVEN")) return CONSENT__GIVEN; else return UNKNOWN_VALUE; } boolean AAA__3GPP__MDT__User__Consent::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: return TRUE; default: return FALSE; } } int AAA__3GPP__MDT__User__Consent::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.AAA_3GPP_MDT_User_Consent.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int AAA__3GPP__MDT__User__Consent::enum2int(const AAA__3GPP__MDT__User__Consent& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.AAA_3GPP_MDT_User_Consent.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void AAA__3GPP__MDT__User__Consent::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.AAA_3GPP_MDT_User_Consent.", int_val); enum_value = (enum_type)int_val; } AAA__3GPP__MDT__User__Consent::operator AAA__3GPP__MDT__User__Consent::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.AAA_3GPP_MDT_User_Consent."); return enum_value; } void AAA__3GPP__MDT__User__Consent::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void AAA__3GPP__MDT__User__Consent::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.AAA_3GPP_MDT_User_Consent"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.AAA_3GPP_MDT_User_Consent."); } } void AAA__3GPP__MDT__User__Consent::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_MDT_User_Consent."); text_buf.push_int(enum_value); } void AAA__3GPP__MDT__User__Consent::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.AAA_3GPP_MDT_User_Consent.", enum_value); } void AAA__3GPP__MDT__User__Consent::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void AAA__3GPP__MDT__User__Consent::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int AAA__3GPP__MDT__User__Consent::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int AAA__3GPP__MDT__User__Consent::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void AAA__3GPP__MDT__User__Consent_template::copy_template(const AAA__3GPP__MDT__User__Consent_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new AAA__3GPP__MDT__User__Consent_template[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 AAA__3GPP__MDT__User__Consent_template(*other_value.implication_.precondition); implication_.implied_template = new AAA__3GPP__MDT__User__Consent_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_MDT_User_Consent."); } } AAA__3GPP__MDT__User__Consent_template::AAA__3GPP__MDT__User__Consent_template() { } AAA__3GPP__MDT__User__Consent_template::AAA__3GPP__MDT__User__Consent_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } AAA__3GPP__MDT__User__Consent_template::AAA__3GPP__MDT__User__Consent_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!AAA__3GPP__MDT__User__Consent::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.AAA_3GPP_MDT_User_Consent with unknown numeric value %d.", other_value); single_value = (AAA__3GPP__MDT__User__Consent::enum_type)other_value; } AAA__3GPP__MDT__User__Consent_template::AAA__3GPP__MDT__User__Consent_template(AAA__3GPP__MDT__User__Consent::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } AAA__3GPP__MDT__User__Consent_template::AAA__3GPP__MDT__User__Consent_template(const AAA__3GPP__MDT__User__Consent& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == AAA__3GPP__MDT__User__Consent::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_MDT_User_Consent."); single_value = other_value.enum_value; } AAA__3GPP__MDT__User__Consent_template::AAA__3GPP__MDT__User__Consent_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__MDT__User__Consent::enum_type)(const AAA__3GPP__MDT__User__Consent&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.AAA_3GPP_MDT_User_Consent from an unbound optional field."); } } AAA__3GPP__MDT__User__Consent_template::AAA__3GPP__MDT__User__Consent_template(AAA__3GPP__MDT__User__Consent_template* p_precondition, AAA__3GPP__MDT__User__Consent_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } AAA__3GPP__MDT__User__Consent_template::AAA__3GPP__MDT__User__Consent_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; } AAA__3GPP__MDT__User__Consent_template::AAA__3GPP__MDT__User__Consent_template(const AAA__3GPP__MDT__User__Consent_template& other_value) : Base_Template() { copy_template(other_value); } AAA__3GPP__MDT__User__Consent_template::~AAA__3GPP__MDT__User__Consent_template() { clean_up(); } boolean AAA__3GPP__MDT__User__Consent_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean AAA__3GPP__MDT__User__Consent_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != AAA__3GPP__MDT__User__Consent::UNBOUND_VALUE; } void AAA__3GPP__MDT__User__Consent_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } AAA__3GPP__MDT__User__Consent_template& AAA__3GPP__MDT__User__Consent_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } AAA__3GPP__MDT__User__Consent_template& AAA__3GPP__MDT__User__Consent_template::operator=(int other_value) { if (!AAA__3GPP__MDT__User__Consent::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.AAA_3GPP_MDT_User_Consent.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__MDT__User__Consent::enum_type)other_value; return *this; } AAA__3GPP__MDT__User__Consent_template& AAA__3GPP__MDT__User__Consent_template::operator=(AAA__3GPP__MDT__User__Consent::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } AAA__3GPP__MDT__User__Consent_template& AAA__3GPP__MDT__User__Consent_template::operator=(const AAA__3GPP__MDT__User__Consent& other_value) { if (other_value.enum_value == AAA__3GPP__MDT__User__Consent::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_MDT_User_Consent to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } AAA__3GPP__MDT__User__Consent_template& AAA__3GPP__MDT__User__Consent_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__MDT__User__Consent::enum_type)(const AAA__3GPP__MDT__User__Consent&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.AAA_3GPP_MDT_User_Consent."); } return *this; } AAA__3GPP__MDT__User__Consent_template& AAA__3GPP__MDT__User__Consent_template::operator=(const AAA__3GPP__MDT__User__Consent_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean AAA__3GPP__MDT__User__Consent_template::match(AAA__3GPP__MDT__User__Consent::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_MDT_User_Consent."); } return FALSE; } boolean AAA__3GPP__MDT__User__Consent_template::match(const AAA__3GPP__MDT__User__Consent& other_value, boolean) const { if (other_value.enum_value == AAA__3GPP__MDT__User__Consent::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.AAA_3GPP_MDT_User_Consent with an unbound value."); return match(other_value.enum_value); } AAA__3GPP__MDT__User__Consent::enum_type AAA__3GPP__MDT__User__Consent_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.AAA_3GPP_MDT_User_Consent."); return single_value; } void AAA__3GPP__MDT__User__Consent_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.AAA_3GPP_MDT_User_Consent."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new AAA__3GPP__MDT__User__Consent_template[list_length]; } AAA__3GPP__MDT__User__Consent_template& AAA__3GPP__MDT__User__Consent_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.AAA_3GPP_MDT_User_Consent."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.AAA_3GPP_MDT_User_Consent."); return value_list.list_value[list_index]; } void AAA__3GPP__MDT__User__Consent_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(AAA__3GPP__MDT__User__Consent::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void AAA__3GPP__MDT__User__Consent_template::log_match(const AAA__3GPP__MDT__User__Consent& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void AAA__3GPP__MDT__User__Consent_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_MDT_User_Consent."); } } void AAA__3GPP__MDT__User__Consent_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (AAA__3GPP__MDT__User__Consent::enum_type)text_buf.pull_int().get_val(); if (!AAA__3GPP__MDT__User__Consent::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.AAA_3GPP_MDT_User_Consent.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new AAA__3GPP__MDT__User__Consent_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.AAA_3GPP_MDT_User_Consent."); } } boolean AAA__3GPP__MDT__User__Consent_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean AAA__3GPP__MDT__User__Consent_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { AAA__3GPP__MDT__User__Consent_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { AAA__3GPP__MDT__User__Consent::enum_type enum_val = AAA__3GPP__MDT__User__Consent::str_to_enum(m_p->get_enumerated()); if (!AAA__3GPP__MDT__User__Consent::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.AAA_3GPP_MDT_User_Consent."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { AAA__3GPP__MDT__User__Consent_template* precondition = new AAA__3GPP__MDT__User__Consent_template; precondition->set_param(*m_p->get_elem(0)); AAA__3GPP__MDT__User__Consent_template* implied_template = new AAA__3GPP__MDT__User__Consent_template; implied_template->set_param(*m_p->get_elem(1)); *this = AAA__3GPP__MDT__User__Consent_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.AAA_3GPP_MDT_User_Consent"); } is_ifpresent = param.get_ifpresent(); } void AAA__3GPP__MDT__User__Consent_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.AAA_3GPP_MDT_User_Consent"); } DCA__3GPP__AoC__Request__Type::DCA__3GPP__AoC__Request__Type() { enum_value = UNBOUND_VALUE; } DCA__3GPP__AoC__Request__Type::DCA__3GPP__AoC__Request__Type(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Request_Type with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } DCA__3GPP__AoC__Request__Type::DCA__3GPP__AoC__Request__Type(enum_type other_value) { enum_value = other_value; } DCA__3GPP__AoC__Request__Type::DCA__3GPP__AoC__Request__Type(const DCA__3GPP__AoC__Request__Type& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Request_Type."); enum_value = other_value.enum_value; } DCA__3GPP__AoC__Request__Type& DCA__3GPP__AoC__Request__Type::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Request_Type.", other_value); enum_value = (enum_type)other_value; return *this; } DCA__3GPP__AoC__Request__Type& DCA__3GPP__AoC__Request__Type::operator=(enum_type other_value) { enum_value = other_value; return *this; } DCA__3GPP__AoC__Request__Type& DCA__3GPP__AoC__Request__Type::operator=(const DCA__3GPP__AoC__Request__Type& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Request_Type."); enum_value = other_value.enum_value; return *this; } boolean DCA__3GPP__AoC__Request__Type::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Request_Type."); return enum_value == other_value; } boolean DCA__3GPP__AoC__Request__Type::operator==(const DCA__3GPP__AoC__Request__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Request_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Request_Type."); return enum_value == other_value.enum_value; } boolean DCA__3GPP__AoC__Request__Type::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Request_Type."); return enum_value < other_value; } boolean DCA__3GPP__AoC__Request__Type::operator<(const DCA__3GPP__AoC__Request__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Request_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Request_Type."); return enum_value < other_value.enum_value; } boolean DCA__3GPP__AoC__Request__Type::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Request_Type."); return enum_value > other_value; } boolean DCA__3GPP__AoC__Request__Type::operator>(const DCA__3GPP__AoC__Request__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Request_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Request_Type."); return enum_value > other_value.enum_value; } const char *DCA__3GPP__AoC__Request__Type::enum_to_str(enum_type enum_par) { switch (enum_par) { case AoC__NOT__REQUESTED: return "AoC_NOT_REQUESTED"; case AoC__FULL: return "AoC_FULL"; case AoC__COST__ONLY: return "AoC_COST_ONLY"; case AoC__TARIFF__ONLY: return "AoC_TARIFF_ONLY"; default: return ""; } } DCA__3GPP__AoC__Request__Type::enum_type DCA__3GPP__AoC__Request__Type::str_to_enum(const char *str_par) { if (!strcmp(str_par, "AoC_NOT_REQUESTED")) return AoC__NOT__REQUESTED; else if (!strcmp(str_par, "AoC_FULL")) return AoC__FULL; else if (!strcmp(str_par, "AoC_COST_ONLY")) return AoC__COST__ONLY; else if (!strcmp(str_par, "AoC_TARIFF_ONLY")) return AoC__TARIFF__ONLY; else return UNKNOWN_VALUE; } boolean DCA__3GPP__AoC__Request__Type::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: case 2: case 3: return TRUE; default: return FALSE; } } int DCA__3GPP__AoC__Request__Type::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Request_Type.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int DCA__3GPP__AoC__Request__Type::enum2int(const DCA__3GPP__AoC__Request__Type& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Request_Type.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void DCA__3GPP__AoC__Request__Type::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Request_Type.", int_val); enum_value = (enum_type)int_val; } DCA__3GPP__AoC__Request__Type::operator DCA__3GPP__AoC__Request__Type::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Request_Type."); return enum_value; } void DCA__3GPP__AoC__Request__Type::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void DCA__3GPP__AoC__Request__Type::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.DCA_3GPP_AoC_Request_Type"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_AoC_Request_Type."); } } void DCA__3GPP__AoC__Request__Type::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Request_Type."); text_buf.push_int(enum_value); } void DCA__3GPP__AoC__Request__Type::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Request_Type.", enum_value); } void DCA__3GPP__AoC__Request__Type::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void DCA__3GPP__AoC__Request__Type::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int DCA__3GPP__AoC__Request__Type::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 3, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int DCA__3GPP__AoC__Request__Type::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 3); } void DCA__3GPP__AoC__Request__Type_template::copy_template(const DCA__3GPP__AoC__Request__Type_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new DCA__3GPP__AoC__Request__Type_template[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 DCA__3GPP__AoC__Request__Type_template(*other_value.implication_.precondition); implication_.implied_template = new DCA__3GPP__AoC__Request__Type_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Request_Type."); } } DCA__3GPP__AoC__Request__Type_template::DCA__3GPP__AoC__Request__Type_template() { } DCA__3GPP__AoC__Request__Type_template::DCA__3GPP__AoC__Request__Type_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } DCA__3GPP__AoC__Request__Type_template::DCA__3GPP__AoC__Request__Type_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!DCA__3GPP__AoC__Request__Type::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Request_Type with unknown numeric value %d.", other_value); single_value = (DCA__3GPP__AoC__Request__Type::enum_type)other_value; } DCA__3GPP__AoC__Request__Type_template::DCA__3GPP__AoC__Request__Type_template(DCA__3GPP__AoC__Request__Type::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } DCA__3GPP__AoC__Request__Type_template::DCA__3GPP__AoC__Request__Type_template(const DCA__3GPP__AoC__Request__Type& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == DCA__3GPP__AoC__Request__Type::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Request_Type."); single_value = other_value.enum_value; } DCA__3GPP__AoC__Request__Type_template::DCA__3GPP__AoC__Request__Type_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__AoC__Request__Type::enum_type)(const DCA__3GPP__AoC__Request__Type&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Request_Type from an unbound optional field."); } } DCA__3GPP__AoC__Request__Type_template::DCA__3GPP__AoC__Request__Type_template(DCA__3GPP__AoC__Request__Type_template* p_precondition, DCA__3GPP__AoC__Request__Type_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } DCA__3GPP__AoC__Request__Type_template::DCA__3GPP__AoC__Request__Type_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; } DCA__3GPP__AoC__Request__Type_template::DCA__3GPP__AoC__Request__Type_template(const DCA__3GPP__AoC__Request__Type_template& other_value) : Base_Template() { copy_template(other_value); } DCA__3GPP__AoC__Request__Type_template::~DCA__3GPP__AoC__Request__Type_template() { clean_up(); } boolean DCA__3GPP__AoC__Request__Type_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean DCA__3GPP__AoC__Request__Type_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != DCA__3GPP__AoC__Request__Type::UNBOUND_VALUE; } void DCA__3GPP__AoC__Request__Type_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } DCA__3GPP__AoC__Request__Type_template& DCA__3GPP__AoC__Request__Type_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } DCA__3GPP__AoC__Request__Type_template& DCA__3GPP__AoC__Request__Type_template::operator=(int other_value) { if (!DCA__3GPP__AoC__Request__Type::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Request_Type.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__AoC__Request__Type::enum_type)other_value; return *this; } DCA__3GPP__AoC__Request__Type_template& DCA__3GPP__AoC__Request__Type_template::operator=(DCA__3GPP__AoC__Request__Type::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } DCA__3GPP__AoC__Request__Type_template& DCA__3GPP__AoC__Request__Type_template::operator=(const DCA__3GPP__AoC__Request__Type& other_value) { if (other_value.enum_value == DCA__3GPP__AoC__Request__Type::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Request_Type to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } DCA__3GPP__AoC__Request__Type_template& DCA__3GPP__AoC__Request__Type_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__AoC__Request__Type::enum_type)(const DCA__3GPP__AoC__Request__Type&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Request_Type."); } return *this; } DCA__3GPP__AoC__Request__Type_template& DCA__3GPP__AoC__Request__Type_template::operator=(const DCA__3GPP__AoC__Request__Type_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean DCA__3GPP__AoC__Request__Type_template::match(DCA__3GPP__AoC__Request__Type::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Request_Type."); } return FALSE; } boolean DCA__3GPP__AoC__Request__Type_template::match(const DCA__3GPP__AoC__Request__Type& other_value, boolean) const { if (other_value.enum_value == DCA__3GPP__AoC__Request__Type::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Request_Type with an unbound value."); return match(other_value.enum_value); } DCA__3GPP__AoC__Request__Type::enum_type DCA__3GPP__AoC__Request__Type_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Request_Type."); return single_value; } void DCA__3GPP__AoC__Request__Type_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Request_Type."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new DCA__3GPP__AoC__Request__Type_template[list_length]; } DCA__3GPP__AoC__Request__Type_template& DCA__3GPP__AoC__Request__Type_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Request_Type."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Request_Type."); return value_list.list_value[list_index]; } void DCA__3GPP__AoC__Request__Type_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(DCA__3GPP__AoC__Request__Type::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void DCA__3GPP__AoC__Request__Type_template::log_match(const DCA__3GPP__AoC__Request__Type& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void DCA__3GPP__AoC__Request__Type_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Request_Type."); } } void DCA__3GPP__AoC__Request__Type_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (DCA__3GPP__AoC__Request__Type::enum_type)text_buf.pull_int().get_val(); if (!DCA__3GPP__AoC__Request__Type::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Request_Type.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new DCA__3GPP__AoC__Request__Type_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Request_Type."); } } boolean DCA__3GPP__AoC__Request__Type_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean DCA__3GPP__AoC__Request__Type_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { DCA__3GPP__AoC__Request__Type_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { DCA__3GPP__AoC__Request__Type::enum_type enum_val = DCA__3GPP__AoC__Request__Type::str_to_enum(m_p->get_enumerated()); if (!DCA__3GPP__AoC__Request__Type::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_AoC_Request_Type."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { DCA__3GPP__AoC__Request__Type_template* precondition = new DCA__3GPP__AoC__Request__Type_template; precondition->set_param(*m_p->get_elem(0)); DCA__3GPP__AoC__Request__Type_template* implied_template = new DCA__3GPP__AoC__Request__Type_template; implied_template->set_param(*m_p->get_elem(1)); *this = DCA__3GPP__AoC__Request__Type_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.DCA_3GPP_AoC_Request_Type"); } is_ifpresent = param.get_ifpresent(); } void DCA__3GPP__AoC__Request__Type_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.DCA_3GPP_AoC_Request_Type"); } AAA__3GPP__Network__Access__Mode::AAA__3GPP__Network__Access__Mode() { enum_value = UNBOUND_VALUE; } AAA__3GPP__Network__Access__Mode::AAA__3GPP__Network__Access__Mode(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.AAA_3GPP_Network_Access_Mode with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } AAA__3GPP__Network__Access__Mode::AAA__3GPP__Network__Access__Mode(enum_type other_value) { enum_value = other_value; } AAA__3GPP__Network__Access__Mode::AAA__3GPP__Network__Access__Mode(const AAA__3GPP__Network__Access__Mode& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Network_Access_Mode."); enum_value = other_value.enum_value; } AAA__3GPP__Network__Access__Mode& AAA__3GPP__Network__Access__Mode::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.AAA_3GPP_Network_Access_Mode.", other_value); enum_value = (enum_type)other_value; return *this; } AAA__3GPP__Network__Access__Mode& AAA__3GPP__Network__Access__Mode::operator=(enum_type other_value) { enum_value = other_value; return *this; } AAA__3GPP__Network__Access__Mode& AAA__3GPP__Network__Access__Mode::operator=(const AAA__3GPP__Network__Access__Mode& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Network_Access_Mode."); enum_value = other_value.enum_value; return *this; } boolean AAA__3GPP__Network__Access__Mode::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Network_Access_Mode."); return enum_value == other_value; } boolean AAA__3GPP__Network__Access__Mode::operator==(const AAA__3GPP__Network__Access__Mode& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Network_Access_Mode."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Network_Access_Mode."); return enum_value == other_value.enum_value; } boolean AAA__3GPP__Network__Access__Mode::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Network_Access_Mode."); return enum_value < other_value; } boolean AAA__3GPP__Network__Access__Mode::operator<(const AAA__3GPP__Network__Access__Mode& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Network_Access_Mode."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Network_Access_Mode."); return enum_value < other_value.enum_value; } boolean AAA__3GPP__Network__Access__Mode::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Network_Access_Mode."); return enum_value > other_value; } boolean AAA__3GPP__Network__Access__Mode::operator>(const AAA__3GPP__Network__Access__Mode& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Network_Access_Mode."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Network_Access_Mode."); return enum_value > other_value.enum_value; } const char *AAA__3GPP__Network__Access__Mode::enum_to_str(enum_type enum_par) { switch (enum_par) { case PACKET__AND__CIRCUIT: return "PACKET_AND_CIRCUIT"; case Reserved: return "Reserved"; case ONLY__PACKET: return "ONLY_PACKET"; default: return ""; } } AAA__3GPP__Network__Access__Mode::enum_type AAA__3GPP__Network__Access__Mode::str_to_enum(const char *str_par) { if (!strcmp(str_par, "PACKET_AND_CIRCUIT")) return PACKET__AND__CIRCUIT; else if (!strcmp(str_par, "Reserved")) return Reserved; else if (!strcmp(str_par, "ONLY_PACKET")) return ONLY__PACKET; else return UNKNOWN_VALUE; } boolean AAA__3GPP__Network__Access__Mode::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: case 2: return TRUE; default: return FALSE; } } int AAA__3GPP__Network__Access__Mode::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.AAA_3GPP_Network_Access_Mode.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int AAA__3GPP__Network__Access__Mode::enum2int(const AAA__3GPP__Network__Access__Mode& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.AAA_3GPP_Network_Access_Mode.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void AAA__3GPP__Network__Access__Mode::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.AAA_3GPP_Network_Access_Mode.", int_val); enum_value = (enum_type)int_val; } AAA__3GPP__Network__Access__Mode::operator AAA__3GPP__Network__Access__Mode::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.AAA_3GPP_Network_Access_Mode."); return enum_value; } void AAA__3GPP__Network__Access__Mode::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void AAA__3GPP__Network__Access__Mode::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.AAA_3GPP_Network_Access_Mode"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.AAA_3GPP_Network_Access_Mode."); } } void AAA__3GPP__Network__Access__Mode::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Network_Access_Mode."); text_buf.push_int(enum_value); } void AAA__3GPP__Network__Access__Mode::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.AAA_3GPP_Network_Access_Mode.", enum_value); } void AAA__3GPP__Network__Access__Mode::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void AAA__3GPP__Network__Access__Mode::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int AAA__3GPP__Network__Access__Mode::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int AAA__3GPP__Network__Access__Mode::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void AAA__3GPP__Network__Access__Mode_template::copy_template(const AAA__3GPP__Network__Access__Mode_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new AAA__3GPP__Network__Access__Mode_template[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 AAA__3GPP__Network__Access__Mode_template(*other_value.implication_.precondition); implication_.implied_template = new AAA__3GPP__Network__Access__Mode_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_Network_Access_Mode."); } } AAA__3GPP__Network__Access__Mode_template::AAA__3GPP__Network__Access__Mode_template() { } AAA__3GPP__Network__Access__Mode_template::AAA__3GPP__Network__Access__Mode_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } AAA__3GPP__Network__Access__Mode_template::AAA__3GPP__Network__Access__Mode_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!AAA__3GPP__Network__Access__Mode::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.AAA_3GPP_Network_Access_Mode with unknown numeric value %d.", other_value); single_value = (AAA__3GPP__Network__Access__Mode::enum_type)other_value; } AAA__3GPP__Network__Access__Mode_template::AAA__3GPP__Network__Access__Mode_template(AAA__3GPP__Network__Access__Mode::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } AAA__3GPP__Network__Access__Mode_template::AAA__3GPP__Network__Access__Mode_template(const AAA__3GPP__Network__Access__Mode& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == AAA__3GPP__Network__Access__Mode::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Network_Access_Mode."); single_value = other_value.enum_value; } AAA__3GPP__Network__Access__Mode_template::AAA__3GPP__Network__Access__Mode_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__Network__Access__Mode::enum_type)(const AAA__3GPP__Network__Access__Mode&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.AAA_3GPP_Network_Access_Mode from an unbound optional field."); } } AAA__3GPP__Network__Access__Mode_template::AAA__3GPP__Network__Access__Mode_template(AAA__3GPP__Network__Access__Mode_template* p_precondition, AAA__3GPP__Network__Access__Mode_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } AAA__3GPP__Network__Access__Mode_template::AAA__3GPP__Network__Access__Mode_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; } AAA__3GPP__Network__Access__Mode_template::AAA__3GPP__Network__Access__Mode_template(const AAA__3GPP__Network__Access__Mode_template& other_value) : Base_Template() { copy_template(other_value); } AAA__3GPP__Network__Access__Mode_template::~AAA__3GPP__Network__Access__Mode_template() { clean_up(); } boolean AAA__3GPP__Network__Access__Mode_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean AAA__3GPP__Network__Access__Mode_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != AAA__3GPP__Network__Access__Mode::UNBOUND_VALUE; } void AAA__3GPP__Network__Access__Mode_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } AAA__3GPP__Network__Access__Mode_template& AAA__3GPP__Network__Access__Mode_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } AAA__3GPP__Network__Access__Mode_template& AAA__3GPP__Network__Access__Mode_template::operator=(int other_value) { if (!AAA__3GPP__Network__Access__Mode::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.AAA_3GPP_Network_Access_Mode.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__Network__Access__Mode::enum_type)other_value; return *this; } AAA__3GPP__Network__Access__Mode_template& AAA__3GPP__Network__Access__Mode_template::operator=(AAA__3GPP__Network__Access__Mode::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } AAA__3GPP__Network__Access__Mode_template& AAA__3GPP__Network__Access__Mode_template::operator=(const AAA__3GPP__Network__Access__Mode& other_value) { if (other_value.enum_value == AAA__3GPP__Network__Access__Mode::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Network_Access_Mode to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } AAA__3GPP__Network__Access__Mode_template& AAA__3GPP__Network__Access__Mode_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__Network__Access__Mode::enum_type)(const AAA__3GPP__Network__Access__Mode&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.AAA_3GPP_Network_Access_Mode."); } return *this; } AAA__3GPP__Network__Access__Mode_template& AAA__3GPP__Network__Access__Mode_template::operator=(const AAA__3GPP__Network__Access__Mode_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean AAA__3GPP__Network__Access__Mode_template::match(AAA__3GPP__Network__Access__Mode::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_Network_Access_Mode."); } return FALSE; } boolean AAA__3GPP__Network__Access__Mode_template::match(const AAA__3GPP__Network__Access__Mode& other_value, boolean) const { if (other_value.enum_value == AAA__3GPP__Network__Access__Mode::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.AAA_3GPP_Network_Access_Mode with an unbound value."); return match(other_value.enum_value); } AAA__3GPP__Network__Access__Mode::enum_type AAA__3GPP__Network__Access__Mode_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.AAA_3GPP_Network_Access_Mode."); return single_value; } void AAA__3GPP__Network__Access__Mode_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.AAA_3GPP_Network_Access_Mode."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new AAA__3GPP__Network__Access__Mode_template[list_length]; } AAA__3GPP__Network__Access__Mode_template& AAA__3GPP__Network__Access__Mode_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.AAA_3GPP_Network_Access_Mode."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.AAA_3GPP_Network_Access_Mode."); return value_list.list_value[list_index]; } void AAA__3GPP__Network__Access__Mode_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(AAA__3GPP__Network__Access__Mode::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void AAA__3GPP__Network__Access__Mode_template::log_match(const AAA__3GPP__Network__Access__Mode& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void AAA__3GPP__Network__Access__Mode_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_Network_Access_Mode."); } } void AAA__3GPP__Network__Access__Mode_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (AAA__3GPP__Network__Access__Mode::enum_type)text_buf.pull_int().get_val(); if (!AAA__3GPP__Network__Access__Mode::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.AAA_3GPP_Network_Access_Mode.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new AAA__3GPP__Network__Access__Mode_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.AAA_3GPP_Network_Access_Mode."); } } boolean AAA__3GPP__Network__Access__Mode_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean AAA__3GPP__Network__Access__Mode_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { AAA__3GPP__Network__Access__Mode_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { AAA__3GPP__Network__Access__Mode::enum_type enum_val = AAA__3GPP__Network__Access__Mode::str_to_enum(m_p->get_enumerated()); if (!AAA__3GPP__Network__Access__Mode::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.AAA_3GPP_Network_Access_Mode."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { AAA__3GPP__Network__Access__Mode_template* precondition = new AAA__3GPP__Network__Access__Mode_template; precondition->set_param(*m_p->get_elem(0)); AAA__3GPP__Network__Access__Mode_template* implied_template = new AAA__3GPP__Network__Access__Mode_template; implied_template->set_param(*m_p->get_elem(1)); *this = AAA__3GPP__Network__Access__Mode_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.AAA_3GPP_Network_Access_Mode"); } is_ifpresent = param.get_ifpresent(); } void AAA__3GPP__Network__Access__Mode_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.AAA_3GPP_Network_Access_Mode"); } DNAS__NONE__Framed__Compression::DNAS__NONE__Framed__Compression() { enum_value = UNBOUND_VALUE; } DNAS__NONE__Framed__Compression::DNAS__NONE__Framed__Compression(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Compression with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } DNAS__NONE__Framed__Compression::DNAS__NONE__Framed__Compression(enum_type other_value) { enum_value = other_value; } DNAS__NONE__Framed__Compression::DNAS__NONE__Framed__Compression(const DNAS__NONE__Framed__Compression& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Compression."); enum_value = other_value.enum_value; } DNAS__NONE__Framed__Compression& DNAS__NONE__Framed__Compression::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Compression.", other_value); enum_value = (enum_type)other_value; return *this; } DNAS__NONE__Framed__Compression& DNAS__NONE__Framed__Compression::operator=(enum_type other_value) { enum_value = other_value; return *this; } DNAS__NONE__Framed__Compression& DNAS__NONE__Framed__Compression::operator=(const DNAS__NONE__Framed__Compression& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Compression."); enum_value = other_value.enum_value; return *this; } boolean DNAS__NONE__Framed__Compression::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Compression."); return enum_value == other_value; } boolean DNAS__NONE__Framed__Compression::operator==(const DNAS__NONE__Framed__Compression& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Compression."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Compression."); return enum_value == other_value.enum_value; } boolean DNAS__NONE__Framed__Compression::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Compression."); return enum_value < other_value; } boolean DNAS__NONE__Framed__Compression::operator<(const DNAS__NONE__Framed__Compression& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Compression."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Compression."); return enum_value < other_value.enum_value; } boolean DNAS__NONE__Framed__Compression::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Compression."); return enum_value > other_value; } boolean DNAS__NONE__Framed__Compression::operator>(const DNAS__NONE__Framed__Compression& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Compression."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Compression."); return enum_value > other_value.enum_value; } const char *DNAS__NONE__Framed__Compression::enum_to_str(enum_type enum_par) { switch (enum_par) { case NONE_: return "NONE"; case VJ__TCP__IP__HEADER__COMPRESSION: return "VJ_TCP_IP_HEADER_COMPRESSION"; case IPX__HEADER__COMPRESSION: return "IPX_HEADER_COMPRESSION"; case STAC__LZS__COMPRESSION: return "STAC_LZS_COMPRESSION"; default: return ""; } } DNAS__NONE__Framed__Compression::enum_type DNAS__NONE__Framed__Compression::str_to_enum(const char *str_par) { if (!strcmp(str_par, "NONE")) return NONE_; else if (!strcmp(str_par, "VJ_TCP_IP_HEADER_COMPRESSION")) return VJ__TCP__IP__HEADER__COMPRESSION; else if (!strcmp(str_par, "IPX_HEADER_COMPRESSION")) return IPX__HEADER__COMPRESSION; else if (!strcmp(str_par, "STAC_LZS_COMPRESSION")) return STAC__LZS__COMPRESSION; else return UNKNOWN_VALUE; } boolean DNAS__NONE__Framed__Compression::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: case 2: case 3: return TRUE; default: return FALSE; } } int DNAS__NONE__Framed__Compression::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Compression.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int DNAS__NONE__Framed__Compression::enum2int(const DNAS__NONE__Framed__Compression& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Compression.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void DNAS__NONE__Framed__Compression::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Compression.", int_val); enum_value = (enum_type)int_val; } DNAS__NONE__Framed__Compression::operator DNAS__NONE__Framed__Compression::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Compression."); return enum_value; } void DNAS__NONE__Framed__Compression::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void DNAS__NONE__Framed__Compression::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.DNAS_NONE_Framed_Compression"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DNAS_NONE_Framed_Compression."); } } void DNAS__NONE__Framed__Compression::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Compression."); text_buf.push_int(enum_value); } void DNAS__NONE__Framed__Compression::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Compression.", enum_value); } void DNAS__NONE__Framed__Compression::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void DNAS__NONE__Framed__Compression::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int DNAS__NONE__Framed__Compression::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 3, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int DNAS__NONE__Framed__Compression::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 3); } void DNAS__NONE__Framed__Compression_template::copy_template(const DNAS__NONE__Framed__Compression_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new DNAS__NONE__Framed__Compression_template[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 DNAS__NONE__Framed__Compression_template(*other_value.implication_.precondition); implication_.implied_template = new DNAS__NONE__Framed__Compression_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Compression."); } } DNAS__NONE__Framed__Compression_template::DNAS__NONE__Framed__Compression_template() { } DNAS__NONE__Framed__Compression_template::DNAS__NONE__Framed__Compression_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } DNAS__NONE__Framed__Compression_template::DNAS__NONE__Framed__Compression_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!DNAS__NONE__Framed__Compression::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Compression with unknown numeric value %d.", other_value); single_value = (DNAS__NONE__Framed__Compression::enum_type)other_value; } DNAS__NONE__Framed__Compression_template::DNAS__NONE__Framed__Compression_template(DNAS__NONE__Framed__Compression::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } DNAS__NONE__Framed__Compression_template::DNAS__NONE__Framed__Compression_template(const DNAS__NONE__Framed__Compression& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == DNAS__NONE__Framed__Compression::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Compression."); single_value = other_value.enum_value; } DNAS__NONE__Framed__Compression_template::DNAS__NONE__Framed__Compression_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DNAS__NONE__Framed__Compression::enum_type)(const DNAS__NONE__Framed__Compression&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Compression from an unbound optional field."); } } DNAS__NONE__Framed__Compression_template::DNAS__NONE__Framed__Compression_template(DNAS__NONE__Framed__Compression_template* p_precondition, DNAS__NONE__Framed__Compression_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } DNAS__NONE__Framed__Compression_template::DNAS__NONE__Framed__Compression_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; } DNAS__NONE__Framed__Compression_template::DNAS__NONE__Framed__Compression_template(const DNAS__NONE__Framed__Compression_template& other_value) : Base_Template() { copy_template(other_value); } DNAS__NONE__Framed__Compression_template::~DNAS__NONE__Framed__Compression_template() { clean_up(); } boolean DNAS__NONE__Framed__Compression_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean DNAS__NONE__Framed__Compression_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != DNAS__NONE__Framed__Compression::UNBOUND_VALUE; } void DNAS__NONE__Framed__Compression_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } DNAS__NONE__Framed__Compression_template& DNAS__NONE__Framed__Compression_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } DNAS__NONE__Framed__Compression_template& DNAS__NONE__Framed__Compression_template::operator=(int other_value) { if (!DNAS__NONE__Framed__Compression::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Compression.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (DNAS__NONE__Framed__Compression::enum_type)other_value; return *this; } DNAS__NONE__Framed__Compression_template& DNAS__NONE__Framed__Compression_template::operator=(DNAS__NONE__Framed__Compression::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } DNAS__NONE__Framed__Compression_template& DNAS__NONE__Framed__Compression_template::operator=(const DNAS__NONE__Framed__Compression& other_value) { if (other_value.enum_value == DNAS__NONE__Framed__Compression::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Compression to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } DNAS__NONE__Framed__Compression_template& DNAS__NONE__Framed__Compression_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DNAS__NONE__Framed__Compression::enum_type)(const DNAS__NONE__Framed__Compression&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Compression."); } return *this; } DNAS__NONE__Framed__Compression_template& DNAS__NONE__Framed__Compression_template::operator=(const DNAS__NONE__Framed__Compression_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean DNAS__NONE__Framed__Compression_template::match(DNAS__NONE__Framed__Compression::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Compression."); } return FALSE; } boolean DNAS__NONE__Framed__Compression_template::match(const DNAS__NONE__Framed__Compression& other_value, boolean) const { if (other_value.enum_value == DNAS__NONE__Framed__Compression::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Compression with an unbound value."); return match(other_value.enum_value); } DNAS__NONE__Framed__Compression::enum_type DNAS__NONE__Framed__Compression_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Compression."); return single_value; } void DNAS__NONE__Framed__Compression_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Compression."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new DNAS__NONE__Framed__Compression_template[list_length]; } DNAS__NONE__Framed__Compression_template& DNAS__NONE__Framed__Compression_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Compression."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Compression."); return value_list.list_value[list_index]; } void DNAS__NONE__Framed__Compression_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(DNAS__NONE__Framed__Compression::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void DNAS__NONE__Framed__Compression_template::log_match(const DNAS__NONE__Framed__Compression& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void DNAS__NONE__Framed__Compression_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Compression."); } } void DNAS__NONE__Framed__Compression_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (DNAS__NONE__Framed__Compression::enum_type)text_buf.pull_int().get_val(); if (!DNAS__NONE__Framed__Compression::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Compression.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new DNAS__NONE__Framed__Compression_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.DNAS_NONE_Framed_Compression."); } } boolean DNAS__NONE__Framed__Compression_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean DNAS__NONE__Framed__Compression_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { DNAS__NONE__Framed__Compression_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { DNAS__NONE__Framed__Compression::enum_type enum_val = DNAS__NONE__Framed__Compression::str_to_enum(m_p->get_enumerated()); if (!DNAS__NONE__Framed__Compression::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DNAS_NONE_Framed_Compression."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { DNAS__NONE__Framed__Compression_template* precondition = new DNAS__NONE__Framed__Compression_template; precondition->set_param(*m_p->get_elem(0)); DNAS__NONE__Framed__Compression_template* implied_template = new DNAS__NONE__Framed__Compression_template; implied_template->set_param(*m_p->get_elem(1)); *this = DNAS__NONE__Framed__Compression_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.DNAS_NONE_Framed_Compression"); } is_ifpresent = param.get_ifpresent(); } void DNAS__NONE__Framed__Compression_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.DNAS_NONE_Framed_Compression"); } DNAS__NONE__ARAP__Zone__Access::DNAS__NONE__ARAP__Zone__Access() { enum_value = UNBOUND_VALUE; } DNAS__NONE__ARAP__Zone__Access::DNAS__NONE__ARAP__Zone__Access(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.DNAS_NONE_ARAP_Zone_Access with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } DNAS__NONE__ARAP__Zone__Access::DNAS__NONE__ARAP__Zone__Access(enum_type other_value) { enum_value = other_value; } DNAS__NONE__ARAP__Zone__Access::DNAS__NONE__ARAP__Zone__Access(const DNAS__NONE__ARAP__Zone__Access& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_ARAP_Zone_Access."); enum_value = other_value.enum_value; } DNAS__NONE__ARAP__Zone__Access& DNAS__NONE__ARAP__Zone__Access::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.DNAS_NONE_ARAP_Zone_Access.", other_value); enum_value = (enum_type)other_value; return *this; } DNAS__NONE__ARAP__Zone__Access& DNAS__NONE__ARAP__Zone__Access::operator=(enum_type other_value) { enum_value = other_value; return *this; } DNAS__NONE__ARAP__Zone__Access& DNAS__NONE__ARAP__Zone__Access::operator=(const DNAS__NONE__ARAP__Zone__Access& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_ARAP_Zone_Access."); enum_value = other_value.enum_value; return *this; } boolean DNAS__NONE__ARAP__Zone__Access::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_ARAP_Zone_Access."); return enum_value == other_value; } boolean DNAS__NONE__ARAP__Zone__Access::operator==(const DNAS__NONE__ARAP__Zone__Access& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_ARAP_Zone_Access."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_ARAP_Zone_Access."); return enum_value == other_value.enum_value; } boolean DNAS__NONE__ARAP__Zone__Access::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_ARAP_Zone_Access."); return enum_value < other_value; } boolean DNAS__NONE__ARAP__Zone__Access::operator<(const DNAS__NONE__ARAP__Zone__Access& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_ARAP_Zone_Access."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_ARAP_Zone_Access."); return enum_value < other_value.enum_value; } boolean DNAS__NONE__ARAP__Zone__Access::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_ARAP_Zone_Access."); return enum_value > other_value; } boolean DNAS__NONE__ARAP__Zone__Access::operator>(const DNAS__NONE__ARAP__Zone__Access& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_ARAP_Zone_Access."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_ARAP_Zone_Access."); return enum_value > other_value.enum_value; } const char *DNAS__NONE__ARAP__Zone__Access::enum_to_str(enum_type enum_par) { switch (enum_par) { case ONLY__ALLOW__ACCESS__TO__DEFAULT__ZONE: return "ONLY_ALLOW_ACCESS_TO_DEFAULT_ZONE"; case USE__ZONE__FILTER__INCLUSIVELY: return "USE_ZONE_FILTER_INCLUSIVELY"; case USE__ZONE__FILTER__EXCLUSIVELY: return "USE_ZONE_FILTER_EXCLUSIVELY"; default: return ""; } } DNAS__NONE__ARAP__Zone__Access::enum_type DNAS__NONE__ARAP__Zone__Access::str_to_enum(const char *str_par) { if (!strcmp(str_par, "ONLY_ALLOW_ACCESS_TO_DEFAULT_ZONE")) return ONLY__ALLOW__ACCESS__TO__DEFAULT__ZONE; else if (!strcmp(str_par, "USE_ZONE_FILTER_INCLUSIVELY")) return USE__ZONE__FILTER__INCLUSIVELY; else if (!strcmp(str_par, "USE_ZONE_FILTER_EXCLUSIVELY")) return USE__ZONE__FILTER__EXCLUSIVELY; else return UNKNOWN_VALUE; } boolean DNAS__NONE__ARAP__Zone__Access::is_valid_enum(int int_par) { switch (int_par) { case 1: case 2: case 4: return TRUE; default: return FALSE; } } int DNAS__NONE__ARAP__Zone__Access::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DNAS_NONE_ARAP_Zone_Access.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int DNAS__NONE__ARAP__Zone__Access::enum2int(const DNAS__NONE__ARAP__Zone__Access& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DNAS_NONE_ARAP_Zone_Access.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void DNAS__NONE__ARAP__Zone__Access::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.DNAS_NONE_ARAP_Zone_Access.", int_val); enum_value = (enum_type)int_val; } DNAS__NONE__ARAP__Zone__Access::operator DNAS__NONE__ARAP__Zone__Access::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.DNAS_NONE_ARAP_Zone_Access."); return enum_value; } void DNAS__NONE__ARAP__Zone__Access::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void DNAS__NONE__ARAP__Zone__Access::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.DNAS_NONE_ARAP_Zone_Access"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DNAS_NONE_ARAP_Zone_Access."); } } void DNAS__NONE__ARAP__Zone__Access::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_ARAP_Zone_Access."); text_buf.push_int(enum_value); } void DNAS__NONE__ARAP__Zone__Access::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.DNAS_NONE_ARAP_Zone_Access.", enum_value); } void DNAS__NONE__ARAP__Zone__Access::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void DNAS__NONE__ARAP__Zone__Access::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int DNAS__NONE__ARAP__Zone__Access::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 3, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int DNAS__NONE__ARAP__Zone__Access::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 3); } void DNAS__NONE__ARAP__Zone__Access_template::copy_template(const DNAS__NONE__ARAP__Zone__Access_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new DNAS__NONE__ARAP__Zone__Access_template[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 DNAS__NONE__ARAP__Zone__Access_template(*other_value.implication_.precondition); implication_.implied_template = new DNAS__NONE__ARAP__Zone__Access_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DNAS_NONE_ARAP_Zone_Access."); } } DNAS__NONE__ARAP__Zone__Access_template::DNAS__NONE__ARAP__Zone__Access_template() { } DNAS__NONE__ARAP__Zone__Access_template::DNAS__NONE__ARAP__Zone__Access_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } DNAS__NONE__ARAP__Zone__Access_template::DNAS__NONE__ARAP__Zone__Access_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!DNAS__NONE__ARAP__Zone__Access::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.DNAS_NONE_ARAP_Zone_Access with unknown numeric value %d.", other_value); single_value = (DNAS__NONE__ARAP__Zone__Access::enum_type)other_value; } DNAS__NONE__ARAP__Zone__Access_template::DNAS__NONE__ARAP__Zone__Access_template(DNAS__NONE__ARAP__Zone__Access::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } DNAS__NONE__ARAP__Zone__Access_template::DNAS__NONE__ARAP__Zone__Access_template(const DNAS__NONE__ARAP__Zone__Access& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == DNAS__NONE__ARAP__Zone__Access::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_ARAP_Zone_Access."); single_value = other_value.enum_value; } DNAS__NONE__ARAP__Zone__Access_template::DNAS__NONE__ARAP__Zone__Access_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DNAS__NONE__ARAP__Zone__Access::enum_type)(const DNAS__NONE__ARAP__Zone__Access&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.DNAS_NONE_ARAP_Zone_Access from an unbound optional field."); } } DNAS__NONE__ARAP__Zone__Access_template::DNAS__NONE__ARAP__Zone__Access_template(DNAS__NONE__ARAP__Zone__Access_template* p_precondition, DNAS__NONE__ARAP__Zone__Access_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } DNAS__NONE__ARAP__Zone__Access_template::DNAS__NONE__ARAP__Zone__Access_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; } DNAS__NONE__ARAP__Zone__Access_template::DNAS__NONE__ARAP__Zone__Access_template(const DNAS__NONE__ARAP__Zone__Access_template& other_value) : Base_Template() { copy_template(other_value); } DNAS__NONE__ARAP__Zone__Access_template::~DNAS__NONE__ARAP__Zone__Access_template() { clean_up(); } boolean DNAS__NONE__ARAP__Zone__Access_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean DNAS__NONE__ARAP__Zone__Access_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != DNAS__NONE__ARAP__Zone__Access::UNBOUND_VALUE; } void DNAS__NONE__ARAP__Zone__Access_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } DNAS__NONE__ARAP__Zone__Access_template& DNAS__NONE__ARAP__Zone__Access_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } DNAS__NONE__ARAP__Zone__Access_template& DNAS__NONE__ARAP__Zone__Access_template::operator=(int other_value) { if (!DNAS__NONE__ARAP__Zone__Access::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.DNAS_NONE_ARAP_Zone_Access.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (DNAS__NONE__ARAP__Zone__Access::enum_type)other_value; return *this; } DNAS__NONE__ARAP__Zone__Access_template& DNAS__NONE__ARAP__Zone__Access_template::operator=(DNAS__NONE__ARAP__Zone__Access::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } DNAS__NONE__ARAP__Zone__Access_template& DNAS__NONE__ARAP__Zone__Access_template::operator=(const DNAS__NONE__ARAP__Zone__Access& other_value) { if (other_value.enum_value == DNAS__NONE__ARAP__Zone__Access::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DNAS_NONE_ARAP_Zone_Access to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } DNAS__NONE__ARAP__Zone__Access_template& DNAS__NONE__ARAP__Zone__Access_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DNAS__NONE__ARAP__Zone__Access::enum_type)(const DNAS__NONE__ARAP__Zone__Access&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.DNAS_NONE_ARAP_Zone_Access."); } return *this; } DNAS__NONE__ARAP__Zone__Access_template& DNAS__NONE__ARAP__Zone__Access_template::operator=(const DNAS__NONE__ARAP__Zone__Access_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean DNAS__NONE__ARAP__Zone__Access_template::match(DNAS__NONE__ARAP__Zone__Access::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DNAS_NONE_ARAP_Zone_Access."); } return FALSE; } boolean DNAS__NONE__ARAP__Zone__Access_template::match(const DNAS__NONE__ARAP__Zone__Access& other_value, boolean) const { if (other_value.enum_value == DNAS__NONE__ARAP__Zone__Access::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.DNAS_NONE_ARAP_Zone_Access with an unbound value."); return match(other_value.enum_value); } DNAS__NONE__ARAP__Zone__Access::enum_type DNAS__NONE__ARAP__Zone__Access_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.DNAS_NONE_ARAP_Zone_Access."); return single_value; } void DNAS__NONE__ARAP__Zone__Access_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.DNAS_NONE_ARAP_Zone_Access."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new DNAS__NONE__ARAP__Zone__Access_template[list_length]; } DNAS__NONE__ARAP__Zone__Access_template& DNAS__NONE__ARAP__Zone__Access_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.DNAS_NONE_ARAP_Zone_Access."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.DNAS_NONE_ARAP_Zone_Access."); return value_list.list_value[list_index]; } void DNAS__NONE__ARAP__Zone__Access_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(DNAS__NONE__ARAP__Zone__Access::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void DNAS__NONE__ARAP__Zone__Access_template::log_match(const DNAS__NONE__ARAP__Zone__Access& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void DNAS__NONE__ARAP__Zone__Access_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DNAS_NONE_ARAP_Zone_Access."); } } void DNAS__NONE__ARAP__Zone__Access_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (DNAS__NONE__ARAP__Zone__Access::enum_type)text_buf.pull_int().get_val(); if (!DNAS__NONE__ARAP__Zone__Access::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.DNAS_NONE_ARAP_Zone_Access.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new DNAS__NONE__ARAP__Zone__Access_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.DNAS_NONE_ARAP_Zone_Access."); } } boolean DNAS__NONE__ARAP__Zone__Access_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean DNAS__NONE__ARAP__Zone__Access_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { DNAS__NONE__ARAP__Zone__Access_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { DNAS__NONE__ARAP__Zone__Access::enum_type enum_val = DNAS__NONE__ARAP__Zone__Access::str_to_enum(m_p->get_enumerated()); if (!DNAS__NONE__ARAP__Zone__Access::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DNAS_NONE_ARAP_Zone_Access."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { DNAS__NONE__ARAP__Zone__Access_template* precondition = new DNAS__NONE__ARAP__Zone__Access_template; precondition->set_param(*m_p->get_elem(0)); DNAS__NONE__ARAP__Zone__Access_template* implied_template = new DNAS__NONE__ARAP__Zone__Access_template; implied_template->set_param(*m_p->get_elem(1)); *this = DNAS__NONE__ARAP__Zone__Access_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.DNAS_NONE_ARAP_Zone_Access"); } is_ifpresent = param.get_ifpresent(); } void DNAS__NONE__ARAP__Zone__Access_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.DNAS_NONE_ARAP_Zone_Access"); } AAA__3GPP__Complete__Data__List__Included__Indicator::AAA__3GPP__Complete__Data__List__Included__Indicator() { enum_value = UNBOUND_VALUE; } AAA__3GPP__Complete__Data__List__Included__Indicator::AAA__3GPP__Complete__Data__List__Included__Indicator(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.AAA_3GPP_Complete_Data_List_Included_Indicator with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } AAA__3GPP__Complete__Data__List__Included__Indicator::AAA__3GPP__Complete__Data__List__Included__Indicator(enum_type other_value) { enum_value = other_value; } AAA__3GPP__Complete__Data__List__Included__Indicator::AAA__3GPP__Complete__Data__List__Included__Indicator(const AAA__3GPP__Complete__Data__List__Included__Indicator& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Complete_Data_List_Included_Indicator."); enum_value = other_value.enum_value; } AAA__3GPP__Complete__Data__List__Included__Indicator& AAA__3GPP__Complete__Data__List__Included__Indicator::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.AAA_3GPP_Complete_Data_List_Included_Indicator.", other_value); enum_value = (enum_type)other_value; return *this; } AAA__3GPP__Complete__Data__List__Included__Indicator& AAA__3GPP__Complete__Data__List__Included__Indicator::operator=(enum_type other_value) { enum_value = other_value; return *this; } AAA__3GPP__Complete__Data__List__Included__Indicator& AAA__3GPP__Complete__Data__List__Included__Indicator::operator=(const AAA__3GPP__Complete__Data__List__Included__Indicator& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Complete_Data_List_Included_Indicator."); enum_value = other_value.enum_value; return *this; } boolean AAA__3GPP__Complete__Data__List__Included__Indicator::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Complete_Data_List_Included_Indicator."); return enum_value == other_value; } boolean AAA__3GPP__Complete__Data__List__Included__Indicator::operator==(const AAA__3GPP__Complete__Data__List__Included__Indicator& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Complete_Data_List_Included_Indicator."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Complete_Data_List_Included_Indicator."); return enum_value == other_value.enum_value; } boolean AAA__3GPP__Complete__Data__List__Included__Indicator::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Complete_Data_List_Included_Indicator."); return enum_value < other_value; } boolean AAA__3GPP__Complete__Data__List__Included__Indicator::operator<(const AAA__3GPP__Complete__Data__List__Included__Indicator& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Complete_Data_List_Included_Indicator."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Complete_Data_List_Included_Indicator."); return enum_value < other_value.enum_value; } boolean AAA__3GPP__Complete__Data__List__Included__Indicator::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Complete_Data_List_Included_Indicator."); return enum_value > other_value; } boolean AAA__3GPP__Complete__Data__List__Included__Indicator::operator>(const AAA__3GPP__Complete__Data__List__Included__Indicator& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Complete_Data_List_Included_Indicator."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Complete_Data_List_Included_Indicator."); return enum_value > other_value.enum_value; } const char *AAA__3GPP__Complete__Data__List__Included__Indicator::enum_to_str(enum_type enum_par) { switch (enum_par) { case All__PDP__CONTEXTS__INCLUDED: return "All_PDP_CONTEXTS_INCLUDED"; case MODIFIED__ADDED__PDP__CONTEXTS__INCLUDED: return "MODIFIED_ADDED_PDP_CONTEXTS_INCLUDED"; default: return ""; } } AAA__3GPP__Complete__Data__List__Included__Indicator::enum_type AAA__3GPP__Complete__Data__List__Included__Indicator::str_to_enum(const char *str_par) { if (!strcmp(str_par, "All_PDP_CONTEXTS_INCLUDED")) return All__PDP__CONTEXTS__INCLUDED; else if (!strcmp(str_par, "MODIFIED_ADDED_PDP_CONTEXTS_INCLUDED")) return MODIFIED__ADDED__PDP__CONTEXTS__INCLUDED; else return UNKNOWN_VALUE; } boolean AAA__3GPP__Complete__Data__List__Included__Indicator::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: return TRUE; default: return FALSE; } } int AAA__3GPP__Complete__Data__List__Included__Indicator::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.AAA_3GPP_Complete_Data_List_Included_Indicator.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int AAA__3GPP__Complete__Data__List__Included__Indicator::enum2int(const AAA__3GPP__Complete__Data__List__Included__Indicator& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.AAA_3GPP_Complete_Data_List_Included_Indicator.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void AAA__3GPP__Complete__Data__List__Included__Indicator::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.AAA_3GPP_Complete_Data_List_Included_Indicator.", int_val); enum_value = (enum_type)int_val; } AAA__3GPP__Complete__Data__List__Included__Indicator::operator AAA__3GPP__Complete__Data__List__Included__Indicator::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.AAA_3GPP_Complete_Data_List_Included_Indicator."); return enum_value; } void AAA__3GPP__Complete__Data__List__Included__Indicator::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void AAA__3GPP__Complete__Data__List__Included__Indicator::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.AAA_3GPP_Complete_Data_List_Included_Indicator"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.AAA_3GPP_Complete_Data_List_Included_Indicator."); } } void AAA__3GPP__Complete__Data__List__Included__Indicator::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Complete_Data_List_Included_Indicator."); text_buf.push_int(enum_value); } void AAA__3GPP__Complete__Data__List__Included__Indicator::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.AAA_3GPP_Complete_Data_List_Included_Indicator.", enum_value); } void AAA__3GPP__Complete__Data__List__Included__Indicator::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void AAA__3GPP__Complete__Data__List__Included__Indicator::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int AAA__3GPP__Complete__Data__List__Included__Indicator::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int AAA__3GPP__Complete__Data__List__Included__Indicator::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void AAA__3GPP__Complete__Data__List__Included__Indicator_template::copy_template(const AAA__3GPP__Complete__Data__List__Included__Indicator_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new AAA__3GPP__Complete__Data__List__Included__Indicator_template[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 AAA__3GPP__Complete__Data__List__Included__Indicator_template(*other_value.implication_.precondition); implication_.implied_template = new AAA__3GPP__Complete__Data__List__Included__Indicator_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_Complete_Data_List_Included_Indicator."); } } AAA__3GPP__Complete__Data__List__Included__Indicator_template::AAA__3GPP__Complete__Data__List__Included__Indicator_template() { } AAA__3GPP__Complete__Data__List__Included__Indicator_template::AAA__3GPP__Complete__Data__List__Included__Indicator_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } AAA__3GPP__Complete__Data__List__Included__Indicator_template::AAA__3GPP__Complete__Data__List__Included__Indicator_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!AAA__3GPP__Complete__Data__List__Included__Indicator::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.AAA_3GPP_Complete_Data_List_Included_Indicator with unknown numeric value %d.", other_value); single_value = (AAA__3GPP__Complete__Data__List__Included__Indicator::enum_type)other_value; } AAA__3GPP__Complete__Data__List__Included__Indicator_template::AAA__3GPP__Complete__Data__List__Included__Indicator_template(AAA__3GPP__Complete__Data__List__Included__Indicator::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } AAA__3GPP__Complete__Data__List__Included__Indicator_template::AAA__3GPP__Complete__Data__List__Included__Indicator_template(const AAA__3GPP__Complete__Data__List__Included__Indicator& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == AAA__3GPP__Complete__Data__List__Included__Indicator::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Complete_Data_List_Included_Indicator."); single_value = other_value.enum_value; } AAA__3GPP__Complete__Data__List__Included__Indicator_template::AAA__3GPP__Complete__Data__List__Included__Indicator_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__Complete__Data__List__Included__Indicator::enum_type)(const AAA__3GPP__Complete__Data__List__Included__Indicator&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.AAA_3GPP_Complete_Data_List_Included_Indicator from an unbound optional field."); } } AAA__3GPP__Complete__Data__List__Included__Indicator_template::AAA__3GPP__Complete__Data__List__Included__Indicator_template(AAA__3GPP__Complete__Data__List__Included__Indicator_template* p_precondition, AAA__3GPP__Complete__Data__List__Included__Indicator_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } AAA__3GPP__Complete__Data__List__Included__Indicator_template::AAA__3GPP__Complete__Data__List__Included__Indicator_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; } AAA__3GPP__Complete__Data__List__Included__Indicator_template::AAA__3GPP__Complete__Data__List__Included__Indicator_template(const AAA__3GPP__Complete__Data__List__Included__Indicator_template& other_value) : Base_Template() { copy_template(other_value); } AAA__3GPP__Complete__Data__List__Included__Indicator_template::~AAA__3GPP__Complete__Data__List__Included__Indicator_template() { clean_up(); } boolean AAA__3GPP__Complete__Data__List__Included__Indicator_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean AAA__3GPP__Complete__Data__List__Included__Indicator_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != AAA__3GPP__Complete__Data__List__Included__Indicator::UNBOUND_VALUE; } void AAA__3GPP__Complete__Data__List__Included__Indicator_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } AAA__3GPP__Complete__Data__List__Included__Indicator_template& AAA__3GPP__Complete__Data__List__Included__Indicator_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } AAA__3GPP__Complete__Data__List__Included__Indicator_template& AAA__3GPP__Complete__Data__List__Included__Indicator_template::operator=(int other_value) { if (!AAA__3GPP__Complete__Data__List__Included__Indicator::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.AAA_3GPP_Complete_Data_List_Included_Indicator.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__Complete__Data__List__Included__Indicator::enum_type)other_value; return *this; } AAA__3GPP__Complete__Data__List__Included__Indicator_template& AAA__3GPP__Complete__Data__List__Included__Indicator_template::operator=(AAA__3GPP__Complete__Data__List__Included__Indicator::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } AAA__3GPP__Complete__Data__List__Included__Indicator_template& AAA__3GPP__Complete__Data__List__Included__Indicator_template::operator=(const AAA__3GPP__Complete__Data__List__Included__Indicator& other_value) { if (other_value.enum_value == AAA__3GPP__Complete__Data__List__Included__Indicator::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_Complete_Data_List_Included_Indicator to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } AAA__3GPP__Complete__Data__List__Included__Indicator_template& AAA__3GPP__Complete__Data__List__Included__Indicator_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__Complete__Data__List__Included__Indicator::enum_type)(const AAA__3GPP__Complete__Data__List__Included__Indicator&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.AAA_3GPP_Complete_Data_List_Included_Indicator."); } return *this; } AAA__3GPP__Complete__Data__List__Included__Indicator_template& AAA__3GPP__Complete__Data__List__Included__Indicator_template::operator=(const AAA__3GPP__Complete__Data__List__Included__Indicator_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean AAA__3GPP__Complete__Data__List__Included__Indicator_template::match(AAA__3GPP__Complete__Data__List__Included__Indicator::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_Complete_Data_List_Included_Indicator."); } return FALSE; } boolean AAA__3GPP__Complete__Data__List__Included__Indicator_template::match(const AAA__3GPP__Complete__Data__List__Included__Indicator& other_value, boolean) const { if (other_value.enum_value == AAA__3GPP__Complete__Data__List__Included__Indicator::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.AAA_3GPP_Complete_Data_List_Included_Indicator with an unbound value."); return match(other_value.enum_value); } AAA__3GPP__Complete__Data__List__Included__Indicator::enum_type AAA__3GPP__Complete__Data__List__Included__Indicator_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.AAA_3GPP_Complete_Data_List_Included_Indicator."); return single_value; } void AAA__3GPP__Complete__Data__List__Included__Indicator_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.AAA_3GPP_Complete_Data_List_Included_Indicator."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new AAA__3GPP__Complete__Data__List__Included__Indicator_template[list_length]; } AAA__3GPP__Complete__Data__List__Included__Indicator_template& AAA__3GPP__Complete__Data__List__Included__Indicator_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.AAA_3GPP_Complete_Data_List_Included_Indicator."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.AAA_3GPP_Complete_Data_List_Included_Indicator."); return value_list.list_value[list_index]; } void AAA__3GPP__Complete__Data__List__Included__Indicator_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(AAA__3GPP__Complete__Data__List__Included__Indicator::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void AAA__3GPP__Complete__Data__List__Included__Indicator_template::log_match(const AAA__3GPP__Complete__Data__List__Included__Indicator& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void AAA__3GPP__Complete__Data__List__Included__Indicator_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_Complete_Data_List_Included_Indicator."); } } void AAA__3GPP__Complete__Data__List__Included__Indicator_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (AAA__3GPP__Complete__Data__List__Included__Indicator::enum_type)text_buf.pull_int().get_val(); if (!AAA__3GPP__Complete__Data__List__Included__Indicator::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.AAA_3GPP_Complete_Data_List_Included_Indicator.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new AAA__3GPP__Complete__Data__List__Included__Indicator_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.AAA_3GPP_Complete_Data_List_Included_Indicator."); } } boolean AAA__3GPP__Complete__Data__List__Included__Indicator_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean AAA__3GPP__Complete__Data__List__Included__Indicator_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { AAA__3GPP__Complete__Data__List__Included__Indicator_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { AAA__3GPP__Complete__Data__List__Included__Indicator::enum_type enum_val = AAA__3GPP__Complete__Data__List__Included__Indicator::str_to_enum(m_p->get_enumerated()); if (!AAA__3GPP__Complete__Data__List__Included__Indicator::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.AAA_3GPP_Complete_Data_List_Included_Indicator."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { AAA__3GPP__Complete__Data__List__Included__Indicator_template* precondition = new AAA__3GPP__Complete__Data__List__Included__Indicator_template; precondition->set_param(*m_p->get_elem(0)); AAA__3GPP__Complete__Data__List__Included__Indicator_template* implied_template = new AAA__3GPP__Complete__Data__List__Included__Indicator_template; implied_template->set_param(*m_p->get_elem(1)); *this = AAA__3GPP__Complete__Data__List__Included__Indicator_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.AAA_3GPP_Complete_Data_List_Included_Indicator"); } is_ifpresent = param.get_ifpresent(); } void AAA__3GPP__Complete__Data__List__Included__Indicator_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.AAA_3GPP_Complete_Data_List_Included_Indicator"); } DCC__NONE__CC__Request__Type::DCC__NONE__CC__Request__Type() { enum_value = UNBOUND_VALUE; } DCC__NONE__CC__Request__Type::DCC__NONE__CC__Request__Type(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.DCC_NONE_CC_Request_Type with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } DCC__NONE__CC__Request__Type::DCC__NONE__CC__Request__Type(enum_type other_value) { enum_value = other_value; } DCC__NONE__CC__Request__Type::DCC__NONE__CC__Request__Type(const DCC__NONE__CC__Request__Type& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_CC_Request_Type."); enum_value = other_value.enum_value; } DCC__NONE__CC__Request__Type& DCC__NONE__CC__Request__Type::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.DCC_NONE_CC_Request_Type.", other_value); enum_value = (enum_type)other_value; return *this; } DCC__NONE__CC__Request__Type& DCC__NONE__CC__Request__Type::operator=(enum_type other_value) { enum_value = other_value; return *this; } DCC__NONE__CC__Request__Type& DCC__NONE__CC__Request__Type::operator=(const DCC__NONE__CC__Request__Type& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_CC_Request_Type."); enum_value = other_value.enum_value; return *this; } boolean DCC__NONE__CC__Request__Type::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_CC_Request_Type."); return enum_value == other_value; } boolean DCC__NONE__CC__Request__Type::operator==(const DCC__NONE__CC__Request__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_CC_Request_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_CC_Request_Type."); return enum_value == other_value.enum_value; } boolean DCC__NONE__CC__Request__Type::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_CC_Request_Type."); return enum_value < other_value; } boolean DCC__NONE__CC__Request__Type::operator<(const DCC__NONE__CC__Request__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_CC_Request_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_CC_Request_Type."); return enum_value < other_value.enum_value; } boolean DCC__NONE__CC__Request__Type::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_CC_Request_Type."); return enum_value > other_value; } boolean DCC__NONE__CC__Request__Type::operator>(const DCC__NONE__CC__Request__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_CC_Request_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_CC_Request_Type."); return enum_value > other_value.enum_value; } const char *DCC__NONE__CC__Request__Type::enum_to_str(enum_type enum_par) { switch (enum_par) { case INITIAL__REQUEST: return "INITIAL_REQUEST"; case UPDATE__REQUEST: return "UPDATE_REQUEST"; case TERMINATION__REQUEST: return "TERMINATION_REQUEST"; case EVENT__REQUEST: return "EVENT_REQUEST"; default: return ""; } } DCC__NONE__CC__Request__Type::enum_type DCC__NONE__CC__Request__Type::str_to_enum(const char *str_par) { if (!strcmp(str_par, "INITIAL_REQUEST")) return INITIAL__REQUEST; else if (!strcmp(str_par, "UPDATE_REQUEST")) return UPDATE__REQUEST; else if (!strcmp(str_par, "TERMINATION_REQUEST")) return TERMINATION__REQUEST; else if (!strcmp(str_par, "EVENT_REQUEST")) return EVENT__REQUEST; else return UNKNOWN_VALUE; } boolean DCC__NONE__CC__Request__Type::is_valid_enum(int int_par) { switch (int_par) { case 1: case 2: case 3: case 4: return TRUE; default: return FALSE; } } int DCC__NONE__CC__Request__Type::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCC_NONE_CC_Request_Type.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int DCC__NONE__CC__Request__Type::enum2int(const DCC__NONE__CC__Request__Type& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCC_NONE_CC_Request_Type.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void DCC__NONE__CC__Request__Type::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.DCC_NONE_CC_Request_Type.", int_val); enum_value = (enum_type)int_val; } DCC__NONE__CC__Request__Type::operator DCC__NONE__CC__Request__Type::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.DCC_NONE_CC_Request_Type."); return enum_value; } void DCC__NONE__CC__Request__Type::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void DCC__NONE__CC__Request__Type::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.DCC_NONE_CC_Request_Type"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCC_NONE_CC_Request_Type."); } } void DCC__NONE__CC__Request__Type::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_CC_Request_Type."); text_buf.push_int(enum_value); } void DCC__NONE__CC__Request__Type::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.DCC_NONE_CC_Request_Type.", enum_value); } void DCC__NONE__CC__Request__Type::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void DCC__NONE__CC__Request__Type::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int DCC__NONE__CC__Request__Type::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 3, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int DCC__NONE__CC__Request__Type::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 3); } void DCC__NONE__CC__Request__Type_template::copy_template(const DCC__NONE__CC__Request__Type_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new DCC__NONE__CC__Request__Type_template[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 DCC__NONE__CC__Request__Type_template(*other_value.implication_.precondition); implication_.implied_template = new DCC__NONE__CC__Request__Type_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCC_NONE_CC_Request_Type."); } } DCC__NONE__CC__Request__Type_template::DCC__NONE__CC__Request__Type_template() { } DCC__NONE__CC__Request__Type_template::DCC__NONE__CC__Request__Type_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } DCC__NONE__CC__Request__Type_template::DCC__NONE__CC__Request__Type_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!DCC__NONE__CC__Request__Type::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.DCC_NONE_CC_Request_Type with unknown numeric value %d.", other_value); single_value = (DCC__NONE__CC__Request__Type::enum_type)other_value; } DCC__NONE__CC__Request__Type_template::DCC__NONE__CC__Request__Type_template(DCC__NONE__CC__Request__Type::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } DCC__NONE__CC__Request__Type_template::DCC__NONE__CC__Request__Type_template(const DCC__NONE__CC__Request__Type& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == DCC__NONE__CC__Request__Type::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_CC_Request_Type."); single_value = other_value.enum_value; } DCC__NONE__CC__Request__Type_template::DCC__NONE__CC__Request__Type_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCC__NONE__CC__Request__Type::enum_type)(const DCC__NONE__CC__Request__Type&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.DCC_NONE_CC_Request_Type from an unbound optional field."); } } DCC__NONE__CC__Request__Type_template::DCC__NONE__CC__Request__Type_template(DCC__NONE__CC__Request__Type_template* p_precondition, DCC__NONE__CC__Request__Type_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } DCC__NONE__CC__Request__Type_template::DCC__NONE__CC__Request__Type_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; } DCC__NONE__CC__Request__Type_template::DCC__NONE__CC__Request__Type_template(const DCC__NONE__CC__Request__Type_template& other_value) : Base_Template() { copy_template(other_value); } DCC__NONE__CC__Request__Type_template::~DCC__NONE__CC__Request__Type_template() { clean_up(); } boolean DCC__NONE__CC__Request__Type_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean DCC__NONE__CC__Request__Type_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != DCC__NONE__CC__Request__Type::UNBOUND_VALUE; } void DCC__NONE__CC__Request__Type_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } DCC__NONE__CC__Request__Type_template& DCC__NONE__CC__Request__Type_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } DCC__NONE__CC__Request__Type_template& DCC__NONE__CC__Request__Type_template::operator=(int other_value) { if (!DCC__NONE__CC__Request__Type::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.DCC_NONE_CC_Request_Type.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (DCC__NONE__CC__Request__Type::enum_type)other_value; return *this; } DCC__NONE__CC__Request__Type_template& DCC__NONE__CC__Request__Type_template::operator=(DCC__NONE__CC__Request__Type::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } DCC__NONE__CC__Request__Type_template& DCC__NONE__CC__Request__Type_template::operator=(const DCC__NONE__CC__Request__Type& other_value) { if (other_value.enum_value == DCC__NONE__CC__Request__Type::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCC_NONE_CC_Request_Type to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } DCC__NONE__CC__Request__Type_template& DCC__NONE__CC__Request__Type_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCC__NONE__CC__Request__Type::enum_type)(const DCC__NONE__CC__Request__Type&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.DCC_NONE_CC_Request_Type."); } return *this; } DCC__NONE__CC__Request__Type_template& DCC__NONE__CC__Request__Type_template::operator=(const DCC__NONE__CC__Request__Type_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean DCC__NONE__CC__Request__Type_template::match(DCC__NONE__CC__Request__Type::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCC_NONE_CC_Request_Type."); } return FALSE; } boolean DCC__NONE__CC__Request__Type_template::match(const DCC__NONE__CC__Request__Type& other_value, boolean) const { if (other_value.enum_value == DCC__NONE__CC__Request__Type::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.DCC_NONE_CC_Request_Type with an unbound value."); return match(other_value.enum_value); } DCC__NONE__CC__Request__Type::enum_type DCC__NONE__CC__Request__Type_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.DCC_NONE_CC_Request_Type."); return single_value; } void DCC__NONE__CC__Request__Type_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.DCC_NONE_CC_Request_Type."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new DCC__NONE__CC__Request__Type_template[list_length]; } DCC__NONE__CC__Request__Type_template& DCC__NONE__CC__Request__Type_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.DCC_NONE_CC_Request_Type."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.DCC_NONE_CC_Request_Type."); return value_list.list_value[list_index]; } void DCC__NONE__CC__Request__Type_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(DCC__NONE__CC__Request__Type::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void DCC__NONE__CC__Request__Type_template::log_match(const DCC__NONE__CC__Request__Type& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void DCC__NONE__CC__Request__Type_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCC_NONE_CC_Request_Type."); } } void DCC__NONE__CC__Request__Type_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (DCC__NONE__CC__Request__Type::enum_type)text_buf.pull_int().get_val(); if (!DCC__NONE__CC__Request__Type::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.DCC_NONE_CC_Request_Type.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new DCC__NONE__CC__Request__Type_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.DCC_NONE_CC_Request_Type."); } } boolean DCC__NONE__CC__Request__Type_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean DCC__NONE__CC__Request__Type_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { DCC__NONE__CC__Request__Type_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { DCC__NONE__CC__Request__Type::enum_type enum_val = DCC__NONE__CC__Request__Type::str_to_enum(m_p->get_enumerated()); if (!DCC__NONE__CC__Request__Type::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCC_NONE_CC_Request_Type."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { DCC__NONE__CC__Request__Type_template* precondition = new DCC__NONE__CC__Request__Type_template; precondition->set_param(*m_p->get_elem(0)); DCC__NONE__CC__Request__Type_template* implied_template = new DCC__NONE__CC__Request__Type_template; implied_template->set_param(*m_p->get_elem(1)); *this = DCC__NONE__CC__Request__Type_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.DCC_NONE_CC_Request_Type"); } is_ifpresent = param.get_ifpresent(); } void DCC__NONE__CC__Request__Type_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.DCC_NONE_CC_Request_Type"); } PCC__3GPP__Usage__Monitoring__Report::PCC__3GPP__Usage__Monitoring__Report() { enum_value = UNBOUND_VALUE; } PCC__3GPP__Usage__Monitoring__Report::PCC__3GPP__Usage__Monitoring__Report(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.PCC_3GPP_Usage_Monitoring_Report with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } PCC__3GPP__Usage__Monitoring__Report::PCC__3GPP__Usage__Monitoring__Report(enum_type other_value) { enum_value = other_value; } PCC__3GPP__Usage__Monitoring__Report::PCC__3GPP__Usage__Monitoring__Report(const PCC__3GPP__Usage__Monitoring__Report& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Usage_Monitoring_Report."); enum_value = other_value.enum_value; } PCC__3GPP__Usage__Monitoring__Report& PCC__3GPP__Usage__Monitoring__Report::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.PCC_3GPP_Usage_Monitoring_Report.", other_value); enum_value = (enum_type)other_value; return *this; } PCC__3GPP__Usage__Monitoring__Report& PCC__3GPP__Usage__Monitoring__Report::operator=(enum_type other_value) { enum_value = other_value; return *this; } PCC__3GPP__Usage__Monitoring__Report& PCC__3GPP__Usage__Monitoring__Report::operator=(const PCC__3GPP__Usage__Monitoring__Report& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Usage_Monitoring_Report."); enum_value = other_value.enum_value; return *this; } boolean PCC__3GPP__Usage__Monitoring__Report::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Usage_Monitoring_Report."); return enum_value == other_value; } boolean PCC__3GPP__Usage__Monitoring__Report::operator==(const PCC__3GPP__Usage__Monitoring__Report& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Usage_Monitoring_Report."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Usage_Monitoring_Report."); return enum_value == other_value.enum_value; } boolean PCC__3GPP__Usage__Monitoring__Report::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Usage_Monitoring_Report."); return enum_value < other_value; } boolean PCC__3GPP__Usage__Monitoring__Report::operator<(const PCC__3GPP__Usage__Monitoring__Report& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Usage_Monitoring_Report."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Usage_Monitoring_Report."); return enum_value < other_value.enum_value; } boolean PCC__3GPP__Usage__Monitoring__Report::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Usage_Monitoring_Report."); return enum_value > other_value; } boolean PCC__3GPP__Usage__Monitoring__Report::operator>(const PCC__3GPP__Usage__Monitoring__Report& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Usage_Monitoring_Report."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Usage_Monitoring_Report."); return enum_value > other_value.enum_value; } const char *PCC__3GPP__Usage__Monitoring__Report::enum_to_str(enum_type enum_par) { switch (enum_par) { case USAGE__MONITORING__REPORT__REQUIRED: return "USAGE_MONITORING_REPORT_REQUIRED"; default: return ""; } } PCC__3GPP__Usage__Monitoring__Report::enum_type PCC__3GPP__Usage__Monitoring__Report::str_to_enum(const char *str_par) { if (!strcmp(str_par, "USAGE_MONITORING_REPORT_REQUIRED")) return USAGE__MONITORING__REPORT__REQUIRED; else return UNKNOWN_VALUE; } boolean PCC__3GPP__Usage__Monitoring__Report::is_valid_enum(int int_par) { switch (int_par) { case 0: return TRUE; default: return FALSE; } } int PCC__3GPP__Usage__Monitoring__Report::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.PCC_3GPP_Usage_Monitoring_Report.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int PCC__3GPP__Usage__Monitoring__Report::enum2int(const PCC__3GPP__Usage__Monitoring__Report& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.PCC_3GPP_Usage_Monitoring_Report.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void PCC__3GPP__Usage__Monitoring__Report::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.PCC_3GPP_Usage_Monitoring_Report.", int_val); enum_value = (enum_type)int_val; } PCC__3GPP__Usage__Monitoring__Report::operator PCC__3GPP__Usage__Monitoring__Report::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.PCC_3GPP_Usage_Monitoring_Report."); return enum_value; } void PCC__3GPP__Usage__Monitoring__Report::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void PCC__3GPP__Usage__Monitoring__Report::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.PCC_3GPP_Usage_Monitoring_Report"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.PCC_3GPP_Usage_Monitoring_Report."); } } void PCC__3GPP__Usage__Monitoring__Report::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Usage_Monitoring_Report."); text_buf.push_int(enum_value); } void PCC__3GPP__Usage__Monitoring__Report::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.PCC_3GPP_Usage_Monitoring_Report.", enum_value); } void PCC__3GPP__Usage__Monitoring__Report::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void PCC__3GPP__Usage__Monitoring__Report::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int PCC__3GPP__Usage__Monitoring__Report::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 1, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int PCC__3GPP__Usage__Monitoring__Report::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 1); } void PCC__3GPP__Usage__Monitoring__Report_template::copy_template(const PCC__3GPP__Usage__Monitoring__Report_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new PCC__3GPP__Usage__Monitoring__Report_template[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 PCC__3GPP__Usage__Monitoring__Report_template(*other_value.implication_.precondition); implication_.implied_template = new PCC__3GPP__Usage__Monitoring__Report_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.PCC_3GPP_Usage_Monitoring_Report."); } } PCC__3GPP__Usage__Monitoring__Report_template::PCC__3GPP__Usage__Monitoring__Report_template() { } PCC__3GPP__Usage__Monitoring__Report_template::PCC__3GPP__Usage__Monitoring__Report_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } PCC__3GPP__Usage__Monitoring__Report_template::PCC__3GPP__Usage__Monitoring__Report_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!PCC__3GPP__Usage__Monitoring__Report::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.PCC_3GPP_Usage_Monitoring_Report with unknown numeric value %d.", other_value); single_value = (PCC__3GPP__Usage__Monitoring__Report::enum_type)other_value; } PCC__3GPP__Usage__Monitoring__Report_template::PCC__3GPP__Usage__Monitoring__Report_template(PCC__3GPP__Usage__Monitoring__Report::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } PCC__3GPP__Usage__Monitoring__Report_template::PCC__3GPP__Usage__Monitoring__Report_template(const PCC__3GPP__Usage__Monitoring__Report& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == PCC__3GPP__Usage__Monitoring__Report::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Usage_Monitoring_Report."); single_value = other_value.enum_value; } PCC__3GPP__Usage__Monitoring__Report_template::PCC__3GPP__Usage__Monitoring__Report_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (PCC__3GPP__Usage__Monitoring__Report::enum_type)(const PCC__3GPP__Usage__Monitoring__Report&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.PCC_3GPP_Usage_Monitoring_Report from an unbound optional field."); } } PCC__3GPP__Usage__Monitoring__Report_template::PCC__3GPP__Usage__Monitoring__Report_template(PCC__3GPP__Usage__Monitoring__Report_template* p_precondition, PCC__3GPP__Usage__Monitoring__Report_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } PCC__3GPP__Usage__Monitoring__Report_template::PCC__3GPP__Usage__Monitoring__Report_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; } PCC__3GPP__Usage__Monitoring__Report_template::PCC__3GPP__Usage__Monitoring__Report_template(const PCC__3GPP__Usage__Monitoring__Report_template& other_value) : Base_Template() { copy_template(other_value); } PCC__3GPP__Usage__Monitoring__Report_template::~PCC__3GPP__Usage__Monitoring__Report_template() { clean_up(); } boolean PCC__3GPP__Usage__Monitoring__Report_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean PCC__3GPP__Usage__Monitoring__Report_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != PCC__3GPP__Usage__Monitoring__Report::UNBOUND_VALUE; } void PCC__3GPP__Usage__Monitoring__Report_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } PCC__3GPP__Usage__Monitoring__Report_template& PCC__3GPP__Usage__Monitoring__Report_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } PCC__3GPP__Usage__Monitoring__Report_template& PCC__3GPP__Usage__Monitoring__Report_template::operator=(int other_value) { if (!PCC__3GPP__Usage__Monitoring__Report::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.PCC_3GPP_Usage_Monitoring_Report.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (PCC__3GPP__Usage__Monitoring__Report::enum_type)other_value; return *this; } PCC__3GPP__Usage__Monitoring__Report_template& PCC__3GPP__Usage__Monitoring__Report_template::operator=(PCC__3GPP__Usage__Monitoring__Report::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } PCC__3GPP__Usage__Monitoring__Report_template& PCC__3GPP__Usage__Monitoring__Report_template::operator=(const PCC__3GPP__Usage__Monitoring__Report& other_value) { if (other_value.enum_value == PCC__3GPP__Usage__Monitoring__Report::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.PCC_3GPP_Usage_Monitoring_Report to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } PCC__3GPP__Usage__Monitoring__Report_template& PCC__3GPP__Usage__Monitoring__Report_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (PCC__3GPP__Usage__Monitoring__Report::enum_type)(const PCC__3GPP__Usage__Monitoring__Report&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.PCC_3GPP_Usage_Monitoring_Report."); } return *this; } PCC__3GPP__Usage__Monitoring__Report_template& PCC__3GPP__Usage__Monitoring__Report_template::operator=(const PCC__3GPP__Usage__Monitoring__Report_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean PCC__3GPP__Usage__Monitoring__Report_template::match(PCC__3GPP__Usage__Monitoring__Report::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.PCC_3GPP_Usage_Monitoring_Report."); } return FALSE; } boolean PCC__3GPP__Usage__Monitoring__Report_template::match(const PCC__3GPP__Usage__Monitoring__Report& other_value, boolean) const { if (other_value.enum_value == PCC__3GPP__Usage__Monitoring__Report::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.PCC_3GPP_Usage_Monitoring_Report with an unbound value."); return match(other_value.enum_value); } PCC__3GPP__Usage__Monitoring__Report::enum_type PCC__3GPP__Usage__Monitoring__Report_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.PCC_3GPP_Usage_Monitoring_Report."); return single_value; } void PCC__3GPP__Usage__Monitoring__Report_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.PCC_3GPP_Usage_Monitoring_Report."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new PCC__3GPP__Usage__Monitoring__Report_template[list_length]; } PCC__3GPP__Usage__Monitoring__Report_template& PCC__3GPP__Usage__Monitoring__Report_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.PCC_3GPP_Usage_Monitoring_Report."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.PCC_3GPP_Usage_Monitoring_Report."); return value_list.list_value[list_index]; } void PCC__3GPP__Usage__Monitoring__Report_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(PCC__3GPP__Usage__Monitoring__Report::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void PCC__3GPP__Usage__Monitoring__Report_template::log_match(const PCC__3GPP__Usage__Monitoring__Report& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void PCC__3GPP__Usage__Monitoring__Report_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.PCC_3GPP_Usage_Monitoring_Report."); } } void PCC__3GPP__Usage__Monitoring__Report_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (PCC__3GPP__Usage__Monitoring__Report::enum_type)text_buf.pull_int().get_val(); if (!PCC__3GPP__Usage__Monitoring__Report::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.PCC_3GPP_Usage_Monitoring_Report.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new PCC__3GPP__Usage__Monitoring__Report_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.PCC_3GPP_Usage_Monitoring_Report."); } } boolean PCC__3GPP__Usage__Monitoring__Report_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean PCC__3GPP__Usage__Monitoring__Report_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { PCC__3GPP__Usage__Monitoring__Report_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { PCC__3GPP__Usage__Monitoring__Report::enum_type enum_val = PCC__3GPP__Usage__Monitoring__Report::str_to_enum(m_p->get_enumerated()); if (!PCC__3GPP__Usage__Monitoring__Report::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.PCC_3GPP_Usage_Monitoring_Report."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { PCC__3GPP__Usage__Monitoring__Report_template* precondition = new PCC__3GPP__Usage__Monitoring__Report_template; precondition->set_param(*m_p->get_elem(0)); PCC__3GPP__Usage__Monitoring__Report_template* implied_template = new PCC__3GPP__Usage__Monitoring__Report_template; implied_template->set_param(*m_p->get_elem(1)); *this = PCC__3GPP__Usage__Monitoring__Report_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.PCC_3GPP_Usage_Monitoring_Report"); } is_ifpresent = param.get_ifpresent(); } void PCC__3GPP__Usage__Monitoring__Report_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.PCC_3GPP_Usage_Monitoring_Report"); } CxDx__3GPP__Priviledged__Sender__Indication::CxDx__3GPP__Priviledged__Sender__Indication() { enum_value = UNBOUND_VALUE; } CxDx__3GPP__Priviledged__Sender__Indication::CxDx__3GPP__Priviledged__Sender__Indication(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.CxDx_3GPP_Priviledged_Sender_Indication with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } CxDx__3GPP__Priviledged__Sender__Indication::CxDx__3GPP__Priviledged__Sender__Indication(enum_type other_value) { enum_value = other_value; } CxDx__3GPP__Priviledged__Sender__Indication::CxDx__3GPP__Priviledged__Sender__Indication(const CxDx__3GPP__Priviledged__Sender__Indication& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.CxDx_3GPP_Priviledged_Sender_Indication."); enum_value = other_value.enum_value; } CxDx__3GPP__Priviledged__Sender__Indication& CxDx__3GPP__Priviledged__Sender__Indication::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.CxDx_3GPP_Priviledged_Sender_Indication.", other_value); enum_value = (enum_type)other_value; return *this; } CxDx__3GPP__Priviledged__Sender__Indication& CxDx__3GPP__Priviledged__Sender__Indication::operator=(enum_type other_value) { enum_value = other_value; return *this; } CxDx__3GPP__Priviledged__Sender__Indication& CxDx__3GPP__Priviledged__Sender__Indication::operator=(const CxDx__3GPP__Priviledged__Sender__Indication& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.CxDx_3GPP_Priviledged_Sender_Indication."); enum_value = other_value.enum_value; return *this; } boolean CxDx__3GPP__Priviledged__Sender__Indication::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.CxDx_3GPP_Priviledged_Sender_Indication."); return enum_value == other_value; } boolean CxDx__3GPP__Priviledged__Sender__Indication::operator==(const CxDx__3GPP__Priviledged__Sender__Indication& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.CxDx_3GPP_Priviledged_Sender_Indication."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.CxDx_3GPP_Priviledged_Sender_Indication."); return enum_value == other_value.enum_value; } boolean CxDx__3GPP__Priviledged__Sender__Indication::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.CxDx_3GPP_Priviledged_Sender_Indication."); return enum_value < other_value; } boolean CxDx__3GPP__Priviledged__Sender__Indication::operator<(const CxDx__3GPP__Priviledged__Sender__Indication& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.CxDx_3GPP_Priviledged_Sender_Indication."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.CxDx_3GPP_Priviledged_Sender_Indication."); return enum_value < other_value.enum_value; } boolean CxDx__3GPP__Priviledged__Sender__Indication::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.CxDx_3GPP_Priviledged_Sender_Indication."); return enum_value > other_value; } boolean CxDx__3GPP__Priviledged__Sender__Indication::operator>(const CxDx__3GPP__Priviledged__Sender__Indication& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.CxDx_3GPP_Priviledged_Sender_Indication."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.CxDx_3GPP_Priviledged_Sender_Indication."); return enum_value > other_value.enum_value; } const char *CxDx__3GPP__Priviledged__Sender__Indication::enum_to_str(enum_type enum_par) { switch (enum_par) { case NOT__PRIVILEDGED__SENDER: return "NOT_PRIVILEDGED_SENDER"; case PRIVILEDGED__SENDER: return "PRIVILEDGED_SENDER"; default: return ""; } } CxDx__3GPP__Priviledged__Sender__Indication::enum_type CxDx__3GPP__Priviledged__Sender__Indication::str_to_enum(const char *str_par) { if (!strcmp(str_par, "NOT_PRIVILEDGED_SENDER")) return NOT__PRIVILEDGED__SENDER; else if (!strcmp(str_par, "PRIVILEDGED_SENDER")) return PRIVILEDGED__SENDER; else return UNKNOWN_VALUE; } boolean CxDx__3GPP__Priviledged__Sender__Indication::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: return TRUE; default: return FALSE; } } int CxDx__3GPP__Priviledged__Sender__Indication::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.CxDx_3GPP_Priviledged_Sender_Indication.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int CxDx__3GPP__Priviledged__Sender__Indication::enum2int(const CxDx__3GPP__Priviledged__Sender__Indication& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.CxDx_3GPP_Priviledged_Sender_Indication.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void CxDx__3GPP__Priviledged__Sender__Indication::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.CxDx_3GPP_Priviledged_Sender_Indication.", int_val); enum_value = (enum_type)int_val; } CxDx__3GPP__Priviledged__Sender__Indication::operator CxDx__3GPP__Priviledged__Sender__Indication::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.CxDx_3GPP_Priviledged_Sender_Indication."); return enum_value; } void CxDx__3GPP__Priviledged__Sender__Indication::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void CxDx__3GPP__Priviledged__Sender__Indication::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.CxDx_3GPP_Priviledged_Sender_Indication"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.CxDx_3GPP_Priviledged_Sender_Indication."); } } void CxDx__3GPP__Priviledged__Sender__Indication::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.CxDx_3GPP_Priviledged_Sender_Indication."); text_buf.push_int(enum_value); } void CxDx__3GPP__Priviledged__Sender__Indication::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.CxDx_3GPP_Priviledged_Sender_Indication.", enum_value); } void CxDx__3GPP__Priviledged__Sender__Indication::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void CxDx__3GPP__Priviledged__Sender__Indication::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int CxDx__3GPP__Priviledged__Sender__Indication::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int CxDx__3GPP__Priviledged__Sender__Indication::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void CxDx__3GPP__Priviledged__Sender__Indication_template::copy_template(const CxDx__3GPP__Priviledged__Sender__Indication_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new CxDx__3GPP__Priviledged__Sender__Indication_template[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 CxDx__3GPP__Priviledged__Sender__Indication_template(*other_value.implication_.precondition); implication_.implied_template = new CxDx__3GPP__Priviledged__Sender__Indication_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.CxDx_3GPP_Priviledged_Sender_Indication."); } } CxDx__3GPP__Priviledged__Sender__Indication_template::CxDx__3GPP__Priviledged__Sender__Indication_template() { } CxDx__3GPP__Priviledged__Sender__Indication_template::CxDx__3GPP__Priviledged__Sender__Indication_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } CxDx__3GPP__Priviledged__Sender__Indication_template::CxDx__3GPP__Priviledged__Sender__Indication_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!CxDx__3GPP__Priviledged__Sender__Indication::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.CxDx_3GPP_Priviledged_Sender_Indication with unknown numeric value %d.", other_value); single_value = (CxDx__3GPP__Priviledged__Sender__Indication::enum_type)other_value; } CxDx__3GPP__Priviledged__Sender__Indication_template::CxDx__3GPP__Priviledged__Sender__Indication_template(CxDx__3GPP__Priviledged__Sender__Indication::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } CxDx__3GPP__Priviledged__Sender__Indication_template::CxDx__3GPP__Priviledged__Sender__Indication_template(const CxDx__3GPP__Priviledged__Sender__Indication& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == CxDx__3GPP__Priviledged__Sender__Indication::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.CxDx_3GPP_Priviledged_Sender_Indication."); single_value = other_value.enum_value; } CxDx__3GPP__Priviledged__Sender__Indication_template::CxDx__3GPP__Priviledged__Sender__Indication_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (CxDx__3GPP__Priviledged__Sender__Indication::enum_type)(const CxDx__3GPP__Priviledged__Sender__Indication&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.CxDx_3GPP_Priviledged_Sender_Indication from an unbound optional field."); } } CxDx__3GPP__Priviledged__Sender__Indication_template::CxDx__3GPP__Priviledged__Sender__Indication_template(CxDx__3GPP__Priviledged__Sender__Indication_template* p_precondition, CxDx__3GPP__Priviledged__Sender__Indication_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } CxDx__3GPP__Priviledged__Sender__Indication_template::CxDx__3GPP__Priviledged__Sender__Indication_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; } CxDx__3GPP__Priviledged__Sender__Indication_template::CxDx__3GPP__Priviledged__Sender__Indication_template(const CxDx__3GPP__Priviledged__Sender__Indication_template& other_value) : Base_Template() { copy_template(other_value); } CxDx__3GPP__Priviledged__Sender__Indication_template::~CxDx__3GPP__Priviledged__Sender__Indication_template() { clean_up(); } boolean CxDx__3GPP__Priviledged__Sender__Indication_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean CxDx__3GPP__Priviledged__Sender__Indication_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != CxDx__3GPP__Priviledged__Sender__Indication::UNBOUND_VALUE; } void CxDx__3GPP__Priviledged__Sender__Indication_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } CxDx__3GPP__Priviledged__Sender__Indication_template& CxDx__3GPP__Priviledged__Sender__Indication_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } CxDx__3GPP__Priviledged__Sender__Indication_template& CxDx__3GPP__Priviledged__Sender__Indication_template::operator=(int other_value) { if (!CxDx__3GPP__Priviledged__Sender__Indication::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.CxDx_3GPP_Priviledged_Sender_Indication.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (CxDx__3GPP__Priviledged__Sender__Indication::enum_type)other_value; return *this; } CxDx__3GPP__Priviledged__Sender__Indication_template& CxDx__3GPP__Priviledged__Sender__Indication_template::operator=(CxDx__3GPP__Priviledged__Sender__Indication::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } CxDx__3GPP__Priviledged__Sender__Indication_template& CxDx__3GPP__Priviledged__Sender__Indication_template::operator=(const CxDx__3GPP__Priviledged__Sender__Indication& other_value) { if (other_value.enum_value == CxDx__3GPP__Priviledged__Sender__Indication::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.CxDx_3GPP_Priviledged_Sender_Indication to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } CxDx__3GPP__Priviledged__Sender__Indication_template& CxDx__3GPP__Priviledged__Sender__Indication_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (CxDx__3GPP__Priviledged__Sender__Indication::enum_type)(const CxDx__3GPP__Priviledged__Sender__Indication&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.CxDx_3GPP_Priviledged_Sender_Indication."); } return *this; } CxDx__3GPP__Priviledged__Sender__Indication_template& CxDx__3GPP__Priviledged__Sender__Indication_template::operator=(const CxDx__3GPP__Priviledged__Sender__Indication_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean CxDx__3GPP__Priviledged__Sender__Indication_template::match(CxDx__3GPP__Priviledged__Sender__Indication::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.CxDx_3GPP_Priviledged_Sender_Indication."); } return FALSE; } boolean CxDx__3GPP__Priviledged__Sender__Indication_template::match(const CxDx__3GPP__Priviledged__Sender__Indication& other_value, boolean) const { if (other_value.enum_value == CxDx__3GPP__Priviledged__Sender__Indication::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.CxDx_3GPP_Priviledged_Sender_Indication with an unbound value."); return match(other_value.enum_value); } CxDx__3GPP__Priviledged__Sender__Indication::enum_type CxDx__3GPP__Priviledged__Sender__Indication_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.CxDx_3GPP_Priviledged_Sender_Indication."); return single_value; } void CxDx__3GPP__Priviledged__Sender__Indication_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.CxDx_3GPP_Priviledged_Sender_Indication."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new CxDx__3GPP__Priviledged__Sender__Indication_template[list_length]; } CxDx__3GPP__Priviledged__Sender__Indication_template& CxDx__3GPP__Priviledged__Sender__Indication_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.CxDx_3GPP_Priviledged_Sender_Indication."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.CxDx_3GPP_Priviledged_Sender_Indication."); return value_list.list_value[list_index]; } void CxDx__3GPP__Priviledged__Sender__Indication_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(CxDx__3GPP__Priviledged__Sender__Indication::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void CxDx__3GPP__Priviledged__Sender__Indication_template::log_match(const CxDx__3GPP__Priviledged__Sender__Indication& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void CxDx__3GPP__Priviledged__Sender__Indication_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.CxDx_3GPP_Priviledged_Sender_Indication."); } } void CxDx__3GPP__Priviledged__Sender__Indication_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (CxDx__3GPP__Priviledged__Sender__Indication::enum_type)text_buf.pull_int().get_val(); if (!CxDx__3GPP__Priviledged__Sender__Indication::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.CxDx_3GPP_Priviledged_Sender_Indication.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new CxDx__3GPP__Priviledged__Sender__Indication_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.CxDx_3GPP_Priviledged_Sender_Indication."); } } boolean CxDx__3GPP__Priviledged__Sender__Indication_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean CxDx__3GPP__Priviledged__Sender__Indication_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { CxDx__3GPP__Priviledged__Sender__Indication_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { CxDx__3GPP__Priviledged__Sender__Indication::enum_type enum_val = CxDx__3GPP__Priviledged__Sender__Indication::str_to_enum(m_p->get_enumerated()); if (!CxDx__3GPP__Priviledged__Sender__Indication::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.CxDx_3GPP_Priviledged_Sender_Indication."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { CxDx__3GPP__Priviledged__Sender__Indication_template* precondition = new CxDx__3GPP__Priviledged__Sender__Indication_template; precondition->set_param(*m_p->get_elem(0)); CxDx__3GPP__Priviledged__Sender__Indication_template* implied_template = new CxDx__3GPP__Priviledged__Sender__Indication_template; implied_template->set_param(*m_p->get_elem(1)); *this = CxDx__3GPP__Priviledged__Sender__Indication_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.CxDx_3GPP_Priviledged_Sender_Indication"); } is_ifpresent = param.get_ifpresent(); } void CxDx__3GPP__Priviledged__Sender__Indication_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.CxDx_3GPP_Priviledged_Sender_Indication"); } DCA__3GPP__AoC__Service__Obligatory__Type::DCA__3GPP__AoC__Service__Obligatory__Type() { enum_value = UNBOUND_VALUE; } DCA__3GPP__AoC__Service__Obligatory__Type::DCA__3GPP__AoC__Service__Obligatory__Type(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Obligatory_Type with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } DCA__3GPP__AoC__Service__Obligatory__Type::DCA__3GPP__AoC__Service__Obligatory__Type(enum_type other_value) { enum_value = other_value; } DCA__3GPP__AoC__Service__Obligatory__Type::DCA__3GPP__AoC__Service__Obligatory__Type(const DCA__3GPP__AoC__Service__Obligatory__Type& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Obligatory_Type."); enum_value = other_value.enum_value; } DCA__3GPP__AoC__Service__Obligatory__Type& DCA__3GPP__AoC__Service__Obligatory__Type::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Obligatory_Type.", other_value); enum_value = (enum_type)other_value; return *this; } DCA__3GPP__AoC__Service__Obligatory__Type& DCA__3GPP__AoC__Service__Obligatory__Type::operator=(enum_type other_value) { enum_value = other_value; return *this; } DCA__3GPP__AoC__Service__Obligatory__Type& DCA__3GPP__AoC__Service__Obligatory__Type::operator=(const DCA__3GPP__AoC__Service__Obligatory__Type& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Obligatory_Type."); enum_value = other_value.enum_value; return *this; } boolean DCA__3GPP__AoC__Service__Obligatory__Type::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Obligatory_Type."); return enum_value == other_value; } boolean DCA__3GPP__AoC__Service__Obligatory__Type::operator==(const DCA__3GPP__AoC__Service__Obligatory__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Obligatory_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Obligatory_Type."); return enum_value == other_value.enum_value; } boolean DCA__3GPP__AoC__Service__Obligatory__Type::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Obligatory_Type."); return enum_value < other_value; } boolean DCA__3GPP__AoC__Service__Obligatory__Type::operator<(const DCA__3GPP__AoC__Service__Obligatory__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Obligatory_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Obligatory_Type."); return enum_value < other_value.enum_value; } boolean DCA__3GPP__AoC__Service__Obligatory__Type::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Obligatory_Type."); return enum_value > other_value; } boolean DCA__3GPP__AoC__Service__Obligatory__Type::operator>(const DCA__3GPP__AoC__Service__Obligatory__Type& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Obligatory_Type."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Obligatory_Type."); return enum_value > other_value.enum_value; } const char *DCA__3GPP__AoC__Service__Obligatory__Type::enum_to_str(enum_type enum_par) { switch (enum_par) { case NON__BINDING: return "NON_BINDING"; case BINDING: return "BINDING"; default: return ""; } } DCA__3GPP__AoC__Service__Obligatory__Type::enum_type DCA__3GPP__AoC__Service__Obligatory__Type::str_to_enum(const char *str_par) { if (!strcmp(str_par, "NON_BINDING")) return NON__BINDING; else if (!strcmp(str_par, "BINDING")) return BINDING; else return UNKNOWN_VALUE; } boolean DCA__3GPP__AoC__Service__Obligatory__Type::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: return TRUE; default: return FALSE; } } int DCA__3GPP__AoC__Service__Obligatory__Type::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Obligatory_Type.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int DCA__3GPP__AoC__Service__Obligatory__Type::enum2int(const DCA__3GPP__AoC__Service__Obligatory__Type& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Obligatory_Type.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void DCA__3GPP__AoC__Service__Obligatory__Type::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Obligatory_Type.", int_val); enum_value = (enum_type)int_val; } DCA__3GPP__AoC__Service__Obligatory__Type::operator DCA__3GPP__AoC__Service__Obligatory__Type::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Obligatory_Type."); return enum_value; } void DCA__3GPP__AoC__Service__Obligatory__Type::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void DCA__3GPP__AoC__Service__Obligatory__Type::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.DCA_3GPP_AoC_Service_Obligatory_Type"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_AoC_Service_Obligatory_Type."); } } void DCA__3GPP__AoC__Service__Obligatory__Type::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Obligatory_Type."); text_buf.push_int(enum_value); } void DCA__3GPP__AoC__Service__Obligatory__Type::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Obligatory_Type.", enum_value); } void DCA__3GPP__AoC__Service__Obligatory__Type::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void DCA__3GPP__AoC__Service__Obligatory__Type::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int DCA__3GPP__AoC__Service__Obligatory__Type::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int DCA__3GPP__AoC__Service__Obligatory__Type::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void DCA__3GPP__AoC__Service__Obligatory__Type_template::copy_template(const DCA__3GPP__AoC__Service__Obligatory__Type_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new DCA__3GPP__AoC__Service__Obligatory__Type_template[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 DCA__3GPP__AoC__Service__Obligatory__Type_template(*other_value.implication_.precondition); implication_.implied_template = new DCA__3GPP__AoC__Service__Obligatory__Type_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Obligatory_Type."); } } DCA__3GPP__AoC__Service__Obligatory__Type_template::DCA__3GPP__AoC__Service__Obligatory__Type_template() { } DCA__3GPP__AoC__Service__Obligatory__Type_template::DCA__3GPP__AoC__Service__Obligatory__Type_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } DCA__3GPP__AoC__Service__Obligatory__Type_template::DCA__3GPP__AoC__Service__Obligatory__Type_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!DCA__3GPP__AoC__Service__Obligatory__Type::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Obligatory_Type with unknown numeric value %d.", other_value); single_value = (DCA__3GPP__AoC__Service__Obligatory__Type::enum_type)other_value; } DCA__3GPP__AoC__Service__Obligatory__Type_template::DCA__3GPP__AoC__Service__Obligatory__Type_template(DCA__3GPP__AoC__Service__Obligatory__Type::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } DCA__3GPP__AoC__Service__Obligatory__Type_template::DCA__3GPP__AoC__Service__Obligatory__Type_template(const DCA__3GPP__AoC__Service__Obligatory__Type& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == DCA__3GPP__AoC__Service__Obligatory__Type::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Obligatory_Type."); single_value = other_value.enum_value; } DCA__3GPP__AoC__Service__Obligatory__Type_template::DCA__3GPP__AoC__Service__Obligatory__Type_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__AoC__Service__Obligatory__Type::enum_type)(const DCA__3GPP__AoC__Service__Obligatory__Type&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Obligatory_Type from an unbound optional field."); } } DCA__3GPP__AoC__Service__Obligatory__Type_template::DCA__3GPP__AoC__Service__Obligatory__Type_template(DCA__3GPP__AoC__Service__Obligatory__Type_template* p_precondition, DCA__3GPP__AoC__Service__Obligatory__Type_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } DCA__3GPP__AoC__Service__Obligatory__Type_template::DCA__3GPP__AoC__Service__Obligatory__Type_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; } DCA__3GPP__AoC__Service__Obligatory__Type_template::DCA__3GPP__AoC__Service__Obligatory__Type_template(const DCA__3GPP__AoC__Service__Obligatory__Type_template& other_value) : Base_Template() { copy_template(other_value); } DCA__3GPP__AoC__Service__Obligatory__Type_template::~DCA__3GPP__AoC__Service__Obligatory__Type_template() { clean_up(); } boolean DCA__3GPP__AoC__Service__Obligatory__Type_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean DCA__3GPP__AoC__Service__Obligatory__Type_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != DCA__3GPP__AoC__Service__Obligatory__Type::UNBOUND_VALUE; } void DCA__3GPP__AoC__Service__Obligatory__Type_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } DCA__3GPP__AoC__Service__Obligatory__Type_template& DCA__3GPP__AoC__Service__Obligatory__Type_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } DCA__3GPP__AoC__Service__Obligatory__Type_template& DCA__3GPP__AoC__Service__Obligatory__Type_template::operator=(int other_value) { if (!DCA__3GPP__AoC__Service__Obligatory__Type::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Obligatory_Type.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__AoC__Service__Obligatory__Type::enum_type)other_value; return *this; } DCA__3GPP__AoC__Service__Obligatory__Type_template& DCA__3GPP__AoC__Service__Obligatory__Type_template::operator=(DCA__3GPP__AoC__Service__Obligatory__Type::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } DCA__3GPP__AoC__Service__Obligatory__Type_template& DCA__3GPP__AoC__Service__Obligatory__Type_template::operator=(const DCA__3GPP__AoC__Service__Obligatory__Type& other_value) { if (other_value.enum_value == DCA__3GPP__AoC__Service__Obligatory__Type::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Obligatory_Type to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } DCA__3GPP__AoC__Service__Obligatory__Type_template& DCA__3GPP__AoC__Service__Obligatory__Type_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (DCA__3GPP__AoC__Service__Obligatory__Type::enum_type)(const DCA__3GPP__AoC__Service__Obligatory__Type&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Obligatory_Type."); } return *this; } DCA__3GPP__AoC__Service__Obligatory__Type_template& DCA__3GPP__AoC__Service__Obligatory__Type_template::operator=(const DCA__3GPP__AoC__Service__Obligatory__Type_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean DCA__3GPP__AoC__Service__Obligatory__Type_template::match(DCA__3GPP__AoC__Service__Obligatory__Type::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Obligatory_Type."); } return FALSE; } boolean DCA__3GPP__AoC__Service__Obligatory__Type_template::match(const DCA__3GPP__AoC__Service__Obligatory__Type& other_value, boolean) const { if (other_value.enum_value == DCA__3GPP__AoC__Service__Obligatory__Type::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Obligatory_Type with an unbound value."); return match(other_value.enum_value); } DCA__3GPP__AoC__Service__Obligatory__Type::enum_type DCA__3GPP__AoC__Service__Obligatory__Type_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Obligatory_Type."); return single_value; } void DCA__3GPP__AoC__Service__Obligatory__Type_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Obligatory_Type."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new DCA__3GPP__AoC__Service__Obligatory__Type_template[list_length]; } DCA__3GPP__AoC__Service__Obligatory__Type_template& DCA__3GPP__AoC__Service__Obligatory__Type_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Obligatory_Type."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Obligatory_Type."); return value_list.list_value[list_index]; } void DCA__3GPP__AoC__Service__Obligatory__Type_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(DCA__3GPP__AoC__Service__Obligatory__Type::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void DCA__3GPP__AoC__Service__Obligatory__Type_template::log_match(const DCA__3GPP__AoC__Service__Obligatory__Type& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void DCA__3GPP__AoC__Service__Obligatory__Type_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Obligatory_Type."); } } void DCA__3GPP__AoC__Service__Obligatory__Type_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (DCA__3GPP__AoC__Service__Obligatory__Type::enum_type)text_buf.pull_int().get_val(); if (!DCA__3GPP__AoC__Service__Obligatory__Type::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Obligatory_Type.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new DCA__3GPP__AoC__Service__Obligatory__Type_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.DCA_3GPP_AoC_Service_Obligatory_Type."); } } boolean DCA__3GPP__AoC__Service__Obligatory__Type_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean DCA__3GPP__AoC__Service__Obligatory__Type_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { DCA__3GPP__AoC__Service__Obligatory__Type_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { DCA__3GPP__AoC__Service__Obligatory__Type::enum_type enum_val = DCA__3GPP__AoC__Service__Obligatory__Type::str_to_enum(m_p->get_enumerated()); if (!DCA__3GPP__AoC__Service__Obligatory__Type::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.DCA_3GPP_AoC_Service_Obligatory_Type."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { DCA__3GPP__AoC__Service__Obligatory__Type_template* precondition = new DCA__3GPP__AoC__Service__Obligatory__Type_template; precondition->set_param(*m_p->get_elem(0)); DCA__3GPP__AoC__Service__Obligatory__Type_template* implied_template = new DCA__3GPP__AoC__Service__Obligatory__Type_template; implied_template->set_param(*m_p->get_elem(1)); *this = DCA__3GPP__AoC__Service__Obligatory__Type_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.DCA_3GPP_AoC_Service_Obligatory_Type"); } is_ifpresent = param.get_ifpresent(); } void DCA__3GPP__AoC__Service__Obligatory__Type_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.DCA_3GPP_AoC_Service_Obligatory_Type"); } AAA__3GPP__ICS__Indicator::AAA__3GPP__ICS__Indicator() { enum_value = UNBOUND_VALUE; } AAA__3GPP__ICS__Indicator::AAA__3GPP__ICS__Indicator(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Initializing a variable of enumerated type @DIAMETER_Types.AAA_3GPP_ICS_Indicator with invalid numeric value %d.", other_value); enum_value = (enum_type)other_value; } AAA__3GPP__ICS__Indicator::AAA__3GPP__ICS__Indicator(enum_type other_value) { enum_value = other_value; } AAA__3GPP__ICS__Indicator::AAA__3GPP__ICS__Indicator(const AAA__3GPP__ICS__Indicator& other_value) : Base_Type() { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Copying an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_ICS_Indicator."); enum_value = other_value.enum_value; } AAA__3GPP__ICS__Indicator& AAA__3GPP__ICS__Indicator::operator=(int other_value) { if (!is_valid_enum(other_value)) TTCN_error("Assigning unknown numeric value %d to a variable of enumerated type @DIAMETER_Types.AAA_3GPP_ICS_Indicator.", other_value); enum_value = (enum_type)other_value; return *this; } AAA__3GPP__ICS__Indicator& AAA__3GPP__ICS__Indicator::operator=(enum_type other_value) { enum_value = other_value; return *this; } AAA__3GPP__ICS__Indicator& AAA__3GPP__ICS__Indicator::operator=(const AAA__3GPP__ICS__Indicator& other_value) { if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_ICS_Indicator."); enum_value = other_value.enum_value; return *this; } boolean AAA__3GPP__ICS__Indicator::operator==(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_ICS_Indicator."); return enum_value == other_value; } boolean AAA__3GPP__ICS__Indicator::operator==(const AAA__3GPP__ICS__Indicator& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_ICS_Indicator."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_ICS_Indicator."); return enum_value == other_value.enum_value; } boolean AAA__3GPP__ICS__Indicator::operator<(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_ICS_Indicator."); return enum_value < other_value; } boolean AAA__3GPP__ICS__Indicator::operator<(const AAA__3GPP__ICS__Indicator& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_ICS_Indicator."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_ICS_Indicator."); return enum_value < other_value.enum_value; } boolean AAA__3GPP__ICS__Indicator::operator>(enum_type other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_ICS_Indicator."); return enum_value > other_value; } boolean AAA__3GPP__ICS__Indicator::operator>(const AAA__3GPP__ICS__Indicator& other_value) const { if (enum_value == UNBOUND_VALUE) TTCN_error("The left operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_ICS_Indicator."); if (other_value.enum_value == UNBOUND_VALUE) TTCN_error("The right operand of comparison is an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_ICS_Indicator."); return enum_value > other_value.enum_value; } const char *AAA__3GPP__ICS__Indicator::enum_to_str(enum_type enum_par) { switch (enum_par) { case FALSE_: return "FALSE"; case TRUE_: return "TRUE"; default: return ""; } } AAA__3GPP__ICS__Indicator::enum_type AAA__3GPP__ICS__Indicator::str_to_enum(const char *str_par) { if (!strcmp(str_par, "FALSE")) return FALSE_; else if (!strcmp(str_par, "TRUE")) return TRUE_; else return UNKNOWN_VALUE; } boolean AAA__3GPP__ICS__Indicator::is_valid_enum(int int_par) { switch (int_par) { case 0: case 1: return TRUE; default: return FALSE; } } int AAA__3GPP__ICS__Indicator::enum2int(enum_type enum_par) { if (enum_par==UNBOUND_VALUE || enum_par==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.AAA_3GPP_ICS_Indicator.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par; } int AAA__3GPP__ICS__Indicator::enum2int(const AAA__3GPP__ICS__Indicator& enum_par) { if (enum_par.enum_value==UNBOUND_VALUE || enum_par.enum_value==UNKNOWN_VALUE) TTCN_error("The argument of function enum2int() is an %s value of enumerated type @DIAMETER_Types.AAA_3GPP_ICS_Indicator.", enum_par==UNBOUND_VALUE?"unbound":"invalid"); return enum_par.enum_value; } void AAA__3GPP__ICS__Indicator::int2enum(int int_val) { if (!is_valid_enum(int_val)) TTCN_error("Assigning invalid numeric value %d to a variable of enumerated type @DIAMETER_Types.AAA_3GPP_ICS_Indicator.", int_val); enum_value = (enum_type)int_val; } AAA__3GPP__ICS__Indicator::operator AAA__3GPP__ICS__Indicator::enum_type() const { if (enum_value == UNBOUND_VALUE) TTCN_error("Using the value of an unbound variable of enumerated type @DIAMETER_Types.AAA_3GPP_ICS_Indicator."); return enum_value; } void AAA__3GPP__ICS__Indicator::log() const { if (enum_value != UNBOUND_VALUE) TTCN_Logger::log_event_enum(enum_to_str(enum_value), enum_value); else TTCN_Logger::log_event_unbound(); } void AAA__3GPP__ICS__Indicator::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "enumerated value"); if (param.get_type()!=Module_Param::MP_Enumerated) param.type_error("enumerated value", "@DIAMETER_Types.AAA_3GPP_ICS_Indicator"); enum_value = str_to_enum(param.get_enumerated()); if (!is_valid_enum(enum_value)) { param.error("Invalid enumerated value for type @DIAMETER_Types.AAA_3GPP_ICS_Indicator."); } } void AAA__3GPP__ICS__Indicator::encode_text(Text_Buf& text_buf) const { if (enum_value == UNBOUND_VALUE) TTCN_error("Text encoder: Encoding an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_ICS_Indicator."); text_buf.push_int(enum_value); } void AAA__3GPP__ICS__Indicator::decode_text(Text_Buf& text_buf) { enum_value = (enum_type)text_buf.pull_int().get_val(); if (!is_valid_enum(enum_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for enumerated type @DIAMETER_Types.AAA_3GPP_ICS_Indicator.", enum_value); } void AAA__3GPP__ICS__Indicator::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) const { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-encoding type '%s': ", p_td.name); unsigned BER_coding=va_arg(pvar, unsigned); BER_encode_chk_coding(BER_coding); ASN_BER_TLV_t *tlv=BER_encode_TLV(p_td, BER_coding); tlv->put_in_buffer(p_buf); ASN_BER_TLV_t::destruct(tlv); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-encoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); RAW_enc_tr_pos rp; rp.level=0; rp.pos=NULL; RAW_enc_tree root(TRUE, NULL, &rp, 1, p_td.raw); RAW_encode(p_td, root); root.put_to_buf(p_buf); break;} case TTCN_EncDec::CT_TEXT: { TTCN_EncDec_ErrorContext ec("While TEXT-encoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); TEXT_encode(p_td,p_buf); break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-encoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XER_encode(*(p_td.xer),p_buf, XER_coding, 0, 0, 0); p_buf.put_c('\n'); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok(va_arg(pvar, int) != 0); JSON_encode(p_td, tok, FALSE); p_buf.put_s(tok.get_buffer_length(), (const unsigned char*)tok.get_buffer()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-encoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_encode(p_td, p_buf); break;} default: TTCN_error("Unknown coding method requested to encode type '%s'", p_td.name); } va_end(pvar); } void AAA__3GPP__ICS__Indicator::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, int p_coding, ...) { va_list pvar; va_start(pvar, p_coding); switch(p_coding) { case TTCN_EncDec::CT_BER: { TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name); unsigned L_form=va_arg(pvar, unsigned); ASN_BER_TLV_t tlv; BER_decode_str2TLV(p_buf, tlv, L_form); BER_decode_TLV(p_td, tlv, L_form); if(tlv.isComplete) p_buf.increase_pos(tlv.get_len()); break;} case TTCN_EncDec::CT_RAW: { TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name); if(!p_td.raw) TTCN_EncDec_ErrorContext::error_internal ("No RAW descriptor available for type '%s'.", p_td.name); raw_order_t r_order; switch(p_td.raw->top_bit_order) { case TOP_BIT_LEFT: r_order=ORDER_LSB; break; case TOP_BIT_RIGHT: default: r_order=ORDER_MSB; } int rawr = RAW_decode(p_td, p_buf, p_buf.get_len()*8, r_order); if(rawr<0) switch (-rawr) { case TTCN_EncDec::ET_INCOMPL_MSG: case TTCN_EncDec::ET_LEN_ERR: ec.error((TTCN_EncDec::error_type_t)-rawr, "Can not decode type '%s', because incomplete message was received", p_td.name); break; case 1: default: ec.error(TTCN_EncDec::ET_INVAL_MSG, "Can not decode type '%s', because invalid message was received", p_td.name); break; } break;} case TTCN_EncDec::CT_TEXT: { Limit_Token_List limit; TTCN_EncDec_ErrorContext ec("While TEXT-decoding type '%s': ", p_td.name); if(!p_td.text) TTCN_EncDec_ErrorContext::error_internal ("No TEXT descriptor available for type '%s'.", p_td.name); const unsigned char *b_data=p_buf.get_data(); int null_added=0; if(b_data[p_buf.get_len()-1]!='\0'){ null_added=1; p_buf.set_pos(p_buf.get_len()); p_buf.put_zero(8,ORDER_LSB); p_buf.rewind(); } if(TEXT_decode(p_td,p_buf,limit)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); if(null_added){ size_t actpos=p_buf.get_pos(); p_buf.set_pos(p_buf.get_len()-1); p_buf.cut_end(); p_buf.set_pos(actpos); } break;} case TTCN_EncDec::CT_XER: { TTCN_EncDec_ErrorContext ec("While XER-decoding type '%s': ", p_td.name); unsigned XER_coding=va_arg(pvar, unsigned); XER_encode_chk_coding(XER_coding, p_td); XmlReaderWrap reader(p_buf); for (int rd_ok=reader.Read(); rd_ok==1; rd_ok=reader.Read()) { if (reader.NodeType() == XML_READER_TYPE_ELEMENT) break; } XER_decode(*(p_td.xer), reader, XER_coding | XER_TOPLEVEL, XER_NONE, 0); size_t bytes = reader.ByteConsumed(); p_buf.set_pos(bytes); break;} case TTCN_EncDec::CT_JSON: { TTCN_EncDec_ErrorContext ec("While JSON-decoding type '%s': ", p_td.name); if(!p_td.json) TTCN_EncDec_ErrorContext::error_internal ("No JSON descriptor available for type '%s'.", p_td.name); JSON_Tokenizer tok((const char*)p_buf.get_data(), p_buf.get_len()); if(JSON_decode(p_td, tok, FALSE, FALSE)<0) ec.error(TTCN_EncDec::ET_INCOMPL_MSG,"Can not decode type '%s', because invalid or incomplete message was received", p_td.name); p_buf.set_pos(tok.get_buf_pos()); break;} case TTCN_EncDec::CT_OER: { TTCN_EncDec_ErrorContext ec("While OER-decoding type '%s': ", p_td.name); if(!p_td.oer) TTCN_EncDec_ErrorContext::error_internal ("No OER descriptor available for type '%s'.", p_td.name); OER_struct p_oer; OER_decode(p_td, p_buf, p_oer); break;} default: TTCN_error("Unknown coding method requested to decode type '%s'", p_td.name); } va_end(pvar); } int AAA__3GPP__ICS__Indicator::RAW_decode(const TTCN_Typedescriptor_t& p_td,TTCN_Buffer& p_buf,int limit, raw_order_t top_bit_ord, boolean no_err, int, boolean, const RAW_Force_Omit*) { int decoded_value = 0; int decoded_length = RAW_decode_enum_type(p_td, p_buf, limit, top_bit_ord, decoded_value, 2, no_err); if (decoded_length < 0) return decoded_length; if (is_valid_enum(decoded_value)) enum_value = (enum_type)decoded_value; else { if(no_err){ return -1; } else { TTCN_EncDec_ErrorContext::error (TTCN_EncDec::ET_ENC_ENUM, "Invalid enum value '%d' for '%s': ",decoded_value, p_td.name); enum_value = UNKNOWN_VALUE; } } return decoded_length; } int AAA__3GPP__ICS__Indicator::RAW_encode(const TTCN_Typedescriptor_t& p_td, RAW_enc_tree& myleaf) const { return RAW_encode_enum_type(p_td, myleaf, (int)enum_value, 2); } void AAA__3GPP__ICS__Indicator_template::copy_template(const AAA__3GPP__ICS__Indicator_template& other_value) { set_selection(other_value); switch (template_selection) { case SPECIFIC_VALUE: single_value = other_value.single_value; break; case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: value_list.n_values = other_value.value_list.n_values; value_list.list_value = new AAA__3GPP__ICS__Indicator_template[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 AAA__3GPP__ICS__Indicator_template(*other_value.implication_.precondition); implication_.implied_template = new AAA__3GPP__ICS__Indicator_template(*other_value.implication_.implied_template); break; case DYNAMIC_MATCH: dyn_match = other_value.dyn_match; dyn_match->ref_count++; break; default: TTCN_error("Copying an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_ICS_Indicator."); } } AAA__3GPP__ICS__Indicator_template::AAA__3GPP__ICS__Indicator_template() { } AAA__3GPP__ICS__Indicator_template::AAA__3GPP__ICS__Indicator_template(template_sel other_value) : Base_Template(other_value) { check_single_selection(other_value); } AAA__3GPP__ICS__Indicator_template::AAA__3GPP__ICS__Indicator_template(int other_value) : Base_Template(SPECIFIC_VALUE) { if (!AAA__3GPP__ICS__Indicator::is_valid_enum(other_value)) TTCN_error("Initializing a template of enumerated type @DIAMETER_Types.AAA_3GPP_ICS_Indicator with unknown numeric value %d.", other_value); single_value = (AAA__3GPP__ICS__Indicator::enum_type)other_value; } AAA__3GPP__ICS__Indicator_template::AAA__3GPP__ICS__Indicator_template(AAA__3GPP__ICS__Indicator::enum_type other_value) : Base_Template(SPECIFIC_VALUE) { single_value = other_value; } AAA__3GPP__ICS__Indicator_template::AAA__3GPP__ICS__Indicator_template(const AAA__3GPP__ICS__Indicator& other_value) : Base_Template(SPECIFIC_VALUE) { if (other_value.enum_value == AAA__3GPP__ICS__Indicator::UNBOUND_VALUE) TTCN_error("Creating a template from an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_ICS_Indicator."); single_value = other_value.enum_value; } AAA__3GPP__ICS__Indicator_template::AAA__3GPP__ICS__Indicator_template(const OPTIONAL& other_value) { switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__ICS__Indicator::enum_type)(const AAA__3GPP__ICS__Indicator&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Creating a template of enumerated type @DIAMETER_Types.AAA_3GPP_ICS_Indicator from an unbound optional field."); } } AAA__3GPP__ICS__Indicator_template::AAA__3GPP__ICS__Indicator_template(AAA__3GPP__ICS__Indicator_template* p_precondition, AAA__3GPP__ICS__Indicator_template* p_implied_template) : Base_Template(IMPLICATION_MATCH) { implication_.precondition = p_precondition; implication_.implied_template = p_implied_template; } AAA__3GPP__ICS__Indicator_template::AAA__3GPP__ICS__Indicator_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; } AAA__3GPP__ICS__Indicator_template::AAA__3GPP__ICS__Indicator_template(const AAA__3GPP__ICS__Indicator_template& other_value) : Base_Template() { copy_template(other_value); } AAA__3GPP__ICS__Indicator_template::~AAA__3GPP__ICS__Indicator_template() { clean_up(); } boolean AAA__3GPP__ICS__Indicator_template::is_bound() const { if (template_selection == UNINITIALIZED_TEMPLATE && !is_ifpresent) return FALSE; return TRUE; } boolean AAA__3GPP__ICS__Indicator_template::is_value() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) return FALSE; return single_value != AAA__3GPP__ICS__Indicator::UNBOUND_VALUE; } void AAA__3GPP__ICS__Indicator_template::clean_up() { switch (template_selection) { case VALUE_LIST: case COMPLEMENTED_LIST: case CONJUNCTION_MATCH: delete [] value_list.list_value; break; case IMPLICATION_MATCH: delete implication_.precondition; delete implication_.implied_template; break; case DYNAMIC_MATCH: dyn_match->ref_count--; if (dyn_match->ref_count == 0) { delete dyn_match->ptr; delete dyn_match; } break; default: break; } template_selection = UNINITIALIZED_TEMPLATE; } AAA__3GPP__ICS__Indicator_template& AAA__3GPP__ICS__Indicator_template::operator=(template_sel other_value) { check_single_selection(other_value); clean_up(); set_selection(other_value); return *this; } AAA__3GPP__ICS__Indicator_template& AAA__3GPP__ICS__Indicator_template::operator=(int other_value) { if (!AAA__3GPP__ICS__Indicator::is_valid_enum(other_value)) TTCN_warning("Assigning unknown numeric value %d to a template of enumerated type @DIAMETER_Types.AAA_3GPP_ICS_Indicator.", other_value); clean_up(); set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__ICS__Indicator::enum_type)other_value; return *this; } AAA__3GPP__ICS__Indicator_template& AAA__3GPP__ICS__Indicator_template::operator=(AAA__3GPP__ICS__Indicator::enum_type other_value) { clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value; return *this; } AAA__3GPP__ICS__Indicator_template& AAA__3GPP__ICS__Indicator_template::operator=(const AAA__3GPP__ICS__Indicator& other_value) { if (other_value.enum_value == AAA__3GPP__ICS__Indicator::UNBOUND_VALUE) TTCN_error("Assignment of an unbound value of enumerated type @DIAMETER_Types.AAA_3GPP_ICS_Indicator to a template."); clean_up(); set_selection(SPECIFIC_VALUE); single_value = other_value.enum_value; return *this; } AAA__3GPP__ICS__Indicator_template& AAA__3GPP__ICS__Indicator_template::operator=(const OPTIONAL& other_value) { clean_up(); switch (other_value.get_selection()) { case OPTIONAL_PRESENT: set_selection(SPECIFIC_VALUE); single_value = (AAA__3GPP__ICS__Indicator::enum_type)(const AAA__3GPP__ICS__Indicator&)other_value; break; case OPTIONAL_OMIT: set_selection(OMIT_VALUE); break; default: TTCN_error("Assignment of an unbound optional field to a template of enumerated type @DIAMETER_Types.AAA_3GPP_ICS_Indicator."); } return *this; } AAA__3GPP__ICS__Indicator_template& AAA__3GPP__ICS__Indicator_template::operator=(const AAA__3GPP__ICS__Indicator_template& other_value) { if (&other_value != this) { clean_up(); copy_template(other_value); } return *this; } boolean AAA__3GPP__ICS__Indicator_template::match(AAA__3GPP__ICS__Indicator::enum_type other_value, boolean) const { switch (template_selection) { case SPECIFIC_VALUE: return single_value == other_value; case OMIT_VALUE: return FALSE; case ANY_VALUE: case ANY_OR_OMIT: return TRUE; case VALUE_LIST: case COMPLEMENTED_LIST: for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++) if (value_list.list_value[list_count].match(other_value)) return template_selection == VALUE_LIST; return template_selection == COMPLEMENTED_LIST; case CONJUNCTION_MATCH: for (unsigned int i = 0; i < value_list.n_values; i++) { if (!value_list.list_value[i].match(other_value)) { return FALSE; } } return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match(other_value) || implication_.implied_template->match(other_value); case DYNAMIC_MATCH: return dyn_match->ptr->match(other_value); default: TTCN_error("Matching an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_ICS_Indicator."); } return FALSE; } boolean AAA__3GPP__ICS__Indicator_template::match(const AAA__3GPP__ICS__Indicator& other_value, boolean) const { if (other_value.enum_value == AAA__3GPP__ICS__Indicator::UNBOUND_VALUE) TTCN_error("Matching a template of enumerated type @DIAMETER_Types.AAA_3GPP_ICS_Indicator with an unbound value."); return match(other_value.enum_value); } AAA__3GPP__ICS__Indicator::enum_type AAA__3GPP__ICS__Indicator_template::valueof() const { if (template_selection != SPECIFIC_VALUE || is_ifpresent) TTCN_error("Performing a valueof or send operation on a non-specific template of enumerated type @DIAMETER_Types.AAA_3GPP_ICS_Indicator."); return single_value; } void AAA__3GPP__ICS__Indicator_template::set_type(template_sel template_type, unsigned int list_length) { if (template_type != VALUE_LIST && template_type != COMPLEMENTED_LIST && template_type != CONJUNCTION_MATCH) TTCN_error("Setting an invalid list type for a template of enumerated type @DIAMETER_Types.AAA_3GPP_ICS_Indicator."); clean_up(); set_selection(template_type); value_list.n_values = list_length; value_list.list_value = new AAA__3GPP__ICS__Indicator_template[list_length]; } AAA__3GPP__ICS__Indicator_template& AAA__3GPP__ICS__Indicator_template::list_item(unsigned int list_index) { if (template_selection != VALUE_LIST && template_selection != COMPLEMENTED_LIST && template_selection != CONJUNCTION_MATCH) TTCN_error("Accessing a list element in a non-list template of enumerated type @DIAMETER_Types.AAA_3GPP_ICS_Indicator."); if (list_index >= value_list.n_values) TTCN_error("Index overflow in a value list template of enumerated type @DIAMETER_Types.AAA_3GPP_ICS_Indicator."); return value_list.list_value[list_index]; } void AAA__3GPP__ICS__Indicator_template::log() const { switch (template_selection) { case SPECIFIC_VALUE: TTCN_Logger::log_event_enum(AAA__3GPP__ICS__Indicator::enum_to_str(single_value), single_value); break; case COMPLEMENTED_LIST: TTCN_Logger::log_event_str("complement"); case CONJUNCTION_MATCH: if (template_selection == CONJUNCTION_MATCH) { TTCN_Logger::log_event_str("conjunct"); } case VALUE_LIST: TTCN_Logger::log_char('('); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) { if (elem_count > 0) TTCN_Logger::log_event_str(", "); value_list.list_value[elem_count].log(); } TTCN_Logger::log_char(')'); break; case IMPLICATION_MATCH: implication_.precondition->log(); TTCN_Logger::log_event_str(" implies "); implication_.implied_template->log(); break; case DYNAMIC_MATCH: TTCN_Logger::log_event_str("@dynamic template"); break; default: log_generic(); } log_ifpresent(); } void AAA__3GPP__ICS__Indicator_template::log_match(const AAA__3GPP__ICS__Indicator& match_value, boolean) const { match_value.log(); TTCN_Logger::log_event_str(" with "); log(); if (match(match_value)) TTCN_Logger::log_event_str(" matched"); else TTCN_Logger::log_event_str(" unmatched"); } void AAA__3GPP__ICS__Indicator_template::encode_text(Text_Buf& text_buf) const { encode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: text_buf.push_int(single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: text_buf.push_int(value_list.n_values); for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].encode_text(text_buf); break; default: TTCN_error("Text encoder: Encoding an uninitialized/unsupported template of enumerated type @DIAMETER_Types.AAA_3GPP_ICS_Indicator."); } } void AAA__3GPP__ICS__Indicator_template::decode_text(Text_Buf& text_buf) { clean_up(); decode_text_base(text_buf); switch (template_selection) { case SPECIFIC_VALUE: single_value = (AAA__3GPP__ICS__Indicator::enum_type)text_buf.pull_int().get_val(); if (!AAA__3GPP__ICS__Indicator::is_valid_enum(single_value)) TTCN_error("Text decoder: Unknown numeric value %d was received for a template of enumerated type @DIAMETER_Types.AAA_3GPP_ICS_Indicator.", single_value); case OMIT_VALUE: case ANY_VALUE: case ANY_OR_OMIT: break; case VALUE_LIST: case COMPLEMENTED_LIST: value_list.n_values = text_buf.pull_int().get_val(); value_list.list_value = new AAA__3GPP__ICS__Indicator_template[value_list.n_values]; for (unsigned int elem_count = 0; elem_count < value_list.n_values; elem_count++) value_list.list_value[elem_count].decode_text(text_buf); break; default: TTCN_error("Text decoder: An unknown/unsupported selection was received for a template of enumerated type @DIAMETER_Types.AAA_3GPP_ICS_Indicator."); } } boolean AAA__3GPP__ICS__Indicator_template::is_present(boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE; return !match_omit(legacy); } boolean AAA__3GPP__ICS__Indicator_template::match_omit(boolean legacy) const { if (is_ifpresent) return TRUE; switch (template_selection) { case OMIT_VALUE: case ANY_OR_OMIT: return TRUE; case IMPLICATION_MATCH: return !implication_.precondition->match_omit() || implication_.implied_template->match_omit(); case VALUE_LIST: case COMPLEMENTED_LIST: if (legacy) { for (unsigned int i=0; iget_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; break; case Module_Param::MP_Any: *this = ANY_VALUE; break; case Module_Param::MP_AnyOrNone: *this = ANY_OR_OMIT; break; case Module_Param::MP_List_Template: case Module_Param::MP_ComplementList_Template: case Module_Param::MP_ConjunctList_Template: { AAA__3GPP__ICS__Indicator_template new_temp; new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? VALUE_LIST : (m_p->get_type() == Module_Param::MP_ConjunctList_Template ? CONJUNCTION_MATCH : COMPLEMENTED_LIST), m_p->get_size()); for (size_t p_i=0; p_iget_size(); p_i++) { new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i)); } *this = new_temp; break; } case Module_Param::MP_Enumerated: { AAA__3GPP__ICS__Indicator::enum_type enum_val = AAA__3GPP__ICS__Indicator::str_to_enum(m_p->get_enumerated()); if (!AAA__3GPP__ICS__Indicator::is_valid_enum(enum_val)) { param.error("Invalid enumerated value for type @DIAMETER_Types.AAA_3GPP_ICS_Indicator."); } *this = enum_val; } break; case Module_Param::MP_Implication_Template: { AAA__3GPP__ICS__Indicator_template* precondition = new AAA__3GPP__ICS__Indicator_template; precondition->set_param(*m_p->get_elem(0)); AAA__3GPP__ICS__Indicator_template* implied_template = new AAA__3GPP__ICS__Indicator_template; implied_template->set_param(*m_p->get_elem(1)); *this = AAA__3GPP__ICS__Indicator_template(precondition, implied_template); } break; default: param.type_error("enumerated template", "@DIAMETER_Types.AAA_3GPP_ICS_Indicator"); } is_ifpresent = param.get_ifpresent(); } void AAA__3GPP__ICS__Indicator_template::check_restriction(template_res t_res, const char* t_name, boolean legacy) const { if (template_selection==UNINITIALIZED_TEMPLATE) return; switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) { case TR_VALUE: if (!is_ifpresent && template_selection==SPECIFIC_VALUE) return; break; case TR_OMIT: if (!is_ifpresent && (template_selection==OMIT_VALUE || template_selection==SPECIFIC_VALUE)) return; break; case TR_PRESENT: if (!match_omit(legacy)) return; break; default: return; } TTCN_error("Restriction `%s' on template of type %s violated.", get_res_name(t_res), t_name ? t_name : "@DIAMETER_Types.AAA_3GPP_ICS_Indicator"); } } /* end of namespace */