Debugger - Stage 2 (artf511247)
[deliverable/titan.core.git] / core / ASN_EmbeddedPDV.cc
index 003b81f5571640561d7b18ac3f7f9a5dec3bc3d9..1b92f8ce834dc37e04615a1bdb3d6b6f2cfce916 100644 (file)
@@ -1,10 +1,24 @@
-///////////////////////////////////////////////////////////////////////////////
-// Copyright (c) 2000-2014 Ericsson Telecom AB
-// All rights reserved. This program and the accompanying materials
-// are made available under the terms of the Eclipse Public License v1.0
-// which accompanies this distribution, and is available at
-// http://www.eclipse.org/legal/epl-v10.html
-///////////////////////////////////////////////////////////////////////////////
+/******************************************************************************
+ * Copyright (c) 2000-2016 Ericsson Telecom AB
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Balasko, Jeno
+ *   Baranyi, Botond
+ *   Beres, Szabolcs
+ *   Delic, Adam
+ *   Forstner, Matyas
+ *   Kovacs, Ferenc
+ *   Raduly, Csaba
+ *   Szabados, Kristof
+ *   Szabo, Bence Janos
+ *   Szabo, Janos Zoltan – initial implementation
+ *   Szalai, Gabor
+ *
+ ******************************************************************************/
 #include <string.h>
 
 #include "Error.hh"
@@ -37,55 +51,55 @@ make the type descriptors of embedded types static
 
 static const ASN_Tag_t EMBEDDED_PDV_identification_tag_[] = { { ASN_TAG_CONT, 0u }};
 static const ASN_BERdescriptor_t EMBEDDED_PDV_identification_ber_ = { 1u, EMBEDDED_PDV_identification_tag_ };
-static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_descr_ = { "EMBEDDED PDV.identification", &EMBEDDED_PDV_identification_ber_, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
+static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_descr_ = { "EMBEDDED PDV.identification", &EMBEDDED_PDV_identification_ber_, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
 
 static const ASN_Tag_t EMBEDDED_PDV_identification_syntaxes_abstract_tag_[] = { { ASN_TAG_CONT, 0u }};
 static const ASN_BERdescriptor_t EMBEDDED_PDV_identification_syntaxes_abstract_ber_ = { 1u, EMBEDDED_PDV_identification_syntaxes_abstract_tag_ };
-static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_syntaxes_abstract_descr_ = { "EMBEDDED PDV.identification.syntaxes.abstract", &EMBEDDED_PDV_identification_syntaxes_abstract_ber_, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::OBJID };
+static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_syntaxes_abstract_descr_ = { "EMBEDDED PDV.identification.syntaxes.abstract", &EMBEDDED_PDV_identification_syntaxes_abstract_ber_, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::OBJID };
 
 static const ASN_Tag_t EMBEDDED_PDV_identification_syntaxes_transfer_tag_[] = { { ASN_TAG_CONT, 1u }};
 static const ASN_BERdescriptor_t EMBEDDED_PDV_identification_syntaxes_transfer_ber_ = { 1u, EMBEDDED_PDV_identification_syntaxes_transfer_tag_ };
-static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_syntaxes_transfer_descr_ = { "EMBEDDED PDV.identification.syntaxes.transfer", &EMBEDDED_PDV_identification_syntaxes_transfer_ber_, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::OBJID };
+static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_syntaxes_transfer_descr_ = { "EMBEDDED PDV.identification.syntaxes.transfer", &EMBEDDED_PDV_identification_syntaxes_transfer_ber_, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::OBJID };
 
 static const ASN_Tag_t EMBEDDED_PDV_identification_syntaxes_tag_[] = { { ASN_TAG_CONT, 0u }};
 static const ASN_BERdescriptor_t EMBEDDED_PDV_identification_syntaxes_ber_ = { 1u, EMBEDDED_PDV_identification_syntaxes_tag_ };
-static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_syntaxes_descr_ = { "EMBEDDED PDV.identification.syntaxes", &EMBEDDED_PDV_identification_syntaxes_ber_, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
+static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_syntaxes_descr_ = { "EMBEDDED PDV.identification.syntaxes", &EMBEDDED_PDV_identification_syntaxes_ber_, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
 
 static const ASN_Tag_t EMBEDDED_PDV_identification_syntax_tag_[] = { { ASN_TAG_CONT, 1u }};
 static const ASN_BERdescriptor_t EMBEDDED_PDV_identification_syntax_ber_ = { 1u, EMBEDDED_PDV_identification_syntax_tag_ };
-static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_syntax_descr_ = { "EMBEDDED PDV.identification.syntax", &EMBEDDED_PDV_identification_syntax_ber_, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::OBJID };
+static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_syntax_descr_ = { "EMBEDDED PDV.identification.syntax", &EMBEDDED_PDV_identification_syntax_ber_, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::OBJID };
 
 static const ASN_Tag_t EMBEDDED_PDV_identification_presentation__context__id_tag_[] = { { ASN_TAG_CONT, 2u }};
 static const ASN_BERdescriptor_t EMBEDDED_PDV_identification_presentation__context__id_ber_ = { 1u, EMBEDDED_PDV_identification_presentation__context__id_tag_ };
-static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_presentation__context__id_descr_ = { "EMBEDDED PDV.identification.presentation-context-id", &EMBEDDED_PDV_identification_presentation__context__id_ber_, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
+static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_presentation__context__id_descr_ = { "EMBEDDED PDV.identification.presentation-context-id", &EMBEDDED_PDV_identification_presentation__context__id_ber_, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
 
 static const ASN_Tag_t EMBEDDED_PDV_identification_context__negotiation_presentation__context__id_tag_[] = { { ASN_TAG_CONT, 0u }};
 static const ASN_BERdescriptor_t EMBEDDED_PDV_identification_context__negotiation_presentation__context__id_ber_ = { 1u, EMBEDDED_PDV_identification_context__negotiation_presentation__context__id_tag_ };
-static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_context__negotiation_presentation__context__id_descr_ = { "EMBEDDED PDV.identification.context-negotiation.presentation-context-id", &EMBEDDED_PDV_identification_context__negotiation_presentation__context__id_ber_, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
+static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_context__negotiation_presentation__context__id_descr_ = { "EMBEDDED PDV.identification.context-negotiation.presentation-context-id", &EMBEDDED_PDV_identification_context__negotiation_presentation__context__id_ber_, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
 
 static const ASN_Tag_t EMBEDDED_PDV_identification_context__negotiation_transfer__syntax_tag_[] = { { ASN_TAG_CONT, 1u }};
 static const ASN_BERdescriptor_t EMBEDDED_PDV_identification_context__negotiation_transfer__syntax_ber_ = { 1u, EMBEDDED_PDV_identification_context__negotiation_transfer__syntax_tag_ };
-static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_context__negotiation_transfer__syntax_descr_ = { "EMBEDDED PDV.identification.context-negotiation.transfer-syntax", &EMBEDDED_PDV_identification_context__negotiation_transfer__syntax_ber_, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::OBJID };
+static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_context__negotiation_transfer__syntax_descr_ = { "EMBEDDED PDV.identification.context-negotiation.transfer-syntax", &EMBEDDED_PDV_identification_context__negotiation_transfer__syntax_ber_, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::OBJID };
 
 static const ASN_Tag_t EMBEDDED_PDV_identification_context__negotiation_tag_[] = { { ASN_TAG_CONT, 3u }};
 static const ASN_BERdescriptor_t EMBEDDED_PDV_identification_context__negotiation_ber_ = { 1u, EMBEDDED_PDV_identification_context__negotiation_tag_ };
-static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_context__negotiation_descr_ = { "EMBEDDED PDV.identification.context-negotiation", &EMBEDDED_PDV_identification_context__negotiation_ber_, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
+static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_context__negotiation_descr_ = { "EMBEDDED PDV.identification.context-negotiation", &EMBEDDED_PDV_identification_context__negotiation_ber_, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
 
 static const ASN_Tag_t EMBEDDED_PDV_identification_transfer__syntax_tag_[] = { { ASN_TAG_CONT, 4u }};
 static const ASN_BERdescriptor_t EMBEDDED_PDV_identification_transfer__syntax_ber_ = { 1u, EMBEDDED_PDV_identification_transfer__syntax_tag_ };
-static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_transfer__syntax_descr_ = { "EMBEDDED PDV.identification.transfer-syntax", &EMBEDDED_PDV_identification_transfer__syntax_ber_, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::OBJID };
+static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_transfer__syntax_descr_ = { "EMBEDDED PDV.identification.transfer-syntax", &EMBEDDED_PDV_identification_transfer__syntax_ber_, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::OBJID };
 
 static const ASN_Tag_t EMBEDDED_PDV_identification_fixed_tag_[] = { { ASN_TAG_CONT, 5u }};
 static const ASN_BERdescriptor_t EMBEDDED_PDV_identification_fixed_ber_ = { 1u, EMBEDDED_PDV_identification_fixed_tag_ };
-static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_fixed_descr_ = { "EMBEDDED PDV.identification.fixed", &EMBEDDED_PDV_identification_fixed_ber_, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
+static const TTCN_Typedescriptor_t EMBEDDED_PDV_identification_fixed_descr_ = { "EMBEDDED PDV.identification.fixed", &EMBEDDED_PDV_identification_fixed_ber_, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
 
 static const ASN_Tag_t EMBEDDED_PDV_data__value_tag_[] = { { ASN_TAG_CONT, 2u }};
 static const ASN_BERdescriptor_t EMBEDDED_PDV_data__value_ber_ = { 1u, EMBEDDED_PDV_data__value_tag_ };
-static const TTCN_Typedescriptor_t EMBEDDED_PDV_data__value_descr_ = { "EMBEDDED PDV.data-value", &EMBEDDED_PDV_data__value_ber_, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
+static const TTCN_Typedescriptor_t EMBEDDED_PDV_data__value_descr_ = { "EMBEDDED PDV.data-value", &EMBEDDED_PDV_data__value_ber_, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::DONTCARE };
 
 static const ASN_Tag_t EMBEDDED_PDV_data__value__descriptor_tag_[] = { { ASN_TAG_CONT, 1u }};
 static const ASN_BERdescriptor_t EMBEDDED_PDV_data__value__descriptor_ber_ = { 1u, EMBEDDED_PDV_data__value__descriptor_tag_ };
-static const TTCN_Typedescriptor_t EMBEDDED_PDV_data__value__descriptor_descr_ = { "EMBEDDED PDV.data-value-descriptor", &EMBEDDED_PDV_data__value__descriptor_ber_, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::GRAPHICSTRING };
+static const TTCN_Typedescriptor_t EMBEDDED_PDV_data__value__descriptor_descr_ = { "EMBEDDED PDV.data-value-descriptor", &EMBEDDED_PDV_data__value__descriptor_ber_, NULL, NULL, NULL, NULL, NULL, TTCN_Typedescriptor_t::GRAPHICSTRING };
 
 /******************** EMBEDDED_PDV_identification ********************/
 
@@ -361,11 +375,15 @@ void EMBEDDED_PDV_identification::log() const
 void EMBEDDED_PDV_identification::set_param(Module_Param& param)
 {
   param.basic_check(Module_Param::BC_VALUE, "union value");
-  if (param.get_type()==Module_Param::MP_Value_List && param.get_size()==0) return;
-  if (param.get_type()!=Module_Param::MP_Assignment_List) {
+  Module_Param_Ptr mp = &param;
+  if (param.get_type() == Module_Param::MP_Reference) {
+    mp = param.get_referenced_param();
+  }
+  if (mp->get_type()==Module_Param::MP_Value_List && mp->get_size()==0) return;
+  if (mp->get_type()!=Module_Param::MP_Assignment_List) {
     param.error("union value with field name was expected");
   }
-  Module_Param* mp_last = param.get_elem(param.get_size()-1);
+  Module_Param* mp_last = mp->get_elem(mp->get_size()-1);
   if (!strcmp(mp_last->get_id()->get_name(), "syntaxes")) {
     syntaxes().set_param(*mp_last);
     return;
@@ -393,10 +411,53 @@ void EMBEDDED_PDV_identification::set_param(Module_Param& param)
   mp_last->error("Field %s does not exist in type EMBEDDED PDV.identification.", mp_last->get_id()->get_name());
 }
 
+Module_Param* EMBEDDED_PDV_identification::get_param(Module_Param_Name& param_name) const
+{
+  if (!is_bound()) {
+    return new Module_Param_Unbound();
+  }
+  Module_Param* mp_field = NULL;
+  switch(get_selection()) {
+  case ALT_syntaxes:
+    mp_field = field_syntaxes->get_param(param_name);
+    mp_field->set_id(new Module_Param_FieldName(mcopystr("syntaxes")));
+    break;
+  case ALT_syntax:
+    mp_field = field_syntax->get_param(param_name);
+    mp_field->set_id(new Module_Param_FieldName(mcopystr("syntax")));
+    break;
+  case ALT_presentation__context__id:
+    mp_field = field_presentation__context__id->get_param(param_name);
+    mp_field->set_id(new Module_Param_FieldName(mcopystr("presentation_context_id")));
+    break;
+  case ALT_context__negotiation:
+    mp_field = field_context__negotiation->get_param(param_name);
+    mp_field->set_id(new Module_Param_FieldName(mcopystr("context_negotiation")));
+    break;
+  case ALT_transfer__syntax:
+    mp_field = field_transfer__syntax->get_param(param_name);
+    mp_field->set_id(new Module_Param_FieldName(mcopystr("transfer_syntax")));
+    break;
+  case ALT_fixed:
+    mp_field = field_fixed->get_param(param_name);
+    mp_field->set_id(new Module_Param_FieldName(mcopystr("fixed")));
+    break;
+  default:
+    break;
+  }
+  Module_Param_Assignment_List* mp = new Module_Param_Assignment_List();
+  mp->add_elem(mp_field);
+  return mp;
+}
+
 void EMBEDDED_PDV_identification_template::set_param(Module_Param& param)
 {
   param.basic_check(Module_Param::BC_TEMPLATE, "union template");
-  switch (param.get_type()) {
+  Module_Param_Ptr mp = &param;
+  if (param.get_type() == Module_Param::MP_Reference) {
+    mp = param.get_referenced_param();
+  }
+  switch (mp->get_type()) {
   case Module_Param::MP_Omit:
     *this = OMIT_VALUE;
     break;
@@ -407,18 +468,21 @@ void EMBEDDED_PDV_identification_template::set_param(Module_Param& param)
     *this = ANY_OR_OMIT;
     break;
   case Module_Param::MP_List_Template:
-  case Module_Param::MP_ComplementList_Template:
-    set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : COMPLEMENTED_LIST, param.get_size());
-    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
-      list_item(p_i).set_param(*param.get_elem(p_i));
+  case Module_Param::MP_ComplementList_Template: {
+    EMBEDDED_PDV_identification_template temp;
+    temp.set_type(mp->get_type() == Module_Param::MP_List_Template ?
+      VALUE_LIST : COMPLEMENTED_LIST, mp->get_size());
+    for (size_t i=0; i<mp->get_size(); i++) {
+      temp.list_item(i).set_param(*mp->get_elem(i));
     }
-    break;
+    *this = temp;
+    break; }
   case Module_Param::MP_Value_List:
-    if (param.get_size()==0) break;
+    if (mp->get_size()==0) break;
     param.type_error("union template", "EMBEDDED PDV.identification");
     break;
   case Module_Param::MP_Assignment_List: {
-    Module_Param* mp_last = param.get_elem(param.get_size()-1);
+    Module_Param* mp_last = mp->get_elem(mp->get_size()-1);
     if (!strcmp(mp_last->get_id()->get_name(), "syntaxes")) {
       syntaxes().set_param(*mp_last);
       break;
@@ -448,7 +512,77 @@ void EMBEDDED_PDV_identification_template::set_param(Module_Param& param)
   default:
     param.type_error("union template", "EMBEDDED PDV.identification");
   }
-  is_ifpresent = param.get_ifpresent();
+  is_ifpresent = param.get_ifpresent() || mp->get_ifpresent();
+}
+
+Module_Param* EMBEDDED_PDV_identification_template::get_param(Module_Param_Name& param_name) const
+{
+  Module_Param* mp = NULL;
+  switch (template_selection) {
+  case UNINITIALIZED_TEMPLATE:
+    mp = new Module_Param_Unbound();
+    break;
+  case OMIT_VALUE:
+    mp = new Module_Param_Omit();
+    break;
+  case ANY_VALUE:
+    mp = new Module_Param_Any();
+    break;
+  case ANY_OR_OMIT:
+    mp = new Module_Param_AnyOrNone();
+    break;
+  case SPECIFIC_VALUE: {
+    Module_Param* mp_field = NULL;
+    switch(single_value.union_selection) {
+    case EMBEDDED_PDV_identification::ALT_syntaxes:
+      mp_field = single_value.field_syntaxes->get_param(param_name);
+      mp_field->set_id(new Module_Param_FieldName(mcopystr("syntaxes")));
+      break;
+    case EMBEDDED_PDV_identification::ALT_syntax:
+      mp_field = single_value.field_syntax->get_param(param_name);
+      mp_field->set_id(new Module_Param_FieldName(mcopystr("syntax")));
+      break;
+    case EMBEDDED_PDV_identification::ALT_presentation__context__id:
+      mp_field = single_value.field_presentation__context__id->get_param(param_name);
+      mp_field->set_id(new Module_Param_FieldName(mcopystr("presentation_context_id")));
+      break;
+    case EMBEDDED_PDV_identification::ALT_context__negotiation:
+      mp_field = single_value.field_context__negotiation->get_param(param_name);
+      mp_field->set_id(new Module_Param_FieldName(mcopystr("context_negotiation")));
+      break;
+    case EMBEDDED_PDV_identification::ALT_transfer__syntax:
+      mp_field = single_value.field_transfer__syntax->get_param(param_name);
+      mp_field->set_id(new Module_Param_FieldName(mcopystr("transfer_syntax")));
+      break;
+    case EMBEDDED_PDV_identification::ALT_fixed:
+      mp_field = single_value.field_fixed->get_param(param_name);
+      mp_field->set_id(new Module_Param_FieldName(mcopystr("fixed")));
+      break;
+    default:
+      break;
+    }
+    mp = new Module_Param_Assignment_List();
+    mp->add_elem(mp_field);
+    break; }
+  case VALUE_LIST:
+  case COMPLEMENTED_LIST: {
+    if (template_selection == VALUE_LIST) {
+      mp = new Module_Param_List_Template();
+    }
+    else {
+      mp = new Module_Param_ComplementList_Template();
+    }
+    for (size_t i = 0; i < value_list.n_values; ++i) {
+      mp->add_elem(value_list.list_value[i].get_param(param_name));
+    }
+    break; }
+  default:
+    break;
+  }
+  if (is_ifpresent) {
+    mp->set_ifpresent();
+  }
+  return mp;
 }
 
 void EMBEDDED_PDV_identification::encode_text(Text_Buf& text_buf) const
@@ -633,7 +767,7 @@ boolean EMBEDDED_PDV_identification::BER_decode_TLV(const TTCN_Typedescriptor_t&
 // FIXME maybe: XER_encode and decode is virtually identical to CHARACTER_STRING
 
 int EMBEDDED_PDV_identification::XER_encode(const XERdescriptor_t& p_td,
-  TTCN_Buffer& p_buf, unsigned int flavor, int indent) const
+  TTCN_Buffer& p_buf, unsigned int flavor, int indent, embed_values_enc_struct_t*) const
 {
   int indenting = !is_canonical(flavor);
   int exer  = is_exer(flavor);
@@ -646,22 +780,22 @@ int EMBEDDED_PDV_identification::XER_encode(const XERdescriptor_t& p_td,
   ++indent;
   switch (union_selection) {
   case ALT_syntaxes:
-    field_syntaxes->XER_encode(EMBEDDED_PDV_identification_sxs_xer_, p_buf, flavor, indent);;
+    field_syntaxes->XER_encode(EMBEDDED_PDV_identification_sxs_xer_, p_buf, flavor, indent, 0);;
     break;
   case ALT_syntax:
-    field_syntax->XER_encode(EMBEDDED_PDV_identification_sx_xer_, p_buf, flavor, indent);;
+    field_syntax->XER_encode(EMBEDDED_PDV_identification_sx_xer_, p_buf, flavor, indent, 0);;
     break;
   case ALT_presentation__context__id:
-    field_presentation__context__id->XER_encode(EMBEDDED_PDV_identification_pci_xer_, p_buf, flavor, indent);;
+    field_presentation__context__id->XER_encode(EMBEDDED_PDV_identification_pci_xer_, p_buf, flavor, indent, 0);;
     break;
   case ALT_context__negotiation:
-    field_context__negotiation->XER_encode(EMBEDDED_PDV_identification_cn_xer_, p_buf, flavor, indent);;
+    field_context__negotiation->XER_encode(EMBEDDED_PDV_identification_cn_xer_, p_buf, flavor, indent, 0);;
     break;
   case ALT_transfer__syntax:
-    field_transfer__syntax->XER_encode(EMBEDDED_PDV_identification_ts_xer_, p_buf, flavor, indent);;
+    field_transfer__syntax->XER_encode(EMBEDDED_PDV_identification_ts_xer_, p_buf, flavor, indent, 0);;
     break;
   case ALT_fixed:
-    field_fixed->XER_encode(EMBEDDED_PDV_identification_fix_xer_, p_buf, flavor, indent);;
+    field_fixed->XER_encode(EMBEDDED_PDV_identification_fix_xer_, p_buf, flavor, indent, 0);;
     break;
   default:
     TTCN_EncDec_ErrorContext::error_internal("Unknown selection.");
@@ -677,7 +811,7 @@ int EMBEDDED_PDV_identification::XER_encode(const XERdescriptor_t& p_td,
 }
 
 int EMBEDDED_PDV_identification::XER_decode(const XERdescriptor_t& p_td,
-  XmlReaderWrap& reader, unsigned int flavor)
+  XmlReaderWrap& reader, unsigned int flavor, unsigned int flavor2, embed_values_dec_struct_t*)
 {
   int exer  = is_exer(flavor);
   // we are supposed to be parked on our element
@@ -697,27 +831,27 @@ int EMBEDDED_PDV_identification::XER_decode(const XERdescriptor_t& p_td,
        size_t namelen = strlen(name);
        switch (namelen) {
        case 8: // syntaxes
-         syntaxes().XER_decode(EMBEDDED_PDV_identification_sxs_xer_, reader, flavor);
+         syntaxes().XER_decode(EMBEDDED_PDV_identification_sxs_xer_, reader, flavor, flavor2, 0);
          break;
 
        case 6: // syntax
-         syntax().XER_decode(EMBEDDED_PDV_identification_sx_xer_, reader, flavor);
+         syntax().XER_decode(EMBEDDED_PDV_identification_sx_xer_, reader, flavor, flavor2, 0);
          break;
 
        case 23: // presentation-context-id
-         presentation__context__id().XER_decode(EMBEDDED_PDV_identification_pci_xer_, reader, flavor);
+         presentation__context__id().XER_decode(EMBEDDED_PDV_identification_pci_xer_, reader, flavor, flavor2, 0);
          break;
 
        case 19: // context-negotiation
-         context__negotiation().XER_decode(EMBEDDED_PDV_identification_cn_xer_, reader, flavor);
+         context__negotiation().XER_decode(EMBEDDED_PDV_identification_cn_xer_, reader, flavor, flavor2, 0);
          break;
 
        case 15: // transfer-syntax
-         transfer__syntax().XER_decode(EMBEDDED_PDV_identification_ts_xer_, reader, flavor);
+         transfer__syntax().XER_decode(EMBEDDED_PDV_identification_ts_xer_, reader, flavor, flavor2, 0);
          break;
 
        case 5: // fixed
-         fixed().XER_decode(EMBEDDED_PDV_identification_fix_xer_, reader, flavor);
+         fixed().XER_decode(EMBEDDED_PDV_identification_fix_xer_, reader, flavor, flavor2, 0);
          break;
 
        default:
@@ -930,7 +1064,8 @@ EMBEDDED_PDV_identification_template& EMBEDDED_PDV_identification_template::oper
   return *this;
 }
 
-boolean EMBEDDED_PDV_identification_template::match(const EMBEDDED_PDV_identification& other_value) const
+boolean EMBEDDED_PDV_identification_template::match(const EMBEDDED_PDV_identification& other_value,
+                                                    boolean /* legacy */) const
 {
   switch (template_selection) {
   case ANY_VALUE:
@@ -1228,7 +1363,8 @@ void EMBEDDED_PDV_identification_template::log() const
   log_ifpresent();
 }
 
-void EMBEDDED_PDV_identification_template::log_match(const EMBEDDED_PDV_identification& match_value) const
+void EMBEDDED_PDV_identification_template::log_match(const EMBEDDED_PDV_identification& match_value,
+                                                     boolean /* legacy */) const
 {
   if(TTCN_Logger::VERBOSITY_COMPACT == TTCN_Logger::get_matching_verbosity()){
     if(match(match_value)){
@@ -1413,13 +1549,13 @@ void EMBEDDED_PDV_identification_template::decode_text(Text_Buf& text_buf)
   }
 }
 
-boolean EMBEDDED_PDV_identification_template::is_present() const
+boolean EMBEDDED_PDV_identification_template::is_present(boolean legacy /* = FALSE */) const
 {
   if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
-  return !match_omit();
+  return !match_omit(legacy);
 }
 
-boolean EMBEDDED_PDV_identification_template::match_omit() const
+boolean EMBEDDED_PDV_identification_template::match_omit(boolean legacy /* = FALSE */) const
 {
   if (is_ifpresent) return TRUE;
   switch (template_selection) {
@@ -1428,10 +1564,12 @@ boolean EMBEDDED_PDV_identification_template::match_omit() const
     return TRUE;
   case VALUE_LIST:
   case COMPLEMENTED_LIST:
-    for (unsigned int i=0; i<value_list.n_values; i++)
-      if (value_list.list_value[i].match_omit())
-        return template_selection==VALUE_LIST;
-    return template_selection==COMPLEMENTED_LIST;
+    if (legacy) {
+      for (unsigned int i=0; i<value_list.n_values; i++)
+        if (value_list.list_value[i].match_omit())
+          return template_selection==VALUE_LIST;
+      return template_selection==COMPLEMENTED_LIST;
+    } // else fall through
   default:
     return FALSE;
   }
@@ -1439,7 +1577,8 @@ boolean EMBEDDED_PDV_identification_template::match_omit() const
 }
 
 #ifndef TITAN_RUNTIME_2
-void EMBEDDED_PDV_identification_template::check_restriction(template_res t_res, const char* t_name) const
+void EMBEDDED_PDV_identification_template::check_restriction(template_res t_res, const char* t_name,
+                                                             boolean legacy /* = FALSE */) const
 {
   if (template_selection==UNINITIALIZED_TEMPLATE) return;
   switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
@@ -1451,7 +1590,7 @@ void EMBEDDED_PDV_identification_template::check_restriction(template_res t_res,
         template_selection==SPECIFIC_VALUE)) return;
     break;
   case TR_PRESENT:
-    if (!match_omit()) return;
+    if (!match_omit(legacy)) return;
     break;
   default:
     return;
@@ -1516,34 +1655,38 @@ void EMBEDDED_PDV_identification_syntaxes::clean_up()
 void EMBEDDED_PDV_identification_syntaxes::set_param(Module_Param& param)
 {
   param.basic_check(Module_Param::BC_VALUE, "record value");
-  switch (param.get_type()) {
+  Module_Param_Ptr mp = &param;
+  if (param.get_type() == Module_Param::MP_Reference) {
+    mp = param.get_referenced_param();
+  }
+  switch (mp->get_type()) {
   case Module_Param::MP_Value_List:
-    if (param.get_size()==0) return;
-    if (2!=param.get_size()) {
-      param.error("record value of type EMBEDDED PDV.identification.syntaxes has 2 fields but list value has %d fields", (int)param.get_size());
+    if (mp->get_size()==0) return;
+    if (2!=mp->get_size()) {
+      param.error("record value of type EMBEDDED PDV.identification.syntaxes has 2 fields but list value has %d fields", (int)mp->get_size());
     }
-    if (param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) abstract().set_param(*param.get_elem(0));
-    if (param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) transfer().set_param(*param.get_elem(1));
+    if (mp->get_elem(0)->get_type()!=Module_Param::MP_NotUsed) abstract().set_param(*mp->get_elem(0));
+    if (mp->get_elem(1)->get_type()!=Module_Param::MP_NotUsed) transfer().set_param(*mp->get_elem(1));
     break;
   case Module_Param::MP_Assignment_List: {
-    Vector<bool> value_used(param.get_size());
-    value_used.resize(param.get_size(), false);
-    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
-      Module_Param* const curr_param = param.get_elem(val_idx);
+    Vector<bool> value_used(mp->get_size());
+    value_used.resize(mp->get_size(), false);
+    for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) {
+      Module_Param* const curr_param = mp->get_elem(val_idx);
       if (!strcmp(curr_param->get_id()->get_name(), "abstract")) {
         abstract().set_param(*curr_param);
         value_used[val_idx]=true;
       }
     }
-    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
-      Module_Param* const curr_param = param.get_elem(val_idx);
+    for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) {
+      Module_Param* const curr_param = mp->get_elem(val_idx);
       if (!strcmp(curr_param->get_id()->get_name(), "transfer")) {
         transfer().set_param(*curr_param);
         value_used[val_idx]=true;
       }
     }
-    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
-      param.get_elem(val_idx)->error("Non existent field name in type EMBEDDED PDV.identification.syntaxes: %s", param.get_elem(val_idx)->get_id()->get_name());
+    for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) if (!value_used[val_idx]) {
+      mp->get_elem(val_idx)->error("Non existent field name in type EMBEDDED PDV.identification.syntaxes: %s", mp->get_elem(val_idx)->get_id()->get_name());
       break;
     }
   } break;
@@ -1552,60 +1695,19 @@ void EMBEDDED_PDV_identification_syntaxes::set_param(Module_Param& param)
   }
 }
 
-void EMBEDDED_PDV_identification_syntaxes_template::set_param(Module_Param& param)
+Module_Param* EMBEDDED_PDV_identification_syntaxes::get_param(Module_Param_Name& param_name) const
 {
-  param.basic_check(Module_Param::BC_TEMPLATE, "record template");
-  switch (param.get_type()) {
-  case Module_Param::MP_Omit:
-    *this = OMIT_VALUE;
-    break;
-  case Module_Param::MP_Any:
-    *this = ANY_VALUE;
-    break;
-  case Module_Param::MP_AnyOrNone:
-    *this = ANY_OR_OMIT;
-    break;
-  case Module_Param::MP_List_Template:
-  case Module_Param::MP_ComplementList_Template:
-    set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : COMPLEMENTED_LIST, param.get_size());
-    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
-      list_item(p_i).set_param(*param.get_elem(p_i));
-    }
-    break;
-  case Module_Param::MP_Value_List:
-    if (param.get_size()==0) break;
-    if (2!=param.get_size()) {
-      param.error("record template of type EMBEDDED PDV.identification.syntaxes has 2 fields but list value has %d fields", (int)param.get_size());
-    }
-    if (param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) abstract().set_param(*param.get_elem(0));
-    if (param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) transfer().set_param(*param.get_elem(1));
-    break;
-  case Module_Param::MP_Assignment_List: {
-    Vector<bool> value_used(param.get_size());
-    value_used.resize(param.get_size(), false);
-    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
-      Module_Param* const curr_param = param.get_elem(val_idx);
-      if (!strcmp(curr_param->get_id()->get_name(), "abstract")) {
-        abstract().set_param(*curr_param);
-        value_used[val_idx]=true;
-      }
-    }
-    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
-      Module_Param* const curr_param = param.get_elem(val_idx);
-      if (!strcmp(curr_param->get_id()->get_name(), "transfer")) {
-        transfer().set_param(*curr_param);
-        value_used[val_idx]=true;
-      }
-    }
-    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
-      param.get_elem(val_idx)->error("Non existent field name in type EMBEDDED PDV.identification.syntaxes: %s", param.get_elem(val_idx)->get_id()->get_name());
-      break;
-    }
-  } break;
-  default:
-    param.type_error("record template", "EMBEDDED PDV.identification.syntaxes");
+  if (!is_bound()) {
+    return new Module_Param_Unbound();
   }
-  is_ifpresent = param.get_ifpresent();
+  Module_Param* mp_field_abstract = field_abstract.get_param(param_name);
+  mp_field_abstract->set_id(new Module_Param_FieldName(mcopystr("abstract")));
+  Module_Param* mp_field_transfer = field_transfer.get_param(param_name);
+  mp_field_transfer->set_id(new Module_Param_FieldName(mcopystr("transfer")));
+  Module_Param_Assignment_List* mp = new Module_Param_Assignment_List();
+  mp->add_elem(mp_field_abstract);
+  mp->add_elem(mp_field_transfer);
+  return mp;
 }
 
 void EMBEDDED_PDV_identification_syntaxes::encode_text(Text_Buf& text_buf) const
@@ -1667,7 +1769,7 @@ boolean EMBEDDED_PDV_identification_syntaxes::BER_decode_TLV(const TTCN_Typedesc
 }
 
 int EMBEDDED_PDV_identification_syntaxes::XER_encode(const XERdescriptor_t& p_td,
-    TTCN_Buffer& p_buf, unsigned int flavor, int indent) const
+    TTCN_Buffer& p_buf, unsigned int flavor, int indent, embed_values_enc_struct_t*) const
 {
   int indenting = !is_canonical(flavor);
   int exer  = is_exer(flavor);
@@ -1678,8 +1780,8 @@ int EMBEDDED_PDV_identification_syntaxes::XER_encode(const XERdescriptor_t& p_td
   p_buf.put_s((size_t)p_td.namelens[exer] - 1 + indenting, (const unsigned char*)p_td.names[exer]);
 
   ++indent;
-  field_abstract.XER_encode(EMBEDDED_PDV_identification_sxs_abs_xer_, p_buf, flavor, indent);
-  field_transfer.XER_encode(EMBEDDED_PDV_identification_sxs_xfr_xer_, p_buf, flavor, indent);
+  field_abstract.XER_encode(EMBEDDED_PDV_identification_sxs_abs_xer_, p_buf, flavor, indent, 0);
+  field_transfer.XER_encode(EMBEDDED_PDV_identification_sxs_xfr_xer_, p_buf, flavor, indent, 0);
 
   if (indenting) do_indent(p_buf, --indent);
   p_buf.put_c('<');
@@ -1690,7 +1792,7 @@ int EMBEDDED_PDV_identification_syntaxes::XER_encode(const XERdescriptor_t& p_td
 }
 
 int EMBEDDED_PDV_identification_syntaxes::XER_decode(const XERdescriptor_t& /*p_td*/,
-  XmlReaderWrap& reader, unsigned int flavor)
+  XmlReaderWrap& reader, unsigned int flavor, unsigned int flavor2, embed_values_dec_struct_t*)
 { // we stand on <syntaxes>, move ahead first
   int type;
   for (int success = reader.Read(); success == 1; success = reader.Read())
@@ -1701,8 +1803,8 @@ int EMBEDDED_PDV_identification_syntaxes::XER_decode(const XERdescriptor_t& /*p_
       break;
   }
   // FIXME this assumes the right element
-  field_abstract.XER_decode(EMBEDDED_PDV_identification_sxs_abs_xer_, reader, flavor);
-  field_transfer.XER_decode(EMBEDDED_PDV_identification_sxs_xfr_xer_, reader, flavor);
+  field_abstract.XER_decode(EMBEDDED_PDV_identification_sxs_abs_xer_, reader, flavor, flavor2, 0);
+  field_transfer.XER_decode(EMBEDDED_PDV_identification_sxs_xfr_xer_, reader, flavor, flavor2, 0);
   for (int success = 1; success == 1; success = reader.Read())
   {
     type = reader.NodeType();
@@ -1719,6 +1821,115 @@ struct EMBEDDED_PDV_identification_syntaxes_template::single_value_struct {
   OBJID_template field_transfer;
 };
 
+void EMBEDDED_PDV_identification_syntaxes_template::set_param(Module_Param& param)
+{
+  param.basic_check(Module_Param::BC_TEMPLATE, "record template");
+  Module_Param_Ptr mp = &param;
+  if (param.get_type() == Module_Param::MP_Reference) {
+    mp = param.get_referenced_param();
+  }
+  switch (mp->get_type()) {
+  case Module_Param::MP_Omit:
+    *this = OMIT_VALUE;
+    break;
+  case Module_Param::MP_Any:
+    *this = ANY_VALUE;
+    break;
+  case Module_Param::MP_AnyOrNone:
+    *this = ANY_OR_OMIT;
+    break;
+  case Module_Param::MP_List_Template:
+  case Module_Param::MP_ComplementList_Template: {
+    EMBEDDED_PDV_identification_syntaxes_template temp;
+    temp.set_type(mp->get_type() == Module_Param::MP_List_Template ?
+      VALUE_LIST : COMPLEMENTED_LIST, mp->get_size());
+    for (size_t i=0; i<mp->get_size(); i++) {
+      temp.list_item(i).set_param(*mp->get_elem(i));
+    }
+    *this = temp;
+    break; }
+  case Module_Param::MP_Value_List:
+    if (mp->get_size()==0) break;
+    if (2!=mp->get_size()) {
+      param.error("record template of type EMBEDDED PDV.identification.syntaxes has 2 fields but list value has %d fields", (int)mp->get_size());
+    }
+    if (mp->get_elem(0)->get_type()!=Module_Param::MP_NotUsed) abstract().set_param(*mp->get_elem(0));
+    if (mp->get_elem(1)->get_type()!=Module_Param::MP_NotUsed) transfer().set_param(*mp->get_elem(1));
+    break;
+  case Module_Param::MP_Assignment_List: {
+    Vector<bool> value_used(mp->get_size());
+    value_used.resize(mp->get_size(), false);
+    for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) {
+      Module_Param* const curr_param = mp->get_elem(val_idx);
+      if (!strcmp(curr_param->get_id()->get_name(), "abstract")) {
+        abstract().set_param(*curr_param);
+        value_used[val_idx]=true;
+      }
+    }
+    for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) {
+      Module_Param* const curr_param = mp->get_elem(val_idx);
+      if (!strcmp(curr_param->get_id()->get_name(), "transfer")) {
+        transfer().set_param(*curr_param);
+        value_used[val_idx]=true;
+      }
+    }
+    for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) if (!value_used[val_idx]) {
+      mp->get_elem(val_idx)->error("Non existent field name in type EMBEDDED PDV.identification.syntaxes: %s", mp->get_elem(val_idx)->get_id()->get_name());
+      break;
+    }
+  } break;
+  default:
+    param.type_error("record template", "EMBEDDED PDV.identification.syntaxes");
+  }
+  is_ifpresent = param.get_ifpresent() || mp->get_ifpresent();
+}
+
+Module_Param* EMBEDDED_PDV_identification_syntaxes_template::get_param(Module_Param_Name& param_name) const
+{
+  Module_Param* mp = NULL;
+  switch (template_selection) {
+  case UNINITIALIZED_TEMPLATE:
+    mp = new Module_Param_Unbound();
+    break;
+  case OMIT_VALUE:
+    mp = new Module_Param_Omit();
+    break;
+  case ANY_VALUE:
+    mp = new Module_Param_Any();
+    break;
+  case ANY_OR_OMIT:
+    mp = new Module_Param_AnyOrNone();
+    break;
+  case SPECIFIC_VALUE: {
+    Module_Param* mp_field_abstract = single_value->field_abstract.get_param(param_name);
+    mp_field_abstract->set_id(new Module_Param_FieldName(mcopystr("abstract")));
+    Module_Param* mp_field_transfer = single_value->field_transfer.get_param(param_name);
+    mp_field_transfer->set_id(new Module_Param_FieldName(mcopystr("transfer")));
+    mp = new Module_Param_Assignment_List();
+    mp->add_elem(mp_field_abstract);
+    mp->add_elem(mp_field_transfer);
+    break; }
+  case VALUE_LIST:
+  case COMPLEMENTED_LIST: {
+    if (template_selection == VALUE_LIST) {
+      mp = new Module_Param_List_Template();
+    }
+    else {
+      mp = new Module_Param_ComplementList_Template();
+    }
+    for (size_t i = 0; i < value_list.n_values; ++i) {
+      mp->add_elem(value_list.list_value[i].get_param(param_name));
+    }
+    break; }
+  default:
+    break;
+  }
+  if (is_ifpresent) {
+    mp->set_ifpresent();
+  }
+  return mp;
+}
+
 void EMBEDDED_PDV_identification_syntaxes_template::clean_up()
 {
   switch (template_selection) {
@@ -1860,7 +2071,8 @@ EMBEDDED_PDV_identification_syntaxes_template& EMBEDDED_PDV_identification_synta
   return *this;
 }
 
-boolean EMBEDDED_PDV_identification_syntaxes_template::match(const EMBEDDED_PDV_identification_syntaxes& other_value) const
+boolean EMBEDDED_PDV_identification_syntaxes_template::match(const EMBEDDED_PDV_identification_syntaxes& other_value,
+                                                             boolean /* legacy */) const
 {
   switch (template_selection) {
   case ANY_VALUE:
@@ -2002,7 +2214,8 @@ void EMBEDDED_PDV_identification_syntaxes_template::log() const
   log_ifpresent();
 }
 
-void EMBEDDED_PDV_identification_syntaxes_template::log_match(const EMBEDDED_PDV_identification_syntaxes& match_value) const
+void EMBEDDED_PDV_identification_syntaxes_template::log_match(const EMBEDDED_PDV_identification_syntaxes& match_value,
+                                                              boolean /* legacy */) const
 {
   if (template_selection == SPECIFIC_VALUE) {
     TTCN_Logger::log_event_str("{ abstract := ");
@@ -2068,13 +2281,13 @@ void EMBEDDED_PDV_identification_syntaxes_template::decode_text(Text_Buf& text_b
   }
 }
 
-boolean EMBEDDED_PDV_identification_syntaxes_template::is_present() const
+boolean EMBEDDED_PDV_identification_syntaxes_template::is_present(boolean legacy /* = FALSE */) const
 {
   if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
-  return !match_omit();
+  return !match_omit(legacy);
 }
 
-boolean EMBEDDED_PDV_identification_syntaxes_template::match_omit() const
+boolean EMBEDDED_PDV_identification_syntaxes_template::match_omit(boolean legacy /* = FALSE */) const
 {
   if (is_ifpresent) return TRUE;
   switch (template_selection) {
@@ -2083,10 +2296,12 @@ boolean EMBEDDED_PDV_identification_syntaxes_template::match_omit() const
     return TRUE;
   case VALUE_LIST:
   case COMPLEMENTED_LIST:
-    for (unsigned int i=0; i<value_list.n_values; i++)
-      if (value_list.list_value[i].match_omit())
-        return template_selection==VALUE_LIST;
-    return template_selection==COMPLEMENTED_LIST;
+    if (legacy) {
+      for (unsigned int i=0; i<value_list.n_values; i++)
+        if (value_list.list_value[i].match_omit())
+          return template_selection==VALUE_LIST;
+      return template_selection==COMPLEMENTED_LIST;
+    } // else fall through
   default:
     return FALSE;
   }
@@ -2094,7 +2309,8 @@ boolean EMBEDDED_PDV_identification_syntaxes_template::match_omit() const
 }
 
 #ifndef TITAN_RUNTIME_2
-void EMBEDDED_PDV_identification_syntaxes_template::check_restriction(template_res t_res, const char* t_name) const
+void EMBEDDED_PDV_identification_syntaxes_template::check_restriction(template_res t_res, const char* t_name,
+                                                                      boolean legacy /* = FALSE */) const
 {
   if (template_selection==UNINITIALIZED_TEMPLATE) return;
   switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
@@ -2106,7 +2322,7 @@ void EMBEDDED_PDV_identification_syntaxes_template::check_restriction(template_r
         template_selection==SPECIFIC_VALUE)) return;
     break;
   case TR_PRESENT:
-    if (!match_omit()) return;
+    if (!match_omit(legacy)) return;
     break;
   default:
     return;
@@ -2171,34 +2387,38 @@ void EMBEDDED_PDV_identification_context__negotiation::clean_up()
 void EMBEDDED_PDV_identification_context__negotiation::set_param(Module_Param& param)
 {
   param.basic_check(Module_Param::BC_VALUE, "record value");
-  switch (param.get_type()) {
+  Module_Param_Ptr mp = &param;
+  if (param.get_type() == Module_Param::MP_Reference) {
+    mp = param.get_referenced_param();
+  }
+  switch (mp->get_type()) {
   case Module_Param::MP_Value_List:
-    if (param.get_size()==0) return;
-    if (2!=param.get_size()) {
-      param.error("record value of type EMBEDDED PDV.identification.context-negotiation has 2 fields but list value has %d fields", (int)param.get_size());
+    if (mp->get_size()==0) return;
+    if (2!=mp->get_size()) {
+      param.error("record value of type EMBEDDED PDV.identification.context-negotiation has 2 fields but list value has %d fields", (int)mp->get_size());
     }
-    if (param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) presentation__context__id().set_param(*param.get_elem(0));
-    if (param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) transfer__syntax().set_param(*param.get_elem(1));
+    if (mp->get_elem(0)->get_type()!=Module_Param::MP_NotUsed) presentation__context__id().set_param(*mp->get_elem(0));
+    if (mp->get_elem(1)->get_type()!=Module_Param::MP_NotUsed) transfer__syntax().set_param(*mp->get_elem(1));
     break;
   case Module_Param::MP_Assignment_List: {
-    Vector<bool> value_used(param.get_size());
-    value_used.resize(param.get_size(), false);
-    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
-      Module_Param* const curr_param = param.get_elem(val_idx);
+    Vector<bool> value_used(mp->get_size());
+    value_used.resize(mp->get_size(), false);
+    for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) {
+      Module_Param* const curr_param = mp->get_elem(val_idx);
       if (!strcmp(curr_param->get_id()->get_name(), "presentation_context_id")) {
         presentation__context__id().set_param(*curr_param);
         value_used[val_idx]=true;
       }
     }
-    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
-      Module_Param* const curr_param = param.get_elem(val_idx);
+    for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) {
+      Module_Param* const curr_param = mp->get_elem(val_idx);
       if (!strcmp(curr_param->get_id()->get_name(), "transfer_syntax")) {
         transfer__syntax().set_param(*curr_param);
         value_used[val_idx]=true;
       }
     }
-    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
-      param.get_elem(val_idx)->error("Non existent field name in type EMBEDDED PDV.identification.context-negotiation: %s", param.get_elem(val_idx)->get_id()->get_name());
+    for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) if (!value_used[val_idx]) {
+      mp->get_elem(val_idx)->error("Non existent field name in type EMBEDDED PDV.identification.context-negotiation: %s", mp->get_elem(val_idx)->get_id()->get_name());
       break;
     }
   } break;
@@ -2207,60 +2427,19 @@ void EMBEDDED_PDV_identification_context__negotiation::set_param(Module_Param& p
   }
 }
 
-void EMBEDDED_PDV_identification_context__negotiation_template::set_param(Module_Param& param)
+Module_Param* EMBEDDED_PDV_identification_context__negotiation::get_param(Module_Param_Name& param_name) const
 {
-  param.basic_check(Module_Param::BC_TEMPLATE, "record template");
-  switch (param.get_type()) {
-  case Module_Param::MP_Omit:
-    *this = OMIT_VALUE;
-    break;
-  case Module_Param::MP_Any:
-    *this = ANY_VALUE;
-    break;
-  case Module_Param::MP_AnyOrNone:
-    *this = ANY_OR_OMIT;
-    break;
-  case Module_Param::MP_List_Template:
-  case Module_Param::MP_ComplementList_Template:
-    set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : COMPLEMENTED_LIST, param.get_size());
-    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
-      list_item(p_i).set_param(*param.get_elem(p_i));
-    }
-    break;
-  case Module_Param::MP_Value_List:
-    if (param.get_size()==0) break;
-    if (2!=param.get_size()) {
-      param.error("record template of type EMBEDDED PDV.identification.context-negotiation has 2 fields but list value has %d fields", (int)param.get_size());
-    }
-    if (param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) presentation__context__id().set_param(*param.get_elem(0));
-    if (param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) transfer__syntax().set_param(*param.get_elem(1));
-    break;
-  case Module_Param::MP_Assignment_List: {
-    Vector<bool> value_used(param.get_size());
-    value_used.resize(param.get_size(), false);
-    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
-      Module_Param* const curr_param = param.get_elem(val_idx);
-      if (!strcmp(curr_param->get_id()->get_name(), "presentation_context_id")) {
-        presentation__context__id().set_param(*curr_param);
-        value_used[val_idx]=true;
-      }
-    }
-    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
-      Module_Param* const curr_param = param.get_elem(val_idx);
-      if (!strcmp(curr_param->get_id()->get_name(), "transfer_syntax")) {
-        transfer__syntax().set_param(*curr_param);
-        value_used[val_idx]=true;
-      }
-    }
-    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
-      param.get_elem(val_idx)->error("Non existent field name in type EMBEDDED PDV.identification.context-negotiation: %s", param.get_elem(val_idx)->get_id()->get_name());
-      break;
-    }
-  } break;
-  default:
-    param.type_error("record template", "EMBEDDED PDV.identification.context-negotiation");
+  if (!is_bound()) {
+    return new Module_Param_Unbound();
   }
-  is_ifpresent = param.get_ifpresent();
+  Module_Param* mp_field_presentation_context_id = field_presentation__context__id.get_param(param_name);
+  mp_field_presentation_context_id->set_id(new Module_Param_FieldName(mcopystr("presentation_context_id")));
+  Module_Param* mp_field_transfer_syntax = field_transfer__syntax.get_param(param_name);
+  mp_field_transfer_syntax->set_id(new Module_Param_FieldName(mcopystr("transfer_syntax")));
+  Module_Param_Assignment_List* mp = new Module_Param_Assignment_List();
+  mp->add_elem(mp_field_presentation_context_id);
+  mp->add_elem(mp_field_transfer_syntax);
+  return mp;
 }
 
 void EMBEDDED_PDV_identification_context__negotiation::encode_text(Text_Buf& text_buf) const
@@ -2323,7 +2502,7 @@ boolean EMBEDDED_PDV_identification_context__negotiation::BER_decode_TLV(const T
 }
 
 int EMBEDDED_PDV_identification_context__negotiation::XER_encode(const XERdescriptor_t& p_td,
-    TTCN_Buffer& p_buf, unsigned int flavor, int indent) const
+    TTCN_Buffer& p_buf, unsigned int flavor, int indent, embed_values_enc_struct_t*) const
 {
   int indenting = !is_canonical(flavor);
   int exer  = is_exer(flavor);
@@ -2334,8 +2513,8 @@ int EMBEDDED_PDV_identification_context__negotiation::XER_encode(const XERdescri
   p_buf.put_s((size_t)p_td.namelens[exer] - 1 + indenting, (const unsigned char*)p_td.names[exer]);
 
   ++indent;
-  field_presentation__context__id.XER_encode(EMBEDDED_PDV_identification_cn_pci_xer_, p_buf, flavor, indent);
-  field_transfer__syntax         .XER_encode(EMBEDDED_PDV_identification_cn_tsx_xer_, p_buf, flavor, indent);
+  field_presentation__context__id.XER_encode(EMBEDDED_PDV_identification_cn_pci_xer_, p_buf, flavor, indent, 0);
+  field_transfer__syntax         .XER_encode(EMBEDDED_PDV_identification_cn_tsx_xer_, p_buf, flavor, indent, 0);
 
   if (indenting) do_indent(p_buf, --indent);
   p_buf.put_c('<');
@@ -2346,7 +2525,7 @@ int EMBEDDED_PDV_identification_context__negotiation::XER_encode(const XERdescri
 }
 
 int EMBEDDED_PDV_identification_context__negotiation::XER_decode(
-  const XERdescriptor_t& p_td, XmlReaderWrap& reader, unsigned int flavor)
+  const XERdescriptor_t& p_td, XmlReaderWrap& reader, unsigned int flavor, unsigned int flavor2, embed_values_dec_struct_t*)
 {
   int exer  = is_exer(flavor);
   int type = reader.NodeType(), depth = -1;
@@ -2357,8 +2536,8 @@ int EMBEDDED_PDV_identification_context__negotiation::XER_decode(
     depth = reader.Depth();
     success = reader.Read();
   }
-  field_presentation__context__id.XER_decode(EMBEDDED_PDV_identification_cn_pci_xer_, reader, flavor);
-  field_transfer__syntax         .XER_decode(EMBEDDED_PDV_identification_cn_tsx_xer_, reader, flavor);
+  field_presentation__context__id.XER_decode(EMBEDDED_PDV_identification_cn_pci_xer_, reader, flavor, flavor2, 0);
+  field_transfer__syntax         .XER_decode(EMBEDDED_PDV_identification_cn_tsx_xer_, reader, flavor, flavor2, 0);
   for (; success == 1; success = reader.Read()) {
     type = reader.NodeType();
     if (XML_READER_TYPE_END_ELEMENT == type) {
@@ -2375,6 +2554,115 @@ struct EMBEDDED_PDV_identification_context__negotiation_template::single_value_s
   OBJID_template field_transfer__syntax;
 };
 
+void EMBEDDED_PDV_identification_context__negotiation_template::set_param(Module_Param& param)
+{
+  param.basic_check(Module_Param::BC_TEMPLATE, "record template");
+  Module_Param_Ptr mp = &param;
+  if (param.get_type() == Module_Param::MP_Reference) {
+    mp = param.get_referenced_param();
+  }
+  switch (mp->get_type()) {
+  case Module_Param::MP_Omit:
+    *this = OMIT_VALUE;
+    break;
+  case Module_Param::MP_Any:
+    *this = ANY_VALUE;
+    break;
+  case Module_Param::MP_AnyOrNone:
+    *this = ANY_OR_OMIT;
+    break;
+  case Module_Param::MP_List_Template:
+  case Module_Param::MP_ComplementList_Template: {
+    EMBEDDED_PDV_identification_context__negotiation_template temp;
+    temp.set_type(mp->get_type() == Module_Param::MP_List_Template ?
+      VALUE_LIST : COMPLEMENTED_LIST, mp->get_size());
+    for (size_t i=0; i<mp->get_size(); i++) {
+      temp.list_item(i).set_param(*mp->get_elem(i));
+    }
+    *this = temp;
+    break; }
+  case Module_Param::MP_Value_List:
+    if (mp->get_size()==0) break;
+    if (2!=mp->get_size()) {
+      param.error("record template of type EMBEDDED PDV.identification.context-negotiation has 2 fields but list value has %d fields", (int)mp->get_size());
+    }
+    if (mp->get_elem(0)->get_type()!=Module_Param::MP_NotUsed) presentation__context__id().set_param(*mp->get_elem(0));
+    if (mp->get_elem(1)->get_type()!=Module_Param::MP_NotUsed) transfer__syntax().set_param(*mp->get_elem(1));
+    break;
+  case Module_Param::MP_Assignment_List: {
+    Vector<bool> value_used(mp->get_size());
+    value_used.resize(mp->get_size(), false);
+    for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) {
+      Module_Param* const curr_param = mp->get_elem(val_idx);
+      if (!strcmp(curr_param->get_id()->get_name(), "presentation_context_id")) {
+        presentation__context__id().set_param(*curr_param);
+        value_used[val_idx]=true;
+      }
+    }
+    for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) {
+      Module_Param* const curr_param = mp->get_elem(val_idx);
+      if (!strcmp(curr_param->get_id()->get_name(), "transfer_syntax")) {
+        transfer__syntax().set_param(*curr_param);
+        value_used[val_idx]=true;
+      }
+    }
+    for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) if (!value_used[val_idx]) {
+      mp->get_elem(val_idx)->error("Non existent field name in type EMBEDDED PDV.identification.context-negotiation: %s", mp->get_elem(val_idx)->get_id()->get_name());
+      break;
+    }
+  } break;
+  default:
+    param.type_error("record template", "EMBEDDED PDV.identification.context-negotiation");
+  }
+  is_ifpresent = param.get_ifpresent() || mp->get_ifpresent();
+}
+
+Module_Param* EMBEDDED_PDV_identification_context__negotiation_template::get_param(Module_Param_Name& param_name) const
+{
+  Module_Param* mp = NULL;
+  switch (template_selection) {
+  case UNINITIALIZED_TEMPLATE:
+    mp = new Module_Param_Unbound();
+    break;
+  case OMIT_VALUE:
+    mp = new Module_Param_Omit();
+    break;
+  case ANY_VALUE:
+    mp = new Module_Param_Any();
+    break;
+  case ANY_OR_OMIT:
+    mp = new Module_Param_AnyOrNone();
+    break;
+  case SPECIFIC_VALUE: {
+    Module_Param* mp_field_presentation_context_id = single_value->field_presentation__context__id.get_param(param_name);
+    mp_field_presentation_context_id->set_id(new Module_Param_FieldName(mcopystr("presentation_context_id")));
+    Module_Param* mp_field_transfer_syntax = single_value->field_transfer__syntax.get_param(param_name);
+    mp_field_transfer_syntax->set_id(new Module_Param_FieldName(mcopystr("transfer_syntax")));
+    mp = new Module_Param_Assignment_List();
+    mp->add_elem(mp_field_presentation_context_id);
+    mp->add_elem(mp_field_transfer_syntax);
+    break; }
+  case VALUE_LIST:
+  case COMPLEMENTED_LIST: {
+    if (template_selection == VALUE_LIST) {
+      mp = new Module_Param_List_Template();
+    }
+    else {
+      mp = new Module_Param_ComplementList_Template();
+    }
+    for (size_t i = 0; i < value_list.n_values; ++i) {
+      mp->add_elem(value_list.list_value[i].get_param(param_name));
+    }
+    break; }
+  default:
+    break;
+  }
+  if (is_ifpresent) {
+    mp->set_ifpresent();
+  }
+  return mp;
+}
+
 void EMBEDDED_PDV_identification_context__negotiation_template::clean_up()
 {
   switch (template_selection) {
@@ -2516,7 +2804,8 @@ EMBEDDED_PDV_identification_context__negotiation_template& EMBEDDED_PDV_identifi
   return *this;
 }
 
-boolean EMBEDDED_PDV_identification_context__negotiation_template::match(const EMBEDDED_PDV_identification_context__negotiation& other_value) const
+boolean EMBEDDED_PDV_identification_context__negotiation_template::match(const EMBEDDED_PDV_identification_context__negotiation& other_value,
+                                                                         boolean /* legacy */) const
 {
   switch (template_selection) {
   case ANY_VALUE:
@@ -2658,7 +2947,8 @@ void EMBEDDED_PDV_identification_context__negotiation_template::log() const
   log_ifpresent();
 }
 
-void EMBEDDED_PDV_identification_context__negotiation_template::log_match(const EMBEDDED_PDV_identification_context__negotiation& match_value) const
+void EMBEDDED_PDV_identification_context__negotiation_template::log_match(const EMBEDDED_PDV_identification_context__negotiation& match_value,
+                                                                          boolean /* legacy */) const
 {
   if (template_selection == SPECIFIC_VALUE) {
     TTCN_Logger::log_event_str("{ presentation_context_id := ");
@@ -2724,13 +3014,13 @@ void EMBEDDED_PDV_identification_context__negotiation_template::decode_text(Text
   }
 }
 
-boolean EMBEDDED_PDV_identification_context__negotiation_template::is_present() const
+boolean EMBEDDED_PDV_identification_context__negotiation_template::is_present(boolean legacy /* = FALSE */) const
 {
   if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
-  return !match_omit();
+  return !match_omit(legacy);
 }
 
-boolean EMBEDDED_PDV_identification_context__negotiation_template::match_omit() const
+boolean EMBEDDED_PDV_identification_context__negotiation_template::match_omit(boolean legacy /* = FALSE */) const
 {
   if (is_ifpresent) return TRUE;
   switch (template_selection) {
@@ -2739,10 +3029,12 @@ boolean EMBEDDED_PDV_identification_context__negotiation_template::match_omit()
     return TRUE;
   case VALUE_LIST:
   case COMPLEMENTED_LIST:
-    for (unsigned int i=0; i<value_list.n_values; i++)
-      if (value_list.list_value[i].match_omit())
-        return template_selection==VALUE_LIST;
-    return template_selection==COMPLEMENTED_LIST;
+    if (legacy) {
+      for (unsigned int i=0; i<value_list.n_values; i++)
+        if (value_list.list_value[i].match_omit())
+          return template_selection==VALUE_LIST;
+      return template_selection==COMPLEMENTED_LIST;
+    } // else fall through
   default:
     return FALSE;
   }
@@ -2750,7 +3042,8 @@ boolean EMBEDDED_PDV_identification_context__negotiation_template::match_omit()
 }
 
 #ifndef TITAN_RUNTIME_2
-void EMBEDDED_PDV_identification_context__negotiation_template::check_restriction(template_res t_res, const char* t_name) const
+void EMBEDDED_PDV_identification_context__negotiation_template::check_restriction(template_res t_res, const char* t_name,
+                                                                                  boolean legacy /* = FALSE */) const
 {
   if (template_selection==UNINITIALIZED_TEMPLATE) return;
   switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
@@ -2762,7 +3055,7 @@ void EMBEDDED_PDV_identification_context__negotiation_template::check_restrictio
         template_selection==SPECIFIC_VALUE)) return;
     break;
   case TR_PRESENT:
-    if (!match_omit()) return;
+    if (!match_omit(legacy)) return;
     break;
   default:
     return;
@@ -2836,42 +3129,46 @@ void EMBEDDED_PDV::clean_up()
 void EMBEDDED_PDV::set_param(Module_Param& param)
 {
   param.basic_check(Module_Param::BC_VALUE, "record value");
-  switch (param.get_type()) {
+  Module_Param_Ptr mp = &param;
+  if (param.get_type() == Module_Param::MP_Reference) {
+    mp = param.get_referenced_param();
+  }
+  switch (mp->get_type()) {
   case Module_Param::MP_Value_List:
-    if (param.get_size()==0) return;
-    if (3!=param.get_size()) {
-      param.error("record value of type EMBEDDED PDV has 3 fields but list value has %d fields", (int)param.get_size());
+    if (mp->get_size()==0) return;
+    if (3!=mp->get_size()) {
+      param.error("record value of type EMBEDDED PDV has 3 fields but list value has %d fields", (int)mp->get_size());
     }
-    if (param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) identification().set_param(*param.get_elem(0));
-    if (param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) data__value__descriptor().set_param(*param.get_elem(1));
-    if (param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) data__value().set_param(*param.get_elem(2));
+    if (mp->get_elem(0)->get_type()!=Module_Param::MP_NotUsed) identification().set_param(*mp->get_elem(0));
+    if (mp->get_elem(1)->get_type()!=Module_Param::MP_NotUsed) data__value__descriptor().set_param(*mp->get_elem(1));
+    if (mp->get_elem(2)->get_type()!=Module_Param::MP_NotUsed) data__value().set_param(*mp->get_elem(2));
     break;
   case Module_Param::MP_Assignment_List: {
-    Vector<bool> value_used(param.get_size());
-    value_used.resize(param.get_size(), false);
-    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
-      Module_Param* const curr_param = param.get_elem(val_idx);
+    Vector<bool> value_used(mp->get_size());
+    value_used.resize(mp->get_size(), false);
+    for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) {
+      Module_Param* const curr_param = mp->get_elem(val_idx);
       if (!strcmp(curr_param->get_id()->get_name(), "identification")) {
         identification().set_param(*curr_param);
         value_used[val_idx]=true;
       }
     }
-    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
-      Module_Param* const curr_param = param.get_elem(val_idx);
+    for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) {
+      Module_Param* const curr_param = mp->get_elem(val_idx);
       if (!strcmp(curr_param->get_id()->get_name(), "data_value_descriptor")) {
         data__value__descriptor().set_param(*curr_param);
         value_used[val_idx]=true;
       }
     }
-    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
-      Module_Param* const curr_param = param.get_elem(val_idx);
+    for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) {
+      Module_Param* const curr_param = mp->get_elem(val_idx);
       if (!strcmp(curr_param->get_id()->get_name(), "data_value")) {
         data__value().set_param(*curr_param);
         value_used[val_idx]=true;
       }
     }
-    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
-      param.get_elem(val_idx)->error("Non existent field name in type EMBEDDED PDV: %s", param.get_elem(val_idx)->get_id()->get_name());
+    for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) if (!value_used[val_idx]) {
+      mp->get_elem(val_idx)->error("Non existent field name in type EMBEDDED PDV: %s", mp->get_elem(val_idx)->get_id()->get_name());
       break;
     }
   } break;
@@ -2880,68 +3177,22 @@ void EMBEDDED_PDV::set_param(Module_Param& param)
   }
 }
 
-void EMBEDDED_PDV_template::set_param(Module_Param& param)
+Module_Param* EMBEDDED_PDV::get_param(Module_Param_Name& param_name) const
 {
-  param.basic_check(Module_Param::BC_TEMPLATE, "record template");
-  switch (param.get_type()) {
-  case Module_Param::MP_Omit:
-    *this = OMIT_VALUE;
-    break;
-  case Module_Param::MP_Any:
-    *this = ANY_VALUE;
-    break;
-  case Module_Param::MP_AnyOrNone:
-    *this = ANY_OR_OMIT;
-    break;
-  case Module_Param::MP_List_Template:
-  case Module_Param::MP_ComplementList_Template:
-    set_type(param.get_type()==Module_Param::MP_List_Template ? VALUE_LIST : COMPLEMENTED_LIST, param.get_size());
-    for (size_t p_i=0; p_i<param.get_size(); p_i++) {
-      list_item(p_i).set_param(*param.get_elem(p_i));
-    }
-    break;
-  case Module_Param::MP_Value_List:
-    if (param.get_size()==0) break;
-    if (3!=param.get_size()) {
-      param.error("record template of type EMBEDDED PDV has 3 fields but list value has %d fields", (int)param.get_size());
-    }
-    if (param.get_elem(0)->get_type()!=Module_Param::MP_NotUsed) identification().set_param(*param.get_elem(0));
-    if (param.get_elem(1)->get_type()!=Module_Param::MP_NotUsed) data__value__descriptor().set_param(*param.get_elem(1));
-    if (param.get_elem(2)->get_type()!=Module_Param::MP_NotUsed) data__value().set_param(*param.get_elem(2));
-    break;
-  case Module_Param::MP_Assignment_List: {
-    Vector<bool> value_used(param.get_size());
-    value_used.resize(param.get_size(), false);
-    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
-      Module_Param* const curr_param = param.get_elem(val_idx);
-      if (!strcmp(curr_param->get_id()->get_name(), "identification")) {
-        identification().set_param(*curr_param);
-        value_used[val_idx]=true;
-      }
-    }
-    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
-      Module_Param* const curr_param = param.get_elem(val_idx);
-      if (!strcmp(curr_param->get_id()->get_name(), "data_value_descriptor")) {
-        data__value__descriptor().set_param(*curr_param);
-        value_used[val_idx]=true;
-      }
-    }
-    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {
-      Module_Param* const curr_param = param.get_elem(val_idx);
-      if (!strcmp(curr_param->get_id()->get_name(), "data_value")) {
-        data__value().set_param(*curr_param);
-        value_used[val_idx]=true;
-      }
-    }
-    for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {
-      param.get_elem(val_idx)->error("Non existent field name in type EMBEDDED PDV: %s", param.get_elem(val_idx)->get_id()->get_name());
-      break;
-    }
-  } break;
-  default:
-    param.type_error("record template", "EMBEDDED PDV");
+  if (!is_bound()) {
+    return new Module_Param_Unbound();
   }
-  is_ifpresent = param.get_ifpresent();
+  Module_Param* mp_field_identification = field_identification.get_param(param_name);
+  mp_field_identification->set_id(new Module_Param_FieldName(mcopystr("identification")));
+  Module_Param* mp_field_data_value_descriptor = field_data__value__descriptor.get_param(param_name);
+  mp_field_data_value_descriptor->set_id(new Module_Param_FieldName(mcopystr("data_value_descriptor")));
+  Module_Param* mp_field_data_value = field_data__value.get_param(param_name);
+  mp_field_data_value->set_id(new Module_Param_FieldName(mcopystr("data_value")));
+  Module_Param_Assignment_List* mp = new Module_Param_Assignment_List();
+  mp->add_elem(mp_field_identification);
+  mp->add_elem(mp_field_data_value_descriptor);
+  mp->add_elem(mp_field_data_value);
+  return mp;
 }
 
 void EMBEDDED_PDV::encode_text(Text_Buf& text_buf) const
@@ -2984,7 +3235,7 @@ void EMBEDDED_PDV::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf,
   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(*p_td.xer,p_buf, XER_coding, 0);
+    XER_encode(*p_td.xer,p_buf, XER_coding, 0, 0);
     break;}
   case TTCN_EncDec::CT_JSON: {
     TTCN_EncDec_ErrorContext ec("While JSON-encoding type '%s': ", p_td.name);
@@ -3030,7 +3281,7 @@ void EMBEDDED_PDV::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf,
       if (type==XML_READER_TYPE_ELEMENT)
        break;
     }
-    XER_decode(*p_td.xer, reader, XER_coding);
+    XER_decode(*p_td.xer, reader, XER_coding, XER_NONE, 0);
     size_t bytes = reader.ByteConsumed();
     p_buf.set_pos(bytes);
     break;}
@@ -3097,7 +3348,7 @@ boolean EMBEDDED_PDV::BER_decode_TLV(const TTCN_Typedescriptor_t& p_td, const AS
 }
 
 int EMBEDDED_PDV::XER_encode(const XERdescriptor_t& p_td,
-                         TTCN_Buffer& p_buf, unsigned int flavor, int indent) const {
+  TTCN_Buffer& p_buf, unsigned int flavor, int indent, embed_values_enc_struct_t*) const {
   if(!is_bound()) {
     TTCN_EncDec_ErrorContext::error
       (TTCN_EncDec::ET_UNBOUND, "Encoding an unbound value.");
@@ -3111,13 +3362,13 @@ int EMBEDDED_PDV::XER_encode(const XERdescriptor_t& p_td,
   p_buf.put_s((size_t)p_td.namelens[exer] - 1 + indenting, (const unsigned char*)p_td.names[exer]);
   flavor &= XER_MASK;
   ++indent;
-  field_identification         .XER_encode(EMBEDDED_PDV_identification_xer_       , p_buf, flavor, indent);
+  field_identification         .XER_encode(EMBEDDED_PDV_identification_xer_       , p_buf, flavor, indent, 0);
   if (field_data__value__descriptor.is_value()) {
     TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_INVAL_MSG,
       "data-value-descriptor not allowed for EMBEDDED PDV");
   }
-  field_data__value__descriptor.XER_encode(EMBEDDED_PDV_data_value_descriptor_xer_, p_buf, flavor, indent);
-  field_data__value            .XER_encode(EMBEDDED_PDV_data_value_xer_           , p_buf, flavor, indent);
+  field_data__value__descriptor.XER_encode(EMBEDDED_PDV_data_value_descriptor_xer_, p_buf, flavor, indent, 0);
+  field_data__value            .XER_encode(EMBEDDED_PDV_data_value_xer_           , p_buf, flavor, indent, 0);
 
   if (indenting) do_indent(p_buf, --indent);
   p_buf.put_c('<');
@@ -3127,7 +3378,7 @@ int EMBEDDED_PDV::XER_encode(const XERdescriptor_t& p_td,
   return (int)p_buf.get_len() - encoded_length;
 }
 
-int EMBEDDED_PDV::XER_decode(const XERdescriptor_t& p_td, XmlReaderWrap& reader, unsigned int flavor)
+int EMBEDDED_PDV::XER_decode(const XERdescriptor_t& p_td, XmlReaderWrap& reader, unsigned int flavor, unsigned int flavor2, embed_values_dec_struct_t*)
 {
   int exer  = is_exer(flavor);
   int depth = 1, type, success;
@@ -3140,13 +3391,13 @@ int EMBEDDED_PDV::XER_decode(const XERdescriptor_t& p_td, XmlReaderWrap& reader,
       break;
     }
   }
-  field_identification         .XER_decode(EMBEDDED_PDV_identification_xer_       , reader, flavor);
-  field_data__value__descriptor.XER_decode(EMBEDDED_PDV_data_value_descriptor_xer_, reader, flavor);
+  field_identification         .XER_decode(EMBEDDED_PDV_identification_xer_       , reader, flavor, flavor2, 0);
+  field_data__value__descriptor.XER_decode(EMBEDDED_PDV_data_value_descriptor_xer_, reader, flavor, flavor2, 0);
   if (field_data__value__descriptor.is_value()) {
     TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_INVAL_MSG,
       "data-value-descriptor not allowed for EMBEDDED PDV");
   }
-  field_data__value            .XER_decode(EMBEDDED_PDV_data_value_xer_           , reader, flavor);
+  field_data__value            .XER_decode(EMBEDDED_PDV_data_value_xer_           , reader, flavor, flavor2, 0);
   for (success = reader.Read(); success == 1; success = reader.Read()) {
     type = reader.NodeType();
     if (XML_READER_TYPE_END_ELEMENT == type) {
@@ -3164,6 +3415,126 @@ struct EMBEDDED_PDV_template::single_value_struct {
   OCTETSTRING_template field_data__value;
 };
 
+void EMBEDDED_PDV_template::set_param(Module_Param& param)
+{
+  param.basic_check(Module_Param::BC_TEMPLATE, "record template");
+  Module_Param_Ptr mp = &param;
+  if (param.get_type() == Module_Param::MP_Reference) {
+    mp = param.get_referenced_param();
+  }
+  switch (mp->get_type()) {
+  case Module_Param::MP_Omit:
+    *this = OMIT_VALUE;
+    break;
+  case Module_Param::MP_Any:
+    *this = ANY_VALUE;
+    break;
+  case Module_Param::MP_AnyOrNone:
+    *this = ANY_OR_OMIT;
+    break;
+  case Module_Param::MP_List_Template:
+  case Module_Param::MP_ComplementList_Template: {
+    EMBEDDED_PDV_template temp;
+    temp.set_type(mp->get_type() == Module_Param::MP_List_Template ?
+      VALUE_LIST : COMPLEMENTED_LIST, mp->get_size());
+    for (size_t i=0; i<mp->get_size(); i++) {
+      temp.list_item(i).set_param(*mp->get_elem(i));
+    }
+    *this = temp;
+    break; }
+  case Module_Param::MP_Value_List:
+    if (mp->get_size()==0) break;
+    if (3!=mp->get_size()) {
+      param.error("record template of type EMBEDDED PDV has 3 fields but list value has %d fields", (int)mp->get_size());
+    }
+    if (mp->get_elem(0)->get_type()!=Module_Param::MP_NotUsed) identification().set_param(*mp->get_elem(0));
+    if (mp->get_elem(1)->get_type()!=Module_Param::MP_NotUsed) data__value__descriptor().set_param(*mp->get_elem(1));
+    if (mp->get_elem(2)->get_type()!=Module_Param::MP_NotUsed) data__value().set_param(*mp->get_elem(2));
+    break;
+  case Module_Param::MP_Assignment_List: {
+    Vector<bool> value_used(mp->get_size());
+    value_used.resize(mp->get_size(), false);
+    for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) {
+      Module_Param* const curr_param = mp->get_elem(val_idx);
+      if (!strcmp(curr_param->get_id()->get_name(), "identification")) {
+        identification().set_param(*curr_param);
+        value_used[val_idx]=true;
+      }
+    }
+    for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) {
+      Module_Param* const curr_param = mp->get_elem(val_idx);
+      if (!strcmp(curr_param->get_id()->get_name(), "data_value_descriptor")) {
+        data__value__descriptor().set_param(*curr_param);
+        value_used[val_idx]=true;
+      }
+    }
+    for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) {
+      Module_Param* const curr_param = mp->get_elem(val_idx);
+      if (!strcmp(curr_param->get_id()->get_name(), "data_value")) {
+        data__value().set_param(*curr_param);
+        value_used[val_idx]=true;
+      }
+    }
+    for (size_t val_idx=0; val_idx<mp->get_size(); val_idx++) if (!value_used[val_idx]) {
+      mp->get_elem(val_idx)->error("Non existent field name in type EMBEDDED PDV: %s", mp->get_elem(val_idx)->get_id()->get_name());
+      break;
+    }
+  } break;
+  default:
+    param.type_error("record template", "EMBEDDED PDV");
+  }
+  is_ifpresent = param.get_ifpresent() || mp->get_ifpresent();
+}
+
+Module_Param* EMBEDDED_PDV_template::get_param(Module_Param_Name& param_name) const
+{
+  Module_Param* mp = NULL;
+  switch (template_selection) {
+  case UNINITIALIZED_TEMPLATE:
+    mp = new Module_Param_Unbound();
+    break;
+  case OMIT_VALUE:
+    mp = new Module_Param_Omit();
+    break;
+  case ANY_VALUE:
+    mp = new Module_Param_Any();
+    break;
+  case ANY_OR_OMIT:
+    mp = new Module_Param_AnyOrNone();
+    break;
+  case SPECIFIC_VALUE: {
+    Module_Param* mp_field_identification = single_value->field_identification.get_param(param_name);
+    mp_field_identification->set_id(new Module_Param_FieldName(mcopystr("identification")));
+    Module_Param* mp_field_data_value_descriptor = single_value->field_data__value__descriptor.get_param(param_name);
+    mp_field_data_value_descriptor->set_id(new Module_Param_FieldName(mcopystr("data_value_descriptor")));
+    Module_Param* mp_field_string_value = single_value->field_data__value.get_param(param_name);
+    mp_field_string_value->set_id(new Module_Param_FieldName(mcopystr("data_value")));
+    mp = new Module_Param_Assignment_List();
+    mp->add_elem(mp_field_identification);
+    mp->add_elem(mp_field_data_value_descriptor);
+    mp->add_elem(mp_field_string_value);
+    break; }
+  case VALUE_LIST:
+  case COMPLEMENTED_LIST: {
+    if (template_selection == VALUE_LIST) {
+      mp = new Module_Param_List_Template();
+    }
+    else {
+      mp = new Module_Param_ComplementList_Template();
+    }
+    for (size_t i = 0; i < value_list.n_values; ++i) {
+      mp->add_elem(value_list.list_value[i].get_param(param_name));
+    }
+    break; }
+  default:
+    break;
+  }
+  if (is_ifpresent) {
+    mp->set_ifpresent();
+  }
+  return mp;
+}
+
 void EMBEDDED_PDV_template::clean_up()
 {
   switch (template_selection) {
@@ -3308,7 +3679,8 @@ EMBEDDED_PDV_template& EMBEDDED_PDV_template::operator=(const EMBEDDED_PDV_templ
   return *this;
 }
 
-boolean EMBEDDED_PDV_template::match(const EMBEDDED_PDV& other_value) const
+boolean EMBEDDED_PDV_template::match(const EMBEDDED_PDV& other_value,
+                                     boolean /* legacy */) const
 {
   switch (template_selection) {
   case ANY_VALUE:
@@ -3470,7 +3842,8 @@ void EMBEDDED_PDV_template::log() const
   log_ifpresent();
 }
 
-void EMBEDDED_PDV_template::log_match(const EMBEDDED_PDV& match_value) const
+void EMBEDDED_PDV_template::log_match(const EMBEDDED_PDV& match_value,
+                                      boolean /* legacy */) const
 {
   if (template_selection == SPECIFIC_VALUE) {
     TTCN_Logger::log_event_str("{ identification := ");
@@ -3546,13 +3919,13 @@ void EMBEDDED_PDV_template::decode_text(Text_Buf& text_buf)
   }
 }
 
-boolean EMBEDDED_PDV_template::is_present() const
+boolean EMBEDDED_PDV_template::is_present(boolean legacy /* = FALSE */) const
 {
   if (template_selection==UNINITIALIZED_TEMPLATE) return FALSE;
-  return !match_omit();
+  return !match_omit(legacy);
 }
 
-boolean EMBEDDED_PDV_template::match_omit() const
+boolean EMBEDDED_PDV_template::match_omit(boolean legacy /* = FALSE */) const
 {
   if (is_ifpresent) return TRUE;
   switch (template_selection) {
@@ -3561,10 +3934,14 @@ boolean EMBEDDED_PDV_template::match_omit() const
     return TRUE;
   case VALUE_LIST:
   case COMPLEMENTED_LIST:
-    for (unsigned int i=0; i<value_list.n_values; i++)
-      if (value_list.list_value[i].match_omit())
-        return template_selection==VALUE_LIST;
-    return template_selection==COMPLEMENTED_LIST;
+    if (legacy) {
+      // legacy behavior: 'omit' can appear in the value/complement list
+      for (unsigned int i=0; i<value_list.n_values; i++)
+        if (value_list.list_value[i].match_omit())
+          return template_selection==VALUE_LIST;
+      return template_selection==COMPLEMENTED_LIST;
+    }
+    // else fall through
   default:
     return FALSE;
   }
@@ -3572,7 +3949,8 @@ boolean EMBEDDED_PDV_template::match_omit() const
 }
 
 #ifndef TITAN_RUNTIME_2
-void EMBEDDED_PDV_template::check_restriction(template_res t_res, const char* t_name) const
+void EMBEDDED_PDV_template::check_restriction(template_res t_res, const char* t_name,
+                                              boolean legacy /* = FALSE */) const
 {
   if (template_selection==UNINITIALIZED_TEMPLATE) return;
   switch ((t_name&&(t_res==TR_VALUE))?TR_OMIT:t_res) {
@@ -3584,7 +3962,7 @@ void EMBEDDED_PDV_template::check_restriction(template_res t_res, const char* t_
         template_selection==SPECIFIC_VALUE)) return;
     break;
   case TR_PRESENT:
-    if (!match_omit()) return;
+    if (!match_omit(legacy)) return;
     break;
   default:
     return;
This page took 0.045257 seconds and 5 git commands to generate.